:root{
  --bg:#0A0F2C;
  --text:#E6EFFF;
  --heading:#FF6B6B;
  --accent:#00FFD1;
  --hover:#B533FF;
  --detail:#FFE066;
  --neon-soft:0 0 24px rgba(181,51,255,.35), 0 0 60px rgba(0,255,209,.15);
  --bar: 3px; --speed: 300ms; 
}
.backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.25);
  opacity: 0; transition: opacity var(--speed);
  display:none;
}
.backdrop.show { opacity: 1; }
.hamburger {
    --size: 30px;
    width: var(--size); height: var(--size);
    border: 0; background: transparent; padding: 0; cursor: pointer;
    display: none; place-items: center;
  }
  .hamburger:focus-visible { outline: 2px solid #000; outline-offset: 3px; }

  .hamburger span {
    display: block; width: 100%; height: var(--bar); background: #fff;
    border-radius: 2px; transition: transform var(--speed), opacity var(--speed);
  }
  .hamburger span + span { margin-top: 5px; }

  .hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

*{box-sizing:border-box}
html,body{scroll-behavior: smooth;height:100%;}
body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow-x:hidden;
}
body[dir="rtl"]{font-family:Vazirmatn, sans-serif;}
h1,h2{letter-spacing:.2px}
.chapter-book .book-front {
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.6);
  display: grid;
  place-items: center;
  transition: filter 0.8s ease;
}

.chapter-book .book-volume {
  color: var(--text);
  font-size: 3rem;
  font-weight: 900;
  text-shadow: 0 0 10px rgba(0,0,0,0.8);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 0;
  margin: 0;
  display: block;
}

.chapter-book .book-front img {
  display: none;
}

.chapter-book .book-back {
  background: var(--bg);
  color: var(--accent);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.chapter-book .book-back p {
  display: none;
}
.button-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
}
a{color:var(--accent);text-decoration:none;}
a:hover{color:var(--hover)}

.btn{
  background:#101633;
  border:1px solid rgba(255,255,255,.1);
  color:var(--text);
  padding:.7rem 1.1rem;
  border-radius:12px;
  transition:transform .15s ease, box-shadow .2s ease, color .2s ease, border-color .2s ease, background .2s ease;
  box-shadow:0 2px 10px rgba(0,0,0,.35);
}
.btn:hover{transform:translateY(-1px);box-shadow:var(--neon-soft);border-color:rgba(0,255,209,.35)}
.btn.big{padding:1rem 1.4rem;font-weight:700;font-size:1.05rem;}
.btn-accent{background:linear-gradient(135deg, rgba(0,255,209,.25), rgba(181,51,255,.25)); border-color:rgba(0,255,209,.5);}
.btn-pink{background:linear-gradient(135deg, rgba(255,107,107,.25), rgba(181,51,255,.25))}
.btn-gold{background:linear-gradient(135deg, rgba(255,224,102,.25), rgba(181,51,255,.2))}
.chip{
  background:#0f1533; color:var(--text);
  border:1px solid rgba(255,255,255,.12);
  padding:.4rem .6rem; border-radius:999px;
}

.modal{position:fixed;inset:0;display:none;place-items:center;background:rgba(10,15,44,.65);backdrop-filter:blur(6px);z-index:50}
.modal.show{display:grid}
.modal-content{
  background:#0f1433; border:1px solid rgba(255,255,255,.12);
  border-radius:16px; padding:1.4rem; text-align:center;
  box-shadow:var(--neon-soft)
}
.modal-content h2{margin:.3rem 0 1rem 0}
.modal-actions{display:flex;gap:.6rem;justify-content:center}
.modal-note{opacity:.7; font-size:.85rem; margin-top:.8rem}

footer {
  background-color: #222;
  color: #f1f1f1;
  text-align: center;
  padding: 20px 10px;
  margin-top: 50px;
  font-size: 14px;
}

