/* ============================================================
   ebooks dark — «Книжная полка» (заставка главной)
   Тёмная тема, адаптив. Токены общие с tmpl-books-dark.
   ============================================================ */

:root{
  --eb-ink-0:#0a0c12;
  --eb-ink-1:#10131c;
  --eb-ink-2:#171b28;
  --eb-ink-3:#1f2434;
  --eb-gold:#d4a24e;
  --eb-gold-2:#f0cd8a;
  --eb-gold-dim:#8a6c33;
  --eb-candle:#ffcf8a;
  --eb-paper:#efe3c8;
  --eb-paper-2:#e2d0a8;
  --eb-text-on-dark:#e8e2d2;
  --eb-text-dim:#a79f8a;
  --eb-leather:#4a2c20;
  --eb-leather-2:#33201a;
  --eb-font-display:"Playfair Display","PT Serif",Georgia,"Times New Roman",serif;
  --eb-font-body:"PT Serif",Georgia,"Times New Roman",serif;
  --eb-shadow-1:0 10px 30px rgba(0,0,0,.55);
  --eb-shadow-2:0 24px 70px rgba(0,0,0,.6);
}

*,*::before,*::after{box-sizing:border-box}

html{-webkit-text-size-adjust:100%}

body.eb{
  margin:0;
  min-height:100dvh;
  background:var(--eb-ink-0);
  color:var(--eb-text-on-dark);
  font-family:var(--eb-font-body);
  font-size:17px;
  line-height:1.6;
  overflow-x:hidden;
}

/* ---------- сцена: ночная библиотека ---------- */

.eb-scene{
  position:relative;
  min-height:100dvh;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:
    radial-gradient(90% 60% at 50% 108%, rgba(64,42,20,.55), transparent 60%),
    radial-gradient(70% 45% at 50% -8%, rgba(48,56,92,.30), transparent 65%),
    linear-gradient(180deg,#0b0d14 0%,#10131c 55%,#0a0c12 100%);
}

/* свеча — тёплое дыхание света */
.eb-scene::before{
  content:"";
  position:absolute;inset:0;
  pointer-events:none;
  background:radial-gradient(46% 34% at 50% 46%, rgba(255,190,110,.16), rgba(255,170,80,.05) 45%, transparent 72%);
  animation:eb-candle 5.5s ease-in-out infinite;
}
/* виньетка */
.eb-scene::after{
  content:"";
  position:absolute;inset:0;
  pointer-events:none;
  background:radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(0,0,0,.55) 100%);
}

@keyframes eb-candle{
  0%,100%{opacity:1;transform:scale(1)}
  38%{opacity:.82;transform:scale(.985) translateY(2px)}
  62%{opacity:.92;transform:scale(1.01)}
}

@media (prefers-reduced-motion: reduce){
  .eb-scene::before{animation:none}
}

/* ---------- верхняя панель ---------- */

.eb-topbar{
  position:relative;z-index:5;
  display:flex;align-items:center;justify-content:flex-end;
  gap:4px;
  padding:14px clamp(14px,3vw,34px) 0;
}

.eb-icons{display:flex;gap:6px}
.eb-icons a{
  display:inline-flex;align-items:center;justify-content:center;
  width:40px;height:40px;border-radius:10px;
  color:var(--eb-text-dim);
  border:1px solid transparent;
  transition:color .25s,border-color .25s,background .25s,transform .25s;
}
.eb-icons a:hover{
  color:var(--eb-gold-2);
  border-color:rgba(212,162,78,.35);
  background:rgba(212,162,78,.08);
  transform:translateY(-1px);
}
.eb-icons svg{width:20px;height:20px;display:block}

/* ---------- герой ---------- */

.eb-hero{
  position:relative;z-index:4;
  flex:1;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  text-align:center;
  padding:clamp(20px,4vh,48px) clamp(14px,4vw,40px) 32px;
  gap:clamp(14px,2.4vh,26px);
}

