
:root {
  --container-padding: 2rem;
  --grid-gap: 1rem;
  --color-background: #f5f5f0;
  --color-text-primary: #18191a;
  --paper-bg: #fff;
  --paper-border: 1px solid rgba(0, 0, 0, 0.2);
  --backcover-bg: #111;
  --circle-1: #ccc;
  --circle-2: #999;
  --primary-font: "Inter", sans-serif;
  --secondary-font: "Cabinet Grotesk", serif;
}





@-webkit-keyframes noise-animation {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-2%, -3%);
  }

  20% {
    transform: translate(-4%, 2%);
  }

  30% {
    transform: translate(2%, -4%);
  }

  40% {
    transform: translate(-2%, 5%);
  }

  50% {
    transform: translate(-4%, 2%);
  }

  60% {
    transform: translate(3%, 0);
  }

  70% {
    transform: translate(0, 3%);
  }

  80% {
    transform: translate(-3%, 0);
  }

  90% {
    transform: translate(2%, 2%);
  }

  100% {
    transform: translate(1%, 0);
  }
}

@keyframes noise-animation {
  0% {
    transform: translate(0, 0);
  }

  10% {
    transform: translate(-2%, -3%);
  }

  20% {
    transform: translate(-4%, 2%);
  }

  30% {
    transform: translate(2%, -4%);
  }

  40% {
    transform: translate(-2%, 5%);
  }

  50% {
    transform: translate(-4%, 2%);
  }

  60% {
    transform: translate(3%, 0);
  }

  70% {
    transform: translate(0, 3%);
  }

  80% {
    transform: translate(-3%, 0);
  }

  90% {
    transform: translate(2%, 2%);
  }

  100% {
    transform: translate(1%, 0);
  }
}


/* Top Bar */
.top-left {
  grid-column: 1 / 5;
  grid-row: 1;
  align-self: start;
}

h2 {
  font-family: var(--secondary-font);
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 500;
  color: var(--color-text-primary);
}

.top-right {
  grid-column: 10 / 13;
  grid-row: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}

.top-right .circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.circle.circle1 {
  background: var(--circle-1);
}

.circle.circle2 {
  background: var(--circle-2);
  margin-left: -4px;
}

/* Book Item Styles */
.books__item {
  text-align: center;
  cursor: default;
}

.books__container {
  position: relative;
  width: 220px;
  margin: 0 auto;
}

.books__cover {
    position: relative;
    will-change: transform;
}

.books__hitbox {
    position: absolute !important;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 20; /* بالاترین لایه */
    cursor: pointer;
    text-decoration: none;
    background: transparent;
    border: none;
    outline: none;
}

/* Back Cover: 96% with 2% margin - RTL version */
.books__back-cover {
    position: absolute;
    width: 96%;
    height: 96%;
    top: 2%;
    right: 2%;
    background: var(--backcover-bg);
    border-radius: 6px 0 0 6px;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.4);
    z-index: 1;
}

/* Paper Container: 90% with equal top/bottom margin - RTL version */
.books__inside {
    position: absolute;
    width: 90%;
    height: 94%;
    top: 3%;
    right: 5%;
    z-index: 2;
}

.books__page {
    position: absolute;
    top: 0;
    left: 0;
    width: 98%;
    height: 100%;
    background: var(--paper-bg);
    border: var(--paper-border);
    border-radius: 6px 0 0 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transform-origin: left center;
    z-index: 3;
}

/* Initial stacking: pages start at 0 offset (fully stacked) */
.books__page:nth-child(1) {
  transform: translateX(0px);
}

.books__page:nth-child(2) {
  transform: translateX(0px);
}

.books__page:nth-child(3) {
  transform: translateX(0px);
}

/* Front Cover Image - RTL version */
.books__image {
    line-height: 0;
    position: relative;
    border-radius: 6px 2px 2px 6px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15), 0 30px 45px rgba(0, 0, 0, 0.12),
        0 60px 80px rgba(0, 0, 0, 0.1);
    transform: perspective(2000px) rotateY(0deg) translateX(0px) scaleX(1);
    transform-style: preserve-3d;
    transform-origin: right center;
    will-change: transform;
    z-index: 10; /* زیر لینک اما بالای صفحات */
}

.books__image img {
    width: 100%;
    border-radius: 6px 2px 2px 6px;
    display: block;
}

.books__effect {
    position: absolute;
    width: 20px;
    height: 100%;
    margin-right: 16px;
    top: 0;
    border-right: 2px solid #00000010;
    background-image: linear-gradient(
        270deg,
        rgba(255, 255, 255, 0.2) 0%,
        rgba(255, 255, 255, 0) 100%
    );
    transform-origin: right center;
    z-index: 11;
    pointer-events: none;
}

.books__light {
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 6px 2px 2px 6px;
    background-image: linear-gradient(
        270deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.5) 100%
    );
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.15;
    transform-origin: right center;
    z-index: 12;
    pointer-events: none;
    mix-blend-mode: overlay;
}