footer a {
  color: #4db6ff;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.nav{
  position:fixed; top:0; left:0; right:0; height:64px; display:flex; align-items:center; justify-content:space-between;
  padding:0 14px; z-index:20; background:rgba(10,15,44,.55); backdrop-filter:blur(8px); border-bottom:1px solid rgba(255,255,255,.06)
}
.nav .brand{font-weight:900; letter-spacing:2px; display:flex; align-items:center; gap:6px}
.logo-glow{color:var(--detail); text-shadow:0 0 12px rgba(255,224,102,.45)}
.logo-dot{color:var(--hover)}
.nav ul{list-style:none; display:flex; gap:100px;position: absolute; top: 10%; left: 50%;transform: translate(-50%); padding:0}
.nav li.extra{display:none}
@media (min-width:1100px){.nav li.extra{display:list-item}}
.nav a{font-weight:700; color:var(--text); opacity:.9}
.nav a:hover{color:var(--accent)}
.nav-actions{display:flex; gap:8px}
.hero{position:relative; height:100svh; width:100%; overflow:hidden}
.layer{position:absolute; inset:-10%; background-size:cover; background-position:center; background-attachment: fixed;}
.layer.skyline {
  position: fixed;
  inset: 0;
  background-image: url("/static/img/background.jpg");
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  filter: blur(2px) brightness(.55) saturate(1.1);
  z-index: -1;
}

.layer.fog{
  background:radial-gradient(60% 60% at 50% 70%, rgba(181,51,255,.25), transparent 60%),
             radial-gradient(50% 40% at 10% 10%, rgba(0,255,209,.15), transparent 60%);
  mix-blend-mode:screen; opacity:.45
}
.intro {
  position: relative;
  height: 200vh;
  background: url('/static/img/background.jpg') center/cover fixed no-repeat; 
  overflow: hidden;
}

#welcomeImg {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100vw;
  height: 100vh;
  background-image: url("/static/img/Welcome.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.geoo {
  position: absolute;
  background-size: cover;
  filter: blur(3px);
  opacity: 50%;
}
.layer.glow{
  background:radial-gradient(55% 45% at 70% 30%, rgba(0,255,209,.18), transparent 60%),
             radial-gradient(40% 40% at 30% 70%, rgba(255,107,107,.15), transparent 60%);
  mix-blend-mode:screen; pointer-events:none
}
.welcome{
  position:relative; z-index:5; display:grid; place-content:center; text-align:center; margin-top: 20%;
  transform:scale(4); animation:zoomReveal 1.2s ease forwards .2s;
}
@keyframes zoomReveal{to{transform:scale(3)}}
.welcome h1{
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  font-weight:900;
  line-height:1.05;
  color:var(--text);
  text-shadow: 0 0 18px rgba(255,255,255,.06), 0 0 36px rgba(0,255,209,.15);
}
.welcome h1 span{ color:var(--heading); text-shadow:0 0 26px rgba(255,107,107,.45)}
.welcome p{max-width:min(80ch, 92vw); margin:.9rem auto 1.3rem; opacity:.9}

.scroll-hint{position:absolute; bottom:18px; left:50%; transform:translateX(-50%); display:grid; place-items:center; gap:6px; opacity:.9}
.scroll-hint .chev{width:2px; height:24px; background:linear-gradient(var(--accent), transparent); animation:down 1.2s infinite}
@keyframes down{50%{transform:translateY(6px)}}

.section{padding:80px 6vw; border-top:1px solid rgba(255,255,255,.06); background:linear-gradient(180deg, rgba(255,255,255,.02), transparent)}
.section h2{color:var(--heading); margin:0 0 .6rem 0; text-shadow:var(--neon-soft)}
.section p{max-width:80ch; opacity:.9}

.pay-grid{display:flex; flex-wrap:wrap; gap:.6rem; margin:.6rem 0}

.nav.hidden{transform:translateY(-110%); transition:transform .25s ease}