.eb-eyebrow{
  margin:0;
  font-family:var(--eb-font-body);
  font-size:clamp(12px,1.4vw,15px);
  letter-spacing:.42em;
  text-transform:uppercase;
  color:var(--eb-gold);
  text-indent:.42em; /* компенсация letter-spacing */
}

.eb-title{
  margin:0;
  max-width:20ch;
  font-family:var(--eb-font-display);
  font-weight:800;
  font-size:clamp(30px,5.4vw,64px);
  line-height:1.08;
  letter-spacing:.01em;
  color:transparent;
  background:linear-gradient(175deg,#f6e3b4 0%,#e9c77e 35%,#caa04f 62%,#f0d69b 100%);
  -webkit-background-clip:text;background-clip:text;
  filter:drop-shadow(0 2px 10px rgba(0,0,0,.6)) drop-shadow(0 0 26px rgba(212,162,78,.18));
}

/* ---------- 3D книга ---------- */

.eb-book3d{
  display:inline-block;
  perspective:1400px;
  margin:clamp(6px,2vh,18px) 0;
  text-decoration:none;
}

.eb-book3d__inner{
  position:relative;
  display:block;
  width:clamp(210px,26vw,330px);
  aspect-ratio:3/4.1;
  transform-style:preserve-3d;
  transform:rotateY(-18deg) rotateX(4deg);
  transition:transform .7s cubic-bezier(.2,.7,.25,1);
}
.eb-book3d:hover .eb-book3d__inner{transform:rotateY(-30deg) rotateX(4deg) translateY(-4px)}
@media (prefers-reduced-motion: reduce){.eb-book3d__inner{transition:none}}

/* блок страниц (срез) */
.eb-book3d__pages{
  position:absolute;top:1.2%;bottom:1.2%;right:-4.5%;
  width:5%;
  transform:translateZ(-2px) rotateY(0deg);
  transform-origin:left center;
  background:
    repeating-linear-gradient(90deg,#e8dcc0 0 2px,#cfc0a0 2px 3px);
  border-radius:0 3px 3px 0;
  box-shadow:inset -2px 0 4px rgba(0,0,0,.35);
}
/* корешок */
.eb-book3d__spine{
  position:absolute;top:0;bottom:0;left:-7%;
  width:8%;
  transform:rotateY(-72deg);
  transform-origin:right center;
  background:linear-gradient(90deg,#241712,#3d2418 55%,#2c1a12);
  border-radius:4px 0 0 4px;
}

/* обложка */
.eb-book3d__cover{
  position:absolute;inset:0;
  display:flex;flex-direction:column;align-items:center;justify-content:center;
  padding:12% 10%;
  text-decoration:none;
  border-radius:5px 12px 12px 5px;
  background:
    radial-gradient(130% 100% at 18% 8%, rgba(255,220,160,.14), transparent 42%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='l'><feTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' seed='7'/><feColorMatrix values='0 0 0 0 0.16 0 0 0 0 0.09 0 0 0 0 0.05 0 0 0 0.5 0'/></filter><rect width='140' height='140' filter='url(%23l)'/></svg>"),
    linear-gradient(155deg,#5a3524 0%,var(--eb-leather) 40%,var(--eb-leather-2) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(240,205,138,.18),
    inset 0 0 60px rgba(0,0,0,.45),
    18px 30px 60px rgba(0,0,0,.65),
    4px 8px 18px rgba(0,0,0,.5);
  transform:translateZ(1px);
  transition:box-shadow .5s;
}
.eb-book3d:hover .eb-book3d__cover{
  box-shadow:
    inset 0 0 0 1px rgba(240,205,138,.26),
    inset 0 0 60px rgba(0,0,0,.4),
    26px 40px 80px rgba(0,0,0,.7),
    6px 10px 22px rgba(0,0,0,.55),
    0 0 50px rgba(212,162,78,.14);
}

/* золотая рамка обложки */
.eb-book3d__frame{
  position:absolute;inset:7.5%;
  border:1.5px solid rgba(240,205,138,.55);
  border-radius:3px;
  pointer-events:none;
}
.eb-book3d__frame::before{
  content:"";position:absolute;inset:5px;
  border:1px solid rgba(240,205,138,.3);
  border-radius:2px;
}

.eb-book3d__emblem{
  font-size:clamp(22px,3vw,34px);
  color:var(--eb-gold-2);
  text-shadow:0 0 18px rgba(240,205,138,.5);
  margin-bottom:8%;
}
.eb-book3d__name{
  font-family:var(--eb-font-display);
  font-weight:700;
  font-size:clamp(19px,2.6vw,30px);
  line-height:1.18;
  color:transparent;
  background:linear-gradient(180deg,#f4e0af,#d9b264 55%,#b78c3e);
  -webkit-background-clip:text;background-clip:text;
  text-shadow:0 1px 0 rgba(0,0,0,.35);
}
.eb-book3d__sub{
  margin-top:9%;
  font-size:clamp(10px,1.1vw,13px);
  letter-spacing:.28em;text-indent:.28em;
  text-transform:uppercase;
  color:#cdbb93;
}

/* ---------- полка с главами ---------- */

.eb-shelf{
  width:min(94vw,880px);
}

.eb-shelf ul{
  list-style:none;margin:0;padding:0 clamp(6px,1vw,16px) 22px;
  display:flex;align-items:flex-end;justify-content:center;gap:clamp(5px,.9vw,12px);
  border-bottom:10px solid;
  border-image:linear-gradient(180deg,#4a3420,#2a1c10 60%,#1c120a) 1;
  box-shadow:0 14px 22px -8px rgba(0,0,0,.7);
}

.eb-shelf li a{
  position:relative;
  display:flex;align-items:center;justify-content:center;
  width:clamp(38px,4.6vw,56px);
  height:clamp(120px,15vh,168px);
  padding:10px 4px;
  text-decoration:none;
  writing-mode:vertical-rl;
  font-family:var(--eb-font-display);
  font-size:clamp(12px,1.25vw,15px);
  font-weight:600;
  letter-spacing:.06em;
  color:#e9ddc2;
  border-radius:3px 3px 0 0;
  box-shadow:inset 0 0 0 1px rgba(255,255,255,.06), inset -6px 0 10px rgba(0,0,0,.35), 6px 0 10px -6px rgba(0,0,0,.6);
  transform:translateY(0);
  transition:transform .35s cubic-bezier(.2,.7,.3,1.3), box-shadow .35s;
}
.eb-shelf li a::before,
.eb-shelf li a::after{
  content:"";position:absolute;left:10%;right:10%;height:2px;
  background:linear-gradient(90deg,transparent,rgba(240,205,138,.65),transparent);
}
.eb-shelf li a::before{top:8%}
.eb-shelf li a::after{bottom:8%}

.eb-shelf li a:hover{transform:translateY(-14px);box-shadow:inset 0 0 0 1px rgba(240,205,138,.3), inset -6px 0 10px rgba(0,0,0,.3), 0 14px 24px -8px rgba(0,0,0,.7)}
.eb-shelf li.selected a{color:var(--eb-gold-2);transform:translateY(-8px)}

/* палитра корешков */
.eb-shelf li:nth-child(9n+1) a{background:linear-gradient(90deg,#5d2e2c,#7a3b34 45%,#4c2523)}
.eb-shelf li:nth-child(9n+2) a{background:linear-gradient(90deg,#2c4a4e,#3b656a 45%,#223a3d)}
.eb-shelf li:nth-child(9n+3) a{background:linear-gradient(90deg,#54502c,#6e6840 45%,#403d22)}
.eb-shelf li:nth-child(9n+4) a{background:linear-gradient(90deg,#3c2c54,#50396e 45%,#2e2240)}
.eb-shelf li:nth-child(9n+5) a{background:linear-gradient(90deg,#2c3c5e,#3a4f78 45%,#233048)}
.eb-shelf li:nth-child(9n+6) a{background:linear-gradient(90deg,#5e462c,#7a5c3a 45%,#4a3620)}
.eb-shelf li:nth-child(9n+7) a{background:linear-gradient(90deg,#43302c,#5c4038 45%,#342420)}
.eb-shelf li:nth-child(9n+8) a{background:linear-gradient(90deg,#2c5040,#3b6b55 45%,#223e31)}
.eb-shelf li:nth-child(9n+9) a{background:linear-gradient(90deg,#584428,#74603a 45%,#443420)}

/* ---------- CTA ---------- */

.eb-cta{
  display:inline-flex;align-items:center;gap:12px;
  padding:14px 34px;
  font-family:var(--eb-font-display);
  font-size:clamp(16px,1.8vw,20px);
  font-weight:700;letter-spacing:.06em;
  color:#1c1410;
  text-decoration:none;
  background:linear-gradient(180deg,#f0d194,#d4a24e 60%,#b98a3e);
  border-radius:999px;
  box-shadow:0 10px 30px rgba(212,162,78,.28), inset 0 1px 0 rgba(255,255,255,.5);
  transition:transform .3s,box-shadow .3s;
}
.eb-cta:hover{transform:translateY(-2px);box-shadow:0 16px 40px rgba(212,162,78,.4), inset 0 1px 0 rgba(255,255,255,.6)}
.eb-cta svg{width:20px;height:20px}

/* ---------- подвал ---------- */

.eb-copy{
  position:relative;z-index:4;
  padding:14px 16px 20px;
  text-align:center;
  font-size:13px;
  color:var(--eb-text-dim);
}
.eb-copy a{color:var(--eb-gold);text-decoration:none}
.eb-copy a:hover{color:var(--eb-gold-2);text-decoration:underline}

/* ---------- вход/появление ---------- */

.eb-hero > *{animation:eb-rise .9s cubic-bezier(.2,.7,.3,1) both}
.eb-hero > *:nth-child(1){animation-delay:.05s}
.eb-hero > *:nth-child(2){animation-delay:.15s}
.eb-hero > *:nth-child(3){animation-delay:.3s}
.eb-hero > *:nth-child(4){animation-delay:.5s}
.eb-hero > *:nth-child(5){animation-delay:.62s}
@keyframes eb-rise{from{opacity:0;transform:translateY(18px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion: reduce){.eb-hero > *{animation:none}}

/* ---------- адаптив ---------- */

@media (max-width:820px){
  .eb-shelf ul{
    flex-wrap:wrap;align-items:stretch;justify-content:center;
    padding:0 4px 14px;gap:8px;
  }
  .eb-shelf li a{
    writing-mode:horizontal-tb;
    width:auto;height:auto;
    padding:12px 16px;
    border-radius:8px 8px 0 0;
    font-size:14px;
  }
  .eb-shelf li a::before{top:5px}
  .eb-shelf li a::after{bottom:5px}
  .eb-shelf li a:hover{transform:translateY(-4px)}
}

@media (max-width:480px){
  .eb-title{font-size:clamp(26px,8.4vw,40px)}
  .eb-book3d__inner{width:min(62vw,240px)}
}

/* ---------- доступность ---------- */

.eb-skip{
  position:fixed;top:-70px;left:16px;z-index:400;
  padding:10px 18px;border-radius:8px;
  background:#d4a24e;color:#171207;font-weight:700;font-size:14px;
  text-decoration:none;box-shadow:0 8px 24px rgba(0,0,0,.4);
  transition:top .2s ease;
}
.eb-skip:focus{top:12px}

a:focus-visible,button:focus-visible,input:focus-visible,
textarea:focus-visible,select:focus-visible,[tabindex="-1"]:focus{
  outline:2px solid #d4a24e;outline-offset:2px;border-radius:4px;
}