#cursorBook{
  position:fixed; left:0; top:0; width:28px; height:24px; pointer-events:none; z-index:100;
  background:url('/static/img/cursor-book-closed.svg') center/contain no-repeat;
  filter:drop-shadow(0 0 6px rgba(181,51,255));
  transform:translate(-50%,-50%) scale(1);
  transition:transform .08s ease;
}
#cursorBook.open{
  background-image:url('/static/img/cursor-book-open.svg');
  animation:bookPop .28s ease;
}
@keyframes bookPop{50%{transform:translate(-50%,-50%) scale(1.25)}}

[dir="rtl"] .nav ul{direction: rtl;}
[dir="ltr"] .nav ul{direction: ltr;}
[dir="rtl"] .brand{flex-direction:row-reverse}

@media (max-width:820px){
  .nav ul{gap:12px}
  .welcome p{font-size:.98rem}
  #welcomeImg {
    background-image: url("/static/img/Welcome2.png");
  }
}


.bookshelf {
  display: grid;
  grid-template-columns: repeat(auto-fit, 200px);
  gap: 2rem;
  padding: 3rem;
  justify-items: center;
}

.book {
  perspective: 1000px;
}

.book-inner {
  position: relative;
  width: 200px;
  height: 300px;
  transform-style: preserve-3d;
  transition: transform 0.8s ease;
}

.book:hover .book-inner {
  transform: rotateY(180deg);
}

.book-front,
.book-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 10px 20px rgba(0,0,0,0.4);
}

.book-back p {
  word-wrap: break-word;
}

.book-front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-back {
  background: #222;
  color: #fff;
  padding: 1rem;
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
@media (max-width: 768px) {
  .hamburger {
    display: grid;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 50;
  }
  .backdrop { display: block; }
  #cursorBook {visibility: hidden;}
  .nav {
    top: 0;
    left: 50%;
    right: 0;
    height: 100vh;
    width: min(80vw, 300px);
    background: var(--bg);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 1rem;
    gap: 1rem;
    transform: translateX(100%);
    transition: transform var(--speed);
  }
  [dir="rtl"] .nav{right: 50%}
  .nav.open {
    transform: translateX(0);
  }

  .nav ul {
    flex-direction: column;
    gap: 1rem;
    position: static;
    transform: none;
    margin: 0;
    padding: 0;
  }
}

@media (max-width: 768px) {
  #chap {
    padding-bottom: 100px !important; 
  }
  .nav {
    position: fixed;
    top: 0; right: 0;
    height: 100vh;
    width: min(80vw, 300px);
    background: var(--bg);
    transform: translateX(100%);
    transition: transform var(--speed);
    display: flex;
    flex-direction: column;
    padding: 1rem;
    gap: 1rem;
  }
  .nav.open {
    transform: translateX(0);
  }

  .hamburger { display: grid; }
  .backdrop { display: block; }
  .welcome {
    margin-top: 40%;
    transform: scale(1.6);
  }
  @keyframes zoomReveal {
    to { transform: scale(1.2); }
  }
  .welcome h1 {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
  }
  .scroll-hint {
    bottom: 8px;
  }
  .section {
    padding: 50px 5vw;
  }
  .section h2 {
    font-size: 1.4rem;
  }
  .bookshelf {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
  }
  .book-inner {
    width: 140px;
    height: 210px;
  }
  footer {
    font-size: 12px;
    padding: 15px 5px;
  }
}

@media (max-width: 480px) {
  .nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }
  .welcome {
    margin-top: 50%;
    transform: scale(1.3);
  }
  .bookshelf {
    grid-template-columns: 1fr 1fr;
  }
  .book-inner {
    width: 120px;
    height: 180px;
  }
}

#chap {
  display: flex; 
  flex-direction: row; 
  flex-wrap: nowrap; 
  overflow-x: auto; 
  max-height: 300px;
  overflow-y: hidden;
  transform: rotate(360deg);
  transform-origin: right top;
  padding-bottom: 400px; 
  gap: 15px;
}

#chap::-webkit-scrollbar {
  height: 12px;
}

#chap::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
}

#chap::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, var(--accent), var(--hover));
  border-radius: 10px;
  box-shadow: 0 0 8px rgba(0,255,209,.6);
}

#chap::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, var(--hover), var(--accent));
}
