/* ============================================================
   KURASA — design system  ·  "Midnight Library"
   Dark-first, cinematic. Light mode is a genuine paper theme, not an
   inversion — readers switch to it and stay in it, so it gets the same
   care. Every colour, radius and shadow is a token: the admin Theming
   panel writes over four of them and the whole site follows.
   ============================================================ */

:root{
  color-scheme: dark;

  /* surfaces */
  --bg:        #0A0D0B;
  --bg-2:      #0F1411;
  --surface:   #151B17;
  --surface-2: #1C231E;
  --surface-3: #242C27;
  --line:      #2A332D;
  --line-2:    #384239;
  --scrim:     rgba(6,9,7,.72);

  /* type */
  --text:      #EDF1EA;
  --text-dim:  #9FAAA1;
  --text-mute: #6C7A71;

  /* brand */
  --brand:      #2FA97C;
  --brand-deep: #1E7A58;
  --brand-tint: rgba(47,169,124,.14);
  --gold:       #E3B65C;
  --gold-deep:  #C9962E;
  --gold-tint:  rgba(227,182,92,.14);
  --danger:     #E2685B;

  /* form */
  --radius:    16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow:    0 10px 30px rgba(0,0,0,.35);
  --shadow-lg: 0 30px 70px rgba(0,0,0,.55);
  --ring:      0 0 0 3px rgba(47,169,124,.35);

  --font-display: "Fraunces", Georgia, serif;
  --font-body:    "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-mono:    "Spline Sans Mono", ui-monospace, monospace;

  --max: 1320px;
  --gut: clamp(18px, 4vw, 44px);
  --header-h: 72px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --pop:  cubic-bezier(.2,.9,.3,1.3);
}

[data-theme="light"]{
  color-scheme: light;
  --bg:        #F8F6F1;
  --bg-2:      #F1EEE6;
  --surface:   #FFFFFF;
  --surface-2: #F5F2EA;
  --surface-3: #EBE7DB;
  --line:      #E2DDD0;
  --line-2:    #D2CBBA;
  --scrim:     rgba(248,246,241,.75);
  --text:      #171E1A;
  --text-dim:  #545F57;
  --text-mute: #7A857D;
  --brand:      #1E7A58;
  --brand-deep: #145741;
  --brand-tint: rgba(30,122,88,.10);
  --gold:       #B98620;
  --gold-deep:  #96690F;
  --gold-tint:  rgba(185,134,32,.12);
  --shadow:    0 10px 30px rgba(23,30,26,.10);
  --shadow-lg: 0 30px 70px rgba(23,30,26,.18);
}

/* ---------- reset ---------- */
*{margin:0;padding:0;box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  font-family:var(--font-body);
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
  transition:background .3s var(--ease), color .3s var(--ease);
}
img,svg{display:block;max-width:100%}
a{color:inherit;text-decoration:none}
button{font-family:inherit;color:inherit;cursor:pointer;background:none;border:none}
input,select,textarea{font-family:inherit;font-size:1rem;color:inherit}
::selection{background:var(--gold);color:#0A0D0B}
:focus-visible{outline:2px solid var(--brand);outline-offset:3px;border-radius:6px}

/* ---------- type scale ---------- */
h1,h2,h3,h4,.display{font-family:var(--font-display);font-weight:600;line-height:1.08;letter-spacing:-.02em;text-wrap:balance}
h1{font-size:clamp(2.4rem,5.2vw,4.4rem)}
h2{font-size:clamp(1.75rem,3.2vw,2.6rem)}
h3{font-size:1.25rem}
.lede{font-size:clamp(1.02rem,1.4vw,1.2rem);color:var(--text-dim);max-width:52ch}
.muted{color:var(--text-dim)}
.dim{color:var(--text-mute)}
.mono,.kicker{font-family:var(--font-mono);font-size:.7rem;letter-spacing:.16em;text-transform:uppercase}
.kicker{color:var(--gold);display:inline-flex;align-items:center;gap:.6rem;margin-bottom:.9rem;font-weight:500}
.kicker::before{content:"";width:22px;height:1px;background:currentColor;opacity:.6}
.wrap{max-width:var(--max);margin:0 auto;padding-inline:var(--gut)}
.narrow{max-width:820px}
.stack>*+*{margin-top:1rem}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:.55rem;
  padding:.78rem 1.5rem;border-radius:999px;border:1.5px solid transparent;
  font-weight:600;font-size:.94rem;white-space:nowrap;
  transition:transform .18s var(--pop), background .18s, color .18s, border-color .18s, box-shadow .18s;
}
.btn:active{transform:scale(.96)}
.btn-primary{background:var(--gold);color:#14100A;border-color:var(--gold)}
.btn-primary:hover{background:#F0C876;box-shadow:0 10px 30px rgba(227,182,92,.3);transform:translateY(-1px)}
.btn-brand{background:var(--brand);color:#04140D;border-color:var(--brand)}
.btn-brand:hover{background:#3CBF8D;box-shadow:0 10px 30px rgba(47,169,124,.3);transform:translateY(-1px)}
.btn-line{border-color:var(--line-2);color:var(--text);background:transparent}
.btn-line:hover{border-color:var(--text);background:var(--surface-2)}
.btn-glass{background:rgba(255,255,255,.09);border-color:rgba(255,255,255,.16);color:#fff;backdrop-filter:blur(10px)}
.btn-glass:hover{background:rgba(255,255,255,.18)}
[data-theme="light"] .btn-glass{background:rgba(0,0,0,.06);border-color:rgba(0,0,0,.1);color:var(--text)}
[data-theme="light"] .btn-glass:hover{background:rgba(0,0,0,.12)}
.btn-ghost{color:var(--text-dim)}
.btn-ghost:hover{color:var(--text);background:var(--surface-2)}
.btn-danger{border-color:var(--danger);color:var(--danger)}
.btn-danger:hover{background:var(--danger);color:#fff}
.btn-sm{padding:.48rem 1rem;font-size:.84rem}
.btn-lg{padding:1.02rem 2.1rem;font-size:1.05rem}
.btn-block{width:100%}
.btn[disabled]{opacity:.45;pointer-events:none}
.btn .ic{font-size:1.05em;line-height:1}

/* round icon button */
.ibtn{
  width:40px;height:40px;border-radius:50%;display:grid;place-items:center;
  border:1.5px solid var(--line);background:var(--surface);color:var(--text);
  transition:.18s var(--pop);flex:none;
}
.ibtn:hover{border-color:var(--text);transform:translateY(-2px)}
.ibtn.on{background:var(--gold);border-color:var(--gold);color:#14100A}
.ibtn-sm{width:34px;height:34px;font-size:.85rem}

/* ============================================================
   HEADER + NAV
   ============================================================ */
.site-header{
  position:sticky;top:0;z-index:80;
  background:linear-gradient(var(--bg), color-mix(in srgb, var(--bg) 70%, transparent));
  transition:background .3s, border-color .3s, backdrop-filter .3s;
  border-bottom:1px solid transparent;
}
.site-header.stuck{
  background:color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter:blur(16px) saturate(1.3);
  border-bottom-color:var(--line);
}
.nav{display:flex;align-items:center;gap:1.5rem;height:var(--header-h);max-width:var(--max);margin:0 auto;padding-inline:var(--gut)}
.logo{font-family:var(--font-display);font-size:1.42rem;font-weight:600;letter-spacing:-.02em;display:flex;align-items:center;gap:.55rem;flex:none}
.logo .mark{
  width:28px;height:28px;border-radius:8px;flex:none;position:relative;
  background:linear-gradient(145deg,var(--brand),var(--brand-deep));
  box-shadow:0 4px 14px rgba(47,169,124,.35);
}
.logo .mark::after{
  content:"";position:absolute;inset:6px 6px 6px 12px;
  border-left:2px solid var(--gold);border-top:2px solid var(--gold);border-bottom:2px solid var(--gold);
  border-radius:2px 0 0 2px;
}
.nav-links{display:flex;align-items:center;gap:.3rem}
.nav-links > a,.nav-trigger{
  display:flex;align-items:center;gap:.35rem;padding:.5rem .8rem;border-radius:999px;
  font-size:.93rem;font-weight:500;color:var(--text-dim);transition:.18s;
}
.nav-links > a:hover,.nav-trigger:hover{color:var(--text);background:var(--surface-2)}
.nav-links > a.active{color:var(--text);background:var(--surface-2)}
.nav-links > a.active::after{content:"";width:4px;height:4px;border-radius:50%;background:var(--gold)}
.nav-right{margin-left:auto;display:flex;align-items:center;gap:.6rem}

/* search trigger */
.search-trigger{
  display:flex;align-items:center;gap:.6rem;padding:.5rem .8rem .5rem 1rem;
  border:1.5px solid var(--line);border-radius:999px;background:var(--surface);
  color:var(--text-mute);font-size:.88rem;min-width:200px;transition:.18s;
}
.search-trigger:hover{border-color:var(--line-2);color:var(--text-dim)}
.search-trigger kbd{
  margin-left:auto;font-family:var(--font-mono);font-size:.66rem;padding:.16rem .38rem;
  border:1px solid var(--line-2);border-radius:5px;color:var(--text-mute);
}

/* mega menu */
.has-mega{position:relative}
.mega{
  position:absolute;top:calc(100% + 14px);left:50%;translate:-50% 0;
  width:min(880px,92vw);padding:1.6rem;z-index:90;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  box-shadow:var(--shadow-lg);
  display:grid;grid-template-columns:repeat(3,1fr) 1.1fr;gap:1.6rem;
  opacity:0;visibility:hidden;transform:translateY(-8px);transition:.22s var(--ease);
}
.has-mega:hover .mega,.has-mega:focus-within .mega{opacity:1;visibility:visible;transform:none}
.mega h4{font-family:var(--font-mono);font-size:.66rem;letter-spacing:.16em;text-transform:uppercase;color:var(--gold);margin-bottom:.8rem;font-weight:500}
.mega a.mega-link{display:block;padding:.4rem .5rem;margin-left:-.5rem;border-radius:8px;font-size:.92rem;color:var(--text-dim);transition:.15s}
.mega a.mega-link:hover{background:var(--surface-2);color:var(--text)}
.mega-feature{background:var(--surface-2);border-radius:var(--radius-sm);padding:1.1rem;display:flex;flex-direction:column;gap:.7rem}
.mega-feature .cover{width:74px}
.mega-feature b{font-size:.95rem;line-height:1.25;display:block}

/* avatar menu */
.avatar{
  width:38px;height:38px;border-radius:50%;flex:none;display:grid;place-items:center;
  background:linear-gradient(145deg,var(--brand),var(--brand-deep));color:#04140D;
  font-weight:700;font-size:.85rem;border:1.5px solid transparent;transition:.18s;
}
.avatar:hover{border-color:var(--gold)}
.menu-wrap{position:relative}
.menu{
  position:absolute;right:0;top:calc(100% + 10px);min-width:230px;z-index:90;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);
  box-shadow:var(--shadow-lg);padding:.5rem;
  opacity:0;visibility:hidden;transform:translateY(-6px);transition:.18s var(--ease);
}
.menu.open{opacity:1;visibility:visible;transform:none}
.menu a,.menu button{display:flex;align-items:center;gap:.7rem;width:100%;padding:.6rem .7rem;border-radius:8px;font-size:.9rem;color:var(--text-dim);text-align:left}
.menu a:hover,.menu button:hover{background:var(--surface-2);color:var(--text)}
.menu hr{border:none;border-top:1px solid var(--line);margin:.4rem 0}
.menu-head{padding:.7rem;border-bottom:1px solid var(--line);margin-bottom:.4rem}
.menu-head b{display:block;font-size:.92rem}
.menu-head span{font-size:.78rem;color:var(--text-mute)}

.pill{
  font-family:var(--font-mono);font-size:.64rem;letter-spacing:.08em;text-transform:uppercase;
  padding:.3rem .65rem;border-radius:999px;border:1px solid var(--gold);color:var(--gold);background:var(--gold-tint);
}
.pill.streak{border-color:var(--line-2);color:var(--text-dim);background:var(--surface-2);text-transform:none;letter-spacing:.04em;font-size:.7rem}
.pill.streak b{color:var(--gold)}

/* mobile nav */
.burger{display:none;width:40px;height:40px;border-radius:10px;place-items:center}
.burger span{display:block;width:19px;height:1.8px;background:var(--text);margin:4px 0;transition:.25s var(--ease);border-radius:2px}
/* the bars sit 9.8px apart (1.8px tall + 4px margins), so they have to travel
   the full gap to actually cross — 6px left it looking like a chevron */
.burger.on span:nth-child(1){transform:translateY(9.8px) rotate(45deg)}
.burger.on span:nth-child(2){opacity:0}
.burger.on span:nth-child(3){transform:translateY(-9.8px) rotate(-45deg)}
/* The menu is taller than a phone screen (5 links + 10 shelves + account).
   It lives inside the sticky header, so without its own scroll container the
   header grows taller than the viewport and you have to scroll the *page* to
   reach the bottom of the menu. It scrolls itself; the page behind it doesn't. */
.mobile-menu{
  display:none;flex-direction:column;gap:.15rem;padding:.6rem var(--gut) 1.4rem;
  background:var(--bg);border-bottom:1px solid var(--line);
  max-height:calc(100dvh - var(--header-h));
  overflow-y:auto;
  overscroll-behavior:contain;
  -webkit-overflow-scrolling:touch;
}
.mobile-menu.open{display:flex}
body.menu-open{overflow:hidden}
.mobile-menu a{padding:.75rem .6rem;border-radius:10px;font-weight:500;color:var(--text-dim)}
.mobile-menu a:hover{background:var(--surface-2);color:var(--text)}
.mobile-menu .mm-head{font-family:var(--font-mono);font-size:.64rem;letter-spacing:.16em;text-transform:uppercase;color:var(--text-mute);padding:.9rem .6rem .3rem}

/* ============================================================
   COVERS  (art + typeset plate)
   ============================================================ */
.cover{
  position:relative;aspect-ratio:2/3;width:100%;
  border-radius:4px 9px 9px 4px;overflow:hidden;isolation:isolate;
  background:var(--surface-2);
  /* The cover is its own container, so its typography scales to the cover —
     not to whatever ancestor happens to be a container. Without this, a cover
     outside a .book-card (continue-reading, collections, the billboard) sized
     its title against the viewport and blew out of its own artwork. */
  container-type:inline-size;
  box-shadow:
    0 1px 2px rgba(0,0,0,.4),
    0 12px 28px -8px rgba(0,0,0,.55),
    inset -1px 0 0 rgba(255,255,255,.10);
  transition:transform .3s var(--pop), box-shadow .3s var(--ease);
}
.cover .art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.cover-plate{
  position:absolute;inset:0;z-index:2;display:flex;flex-direction:column;justify-content:space-between;
  padding:10% 9% 8% 13%;color:#fff;text-shadow:0 1px 12px rgba(0,0,0,.45);
}
/* All three scale off the cover's own width (cqw), so one cover component
   typesets correctly at 64px in a collection stack and 280px on the detail page. */
.cover-kicker{
  font-family:var(--font-mono);font-size:clamp(.34rem,3.4cqw,.62rem);letter-spacing:.16em;
  text-transform:uppercase;opacity:.82;line-height:1.3;
}
.cover-title{
  display:block;font-family:var(--font-display);font-weight:600;
  font-size:clamp(.52rem,8.6cqw,1.35rem);line-height:1.14;letter-spacing:-.01em;text-wrap:balance;
}
.cover-rule{display:block;width:22%;height:2px;background:var(--gold);margin:4cqw 0 3cqw;border-radius:2px}
.cover-author{display:block;font-size:clamp(.4rem,4.6cqw,.78rem);font-weight:500;opacity:.86;line-height:1.3}
.cover-spine{
  position:absolute;left:0;top:0;bottom:0;width:9%;z-index:3;
  background:linear-gradient(90deg,rgba(0,0,0,.42),rgba(0,0,0,.12) 60%,rgba(255,255,255,.06));
}
.cover-gloss{
  position:absolute;inset:0;z-index:4;pointer-events:none;
  background:linear-gradient(105deg,transparent 30%,rgba(255,255,255,.14) 45%,transparent 58%);
  opacity:0;transition:opacity .4s var(--ease);
}
.book-card:hover .cover-gloss,a:hover > .cover .cover-gloss{opacity:1}

/* ============================================================
   BOOK CARD  (+ hover preview)
   ============================================================ */
.book-card{position:relative;container-type:inline-size;display:flex;flex-direction:column;gap:.65rem}
.book-card .card-art{position:relative;flex:1;min-width:0}
.book-card .b-info{min-width:0}
.book-card .cover-link{display:block;border-radius:4px 9px 9px 4px}
.book-card:hover .cover{transform:translateY(-8px) scale(1.02);box-shadow:0 4px 6px rgba(0,0,0,.4),0 28px 50px -12px rgba(0,0,0,.7)}
.b-title{font-weight:600;font-size:.93rem;line-height:1.3;display:block;transition:color .15s}
.book-card:hover .b-title{color:var(--gold)}
.b-author{font-size:.8rem;color:var(--text-dim)}
.b-meta{display:flex;align-items:center;gap:.5rem;font-size:.76rem;color:var(--text-mute);margin-top:.15rem}
.star{color:var(--gold)}
.b-prog{height:3px;border-radius:99px;background:var(--surface-3);overflow:hidden;margin-top:.4rem}
.b-prog b{display:block;height:100%;background:var(--gold);border-radius:99px}

/* corner ribbon + quick actions */
.card-flags{position:absolute;top:9px;left:9px;z-index:5;display:flex;flex-direction:column;gap:.3rem;align-items:flex-start}
.flag{
  font-family:var(--font-mono);font-size:.56rem;letter-spacing:.1em;text-transform:uppercase;
  padding:.22rem .48rem;border-radius:4px;backdrop-filter:blur(6px);font-weight:500;
}
.flag.pick{background:var(--gold);color:#14100A}
.flag.new{background:var(--brand);color:#04140D}
.flag.done{background:rgba(10,13,11,.72);color:var(--brand);border:1px solid var(--brand)}
.flag.hot{background:rgba(10,13,11,.6);color:#fff}
.flag.ke{background:rgba(0,0,0,.55);color:#fff}
.card-acts{
  position:absolute;top:8px;right:8px;z-index:5;display:flex;flex-direction:column;gap:.35rem;
  opacity:0;transform:translateX(6px);transition:.2s var(--ease);
}
.book-card:hover .card-acts,.card-acts:focus-within{opacity:1;transform:none}
.card-acts .ibtn{width:32px;height:32px;font-size:.8rem;background:rgba(10,13,11,.72);backdrop-filter:blur(8px);border-color:rgba(255,255,255,.2);color:#fff}
.card-acts .ibtn:hover{background:#fff;color:#0A0D0B;border-color:#fff}
.card-acts .ibtn.on{background:var(--gold);border-color:var(--gold);color:#14100A}

/* hover preview panel (desktop only) */
.card-peek{
  position:absolute;left:50%;top:0;translate:-50% 0;width:max(260px,118%);z-index:40;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-sm);
  box-shadow:var(--shadow-lg);overflow:hidden;
  opacity:0;visibility:hidden;transform:scale(.94);transform-origin:center top;
  transition:.22s var(--ease);pointer-events:none;
}
@media (hover:hover) and (min-width:960px){
  .book-card:hover .card-peek{opacity:1;visibility:visible;transform:scale(1);transition-delay:.45s;pointer-events:auto}
}
.card-peek .peek-art{position:relative;aspect-ratio:16/9;overflow:hidden}
.card-peek .peek-art .art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover}
.card-peek .peek-art::after{content:"";position:absolute;inset:0;background:linear-gradient(transparent 40%,var(--surface))}
.peek-body{padding:.9rem 1rem 1.1rem;margin-top:-1.6rem;position:relative}
.peek-body b{display:block;font-family:var(--font-display);font-size:1.05rem;line-height:1.2;margin-bottom:.25rem}
.peek-hook{font-size:.82rem;color:var(--text-dim);line-height:1.45;margin:.4rem 0 .7rem;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.peek-meta{display:flex;gap:.5rem;align-items:center;font-size:.74rem;color:var(--text-mute);margin-bottom:.8rem;flex-wrap:wrap}
.peek-acts{display:flex;gap:.45rem;align-items:center}
.peek-acts .btn{flex:1;padding:.5rem .8rem;font-size:.82rem}
.peek-acts .ibtn{flex:none}

/* ============================================================
   RAILS (horizontal shelves)
   ============================================================ */
.rail-head{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;margin-bottom:1.1rem}
.rail-head h2{font-size:clamp(1.25rem,2.1vw,1.7rem)}
.rail-head .sub{font-size:.86rem;color:var(--text-mute);margin-top:.2rem}
.rail-head .more{font-size:.85rem;color:var(--text-dim);display:flex;align-items:center;gap:.3rem;opacity:0;transition:.2s}
.rail-sec:hover .rail-head .more{opacity:1}
.rail-head .more:hover{color:var(--gold)}
.rail-sec{margin-bottom:3rem;position:relative}
.rail-vp{position:relative}
.rail{
  display:grid;grid-auto-flow:column;grid-auto-columns:clamp(132px,15vw,178px);gap:1.1rem;
  overflow-x:auto;scroll-snap-type:x proximity;scroll-behavior:smooth;
  padding:.5rem 0 1.4rem;margin-inline:calc(var(--gut) * -1);padding-inline:var(--gut);
  scrollbar-width:none;
}
.rail::-webkit-scrollbar{display:none}
.rail > *{scroll-snap-align:start}
.rail-nav{
  position:absolute;top:calc(50% - 2.2rem);translate:0 -50%;z-index:20;
  width:44px;height:44px;border-radius:50%;display:grid;place-items:center;
  background:color-mix(in srgb, var(--bg) 85%, transparent);backdrop-filter:blur(10px);
  border:1px solid var(--line-2);color:var(--text);font-size:1.1rem;
  opacity:0;transition:.2s var(--ease);
}
.rail-vp:hover .rail-nav{opacity:1}
.rail-nav:hover{background:var(--text);color:var(--bg);border-color:var(--text)}
.rail-nav[hidden]{display:none}
.rail-nav.prev{left:calc(var(--gut) * -1 + 4px)}
.rail-nav.next{right:calc(var(--gut) * -1 + 4px)}
@media (max-width:960px){.rail-nav{display:none}}

/* Numbered "top 10" rail.
   The cover already prints its own title and author, so the ranked card
   drops the text block entirely: a huge outlined numeral and the artwork,
   nothing else. Details come from the hover peek. */
.rail.ranked{grid-auto-columns:clamp(200px,21vw,246px)}
.ranked .book-card{flex-direction:row;align-items:center;gap:0}
.ranked .rank-no{
  font-family:var(--font-display);font-weight:700;
  font-size:clamp(4.6rem,7.4vw,7rem);line-height:.72;
  color:transparent;-webkit-text-stroke:2px var(--line-2);
  flex:none;margin-right:-.5rem;user-select:none;
  transition:.25s var(--ease);
}
.ranked .book-card:hover .rank-no{-webkit-text-stroke-color:var(--gold);transform:translateX(-2px)}
.ranked .card-art{width:60%;flex:none}
.ranked .b-info{display:none}
.ranked .card-peek{width:min(280px,132%)}

/* ============================================================
   BILLBOARD / HERO BANNERS
   ============================================================ */
.billboard{position:relative;min-height:min(78vh,660px);display:flex;align-items:flex-end;overflow:hidden;isolation:isolate}
.billboard .bb-art{position:absolute;inset:0;z-index:-2}
.billboard .bb-art .art{width:100%;height:100%;object-fit:cover}
.billboard::before{
  content:"";position:absolute;inset:0;z-index:-1;
  background:
    linear-gradient(90deg, var(--bg) 4%, color-mix(in srgb,var(--bg) 72%,transparent) 40%, transparent 72%),
    /* right-edge vignette: the cover shares the book's palette, so without
       this it dissolves straight back into its own banner */
    linear-gradient(270deg, color-mix(in srgb,var(--bg) 62%,transparent), transparent 26%),
    linear-gradient(0deg, var(--bg) 2%, transparent 55%);
}
.bb-grid{display:flex;align-items:flex-end;justify-content:space-between;gap:3rem;width:100%}
.bb-inner{padding-block:clamp(3rem,7vw,5.5rem);max-width:640px;flex:1;min-width:0}

/* The cover is the key art. A book billboard without one is just a gradient. */
.bb-cover{
  position:relative;flex:none;width:clamp(170px,17vw,230px);margin-bottom:clamp(3rem,7vw,5.5rem);
  transform:rotate(-2.5deg);transition:transform .5s var(--pop);
  filter:drop-shadow(0 30px 60px rgba(0,0,0,.6));
}
.bb-cover:hover{transform:rotate(0deg) translateY(-6px) scale(1.03)}
.bb-cover .cover{
  box-shadow:
    0 0 0 1px rgba(255,255,255,.12),          /* rim light — lifts it off its own banner */
    0 3px 6px rgba(0,0,0,.5),
    0 40px 80px -18px rgba(0,0,0,.85),
    inset -1px 0 0 rgba(255,255,255,.16);
}
.bb-cover::before{
  content:"";position:absolute;inset:-16% -12%;z-index:-1;border-radius:50%;
  background:radial-gradient(closest-side,var(--gold-tint),transparent 72%);
}
@keyframes coverIn{from{opacity:0;transform:rotate(-2.5deg) translateY(18px)}to{opacity:1}}
.bb-inner h1{font-size:clamp(2.1rem,4.4vw,3.6rem);margin:.5rem 0 .8rem}
.bb-hook{font-size:clamp(1rem,1.3vw,1.14rem);color:var(--text-dim);margin-bottom:1.4rem;max-width:46ch}
.bb-meta{display:flex;align-items:center;gap:.8rem;flex-wrap:wrap;font-size:.86rem;color:var(--text-dim);margin-bottom:1.5rem}
.bb-meta .dot-sep{width:3px;height:3px;border-radius:50%;background:var(--text-mute)}
.bb-acts{display:flex;gap:.7rem;flex-wrap:wrap;align-items:center}
.bb-dots{position:absolute;right:var(--gut);bottom:2rem;display:flex;gap:.45rem;z-index:5}
.bb-dots button{width:28px;height:3px;border-radius:99px;background:var(--line-2);transition:.2s}
.bb-dots button.on{background:var(--gold);width:44px}

/* ============================================================
   BOOK DETAIL PAGE
   ============================================================ */
.detail-hero{position:relative;padding-top:clamp(2rem,5vw,4rem);padding-bottom:clamp(2rem,4vw,3rem);isolation:isolate;overflow:hidden}
.detail-hero .hero-art{position:absolute;inset:0 0 auto;height:min(72vh,640px);z-index:-2}
.detail-hero .hero-art .art{width:100%;height:100%;object-fit:cover;filter:saturate(1.05)}
.detail-hero::before{
  content:"";position:absolute;inset:0;z-index:-1;
  background:
    linear-gradient(90deg,var(--bg) 6%, color-mix(in srgb,var(--bg) 60%,transparent) 46%, color-mix(in srgb,var(--bg) 30%,transparent)),
    linear-gradient(0deg,var(--bg) 12%, color-mix(in srgb,var(--bg) 55%,transparent) 45%, transparent 90%);
}
.detail-grid{display:grid;grid-template-columns:280px 1fr;gap:clamp(2rem,4vw,3.4rem);align-items:start}
.detail-cover{position:relative}
.detail-cover .cover{box-shadow:0 8px 12px rgba(0,0,0,.3),0 40px 80px -20px rgba(0,0,0,.8)}
.detail-cover .cover-badge{
  position:absolute;bottom:-14px;left:50%;translate:-50% 0;
  background:var(--surface);border:1px solid var(--line);border-radius:999px;
  padding:.4rem .9rem;font-size:.78rem;display:flex;gap:.4rem;align-items:center;box-shadow:var(--shadow);
  white-space:nowrap;
}
.detail-title{font-size:clamp(2rem,4.2vw,3.4rem);margin:.4rem 0 .5rem}
.detail-by{font-size:1.05rem;color:var(--text-dim);margin-bottom:1.2rem}
.detail-by b{color:var(--text)}
.stat-row{display:flex;gap:1.6rem;flex-wrap:wrap;padding:1.1rem 0;margin:1.2rem 0;border-block:1px solid var(--line)}
.stat-row .st b{display:block;font-family:var(--font-display);font-size:1.3rem;font-weight:600;line-height:1.2}
.stat-row .st span{font-family:var(--font-mono);font-size:.64rem;letter-spacing:.12em;text-transform:uppercase;color:var(--text-mute)}
.detail-blurb{font-size:1.06rem;line-height:1.72;max-width:62ch;color:var(--text-dim)}
.detail-blurb strong{color:var(--text);font-weight:500}
.detail-acts{display:flex;gap:.7rem;flex-wrap:wrap;margin:1.6rem 0 1rem;align-items:center}
.resume-note{font-size:.84rem;color:var(--text-mute);display:flex;align-items:center;gap:.5rem}
.crumbs{font-size:.83rem;color:var(--text-mute);margin-bottom:1.4rem;display:flex;gap:.5rem;align-items:center;flex-wrap:wrap}
.crumbs a:hover{color:var(--gold)}
.crumbs span.sep{opacity:.5}

/* TOC + about panels */
.panel{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:1.6rem}
.panel-soft{background:var(--surface-2);border:1px solid var(--line);border-radius:var(--radius);padding:1.6rem}
.panel h3{margin-bottom:1rem}
.toc{display:flex;flex-direction:column}
.toc li{list-style:none;display:flex;gap:.9rem;align-items:baseline;padding:.7rem 0;border-bottom:1px solid var(--line);font-size:.94rem}
.toc li:last-child{border-bottom:none}
.toc li .n{font-family:var(--font-mono);font-size:.7rem;color:var(--gold);flex:none;width:1.6rem}
.toc li .pg{margin-left:auto;font-family:var(--font-mono);font-size:.7rem;color:var(--text-mute)}

.tag-row{display:flex;gap:.5rem;flex-wrap:wrap}
.tag{
  padding:.36rem .85rem;border-radius:999px;border:1px solid var(--line);
  background:var(--surface-2);font-size:.8rem;color:var(--text-dim);transition:.15s;
}
a.tag:hover{border-color:var(--gold);color:var(--gold)}

/* rating widget */
.rate-row{display:flex;gap:.3rem;align-items:center}
.rate-row button{font-size:1.5rem;line-height:1;color:var(--line-2);transition:.15s var(--pop)}
.rate-row button:hover{transform:scale(1.2)}
.rate-row button.on{color:var(--gold)}

/* ============================================================
   BROWSE
   ============================================================ */
.browse-layout{display:grid;grid-template-columns:248px 1fr;gap:2.6rem;align-items:start}
.filters{position:sticky;top:calc(var(--header-h) + 20px);display:flex;flex-direction:column;gap:1.6rem}
/* the drawer chrome only exists on mobile */
.filters-head,.filter-bar,.filter-scrim,.filters-foot{display:none}
.fgroup h4{
  font-family:var(--font-mono);font-size:.66rem;letter-spacing:.16em;text-transform:uppercase;
  color:var(--text-mute);margin-bottom:.7rem;font-weight:500;
}
.fgroup .f-opt{
  display:flex;align-items:center;gap:.6rem;width:100%;padding:.45rem .6rem;margin-left:-.6rem;
  border-radius:8px;font-size:.9rem;color:var(--text-dim);transition:.15s;text-align:left;
}
.fgroup .f-opt:hover{background:var(--surface-2);color:var(--text)}
.fgroup .f-opt.on{background:var(--brand-tint);color:var(--brand);font-weight:600}
.fgroup .f-opt .n{margin-left:auto;font-family:var(--font-mono);font-size:.68rem;color:var(--text-mute)}
.fgroup .f-opt.on .n{color:var(--brand)}
.fgroup .f-sub{padding-left:.7rem;border-left:1px solid var(--line);margin-left:.3rem}

.browse-head{margin-bottom:2.4rem}
.browse-top{display:flex;align-items:center;gap:1rem;flex-wrap:wrap;margin-bottom:1.4rem}
.browse-top .count{font-family:var(--font-mono);font-size:.72rem;letter-spacing:.1em;text-transform:uppercase;color:var(--text-mute)}
.select{
  padding:.55rem 2rem .55rem .9rem;border:1.5px solid var(--line);border-radius:999px;background:var(--surface);
  font-size:.86rem;appearance:none;cursor:pointer;
  background-image:linear-gradient(45deg,transparent 50%,currentColor 50%),linear-gradient(135deg,currentColor 50%,transparent 50%);
  background-position:calc(100% - 15px) 55%, calc(100% - 10px) 55%;
  background-size:5px 5px,5px 5px;background-repeat:no-repeat;
}
.active-chips{display:flex;gap:.5rem;flex-wrap:wrap;margin-bottom:1.4rem}
.achip{
  display:flex;align-items:center;gap:.45rem;padding:.32rem .5rem .32rem .85rem;border-radius:999px;
  background:var(--brand-tint);border:1px solid var(--brand);color:var(--brand);font-size:.8rem;font-weight:500;
}
.achip button{width:18px;height:18px;border-radius:50%;display:grid;place-items:center;font-size:.7rem;background:var(--brand);color:var(--bg)}
.book-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:2rem 1.3rem}
.empty{text-align:center;padding:4.5rem 1rem;color:var(--text-dim)}
.empty .big{font-family:var(--font-display);font-size:1.7rem;color:var(--text);margin-bottom:.5rem}
.empty .ic{font-size:2.6rem;margin-bottom:1rem;opacity:.5}

/* ============================================================
   SEARCH PALETTE (⌘K)
   ============================================================ */
.palette-back{
  position:fixed;inset:0;z-index:200;background:rgba(4,7,5,.6);backdrop-filter:blur(6px);
  display:none;justify-content:center;align-items:flex-start;padding:clamp(1rem,10vh,7rem) 1rem 1rem;
}
.palette-back.open{display:flex;animation:fade .18s ease}
.palette{
  width:min(660px,100%);background:var(--surface);border:1px solid var(--line-2);border-radius:var(--radius);
  box-shadow:var(--shadow-lg);overflow:hidden;animation:popIn .24s var(--pop);
}
.palette-in{display:flex;align-items:center;gap:.8rem;padding:1rem 1.2rem;border-bottom:1px solid var(--line)}
.palette-in input{flex:1;border:none;outline:none;background:none;font-size:1.06rem}
.palette-in input::placeholder{color:var(--text-mute)}
.palette-in .esc{font-family:var(--font-mono);font-size:.66rem;padding:.2rem .45rem;border:1px solid var(--line-2);border-radius:5px;color:var(--text-mute)}
.palette-body{max-height:min(56vh,460px);overflow-y:auto;padding:.6rem}
.palette-body .p-head{font-family:var(--font-mono);font-size:.62rem;letter-spacing:.16em;text-transform:uppercase;color:var(--text-mute);padding:.7rem .8rem .4rem}
.p-row{display:flex;align-items:center;gap:.9rem;padding:.6rem .8rem;border-radius:10px;width:100%;text-align:left;transition:.12s}
.p-row:hover,.p-row.sel{background:var(--surface-2)}
.p-row .cover{width:34px;flex:none;border-radius:2px 5px 5px 2px}
.p-row .cover-plate{display:none}
.p-row b{display:block;font-size:.92rem;font-weight:600}
.p-row span{font-size:.78rem;color:var(--text-mute)}
.p-row .go{margin-left:auto;font-size:.8rem;color:var(--text-mute)}
.p-empty{padding:2.4rem 1rem;text-align:center;color:var(--text-mute);font-size:.9rem}

/* ============================================================
   LIBRARY
   ============================================================ */
.tabs{display:flex;gap:.3rem;border-bottom:1px solid var(--line);margin-bottom:2.2rem;overflow-x:auto;scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tab{
  padding:.85rem 1.15rem;font-weight:600;font-size:.94rem;color:var(--text-mute);
  border-bottom:2px solid transparent;white-space:nowrap;transition:.15s;display:flex;gap:.5rem;align-items:center;
}
.tab:hover{color:var(--text-dim)}
.tab.on{color:var(--text);border-color:var(--gold)}
.tab .n{font-family:var(--font-mono);font-size:.66rem;padding:.1rem .4rem;border-radius:99px;background:var(--surface-3);color:var(--text-dim)}

.continue-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:1.2rem}
.continue-card{
  display:grid;grid-template-columns:78px 1fr;gap:1.1rem;align-items:center;
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:1rem;
  transition:.2s var(--ease);position:relative;overflow:hidden;
}
.continue-card:hover{border-color:var(--line-2);transform:translateY(-2px);box-shadow:var(--shadow)}
.continue-card .cc-body{min-width:0}
.continue-card b{display:block;font-size:.96rem;line-height:1.3;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.progress-bar{height:5px;border-radius:99px;background:var(--surface-3);overflow:hidden;margin:.6rem 0 .35rem}
.progress-bar b{display:block;height:100%;background:linear-gradient(90deg,var(--brand),var(--gold));border-radius:99px;transition:width .4s var(--ease)}
.cc-foot{display:flex;justify-content:space-between;align-items:center;gap:.6rem;font-size:.75rem;color:var(--text-mute)}
.cc-meta{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cc-btns{display:flex;gap:.4rem;flex:none}

.coll-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:1.2rem}
.coll-card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:1.2rem;
  text-align:left;transition:.2s var(--ease);width:100%;
}
.coll-card:hover{border-color:var(--gold);transform:translateY(-3px);box-shadow:var(--shadow)}
.coll-covers{display:flex;height:96px;margin-bottom:1rem;padding-left:.4rem}
.coll-covers .cover{width:64px;flex:none;margin-left:-22px;box-shadow:0 6px 18px rgba(0,0,0,.5)}
.coll-covers .cover:first-child{margin-left:0}
.coll-covers .cover:nth-child(2){transform:rotate(3deg) translateY(-2px)}
.coll-covers .cover:nth-child(3){transform:rotate(6deg) translateY(-4px)}
.coll-empty-cover{
  width:64px;height:96px;border-radius:6px;border:1.5px dashed var(--line-2);
  display:grid;place-items:center;color:var(--text-mute);font-size:1.3rem;
}
.coll-card b{display:block;font-size:1rem;margin-bottom:.15rem}

/* stats */
.stat-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1.1rem;margin-bottom:2.4rem}
.stat-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:1.4rem;position:relative;overflow:hidden}
.stat-card .sc-num{font-family:var(--font-display);font-size:2.4rem;font-weight:600;line-height:1.1}
.stat-card .sc-lab{font-size:.84rem;color:var(--text-dim);margin-top:.2rem}
.stat-card .sc-ic{position:absolute;top:1rem;right:1rem;font-size:1.3rem;opacity:.35}
.stat-card.flame{background:linear-gradient(150deg,var(--gold-tint),transparent 70%);border-color:var(--gold)}
.stat-card.flame .sc-num{color:var(--gold)}

.streak-week{display:flex;gap:.45rem;margin-top:1rem}
.streak-week i{
  flex:1;aspect-ratio:1;border-radius:8px;background:var(--surface-3);display:grid;place-items:center;
  font-family:var(--font-mono);font-size:.6rem;color:var(--text-mute);font-style:normal;
}
.streak-week i.on{background:var(--gold);color:#14100A;font-weight:600}
.streak-week i.today{outline:2px solid var(--brand);outline-offset:1px}

.goal-ring{--pct:0;width:112px;height:112px;border-radius:50%;flex:none;display:grid;place-items:center;position:relative;
  background:conic-gradient(var(--gold) calc(var(--pct) * 1%), var(--surface-3) 0);}
.goal-ring::after{content:"";position:absolute;inset:9px;border-radius:50%;background:var(--surface)}
.goal-ring b{position:relative;z-index:1;font-family:var(--font-display);font-size:1.4rem}

.tastebar{display:flex;flex-direction:column;gap:.7rem}
.tb-row{display:grid;grid-template-columns:110px 1fr 34px;gap:.8rem;align-items:center;font-size:.85rem}
.tb-track{height:8px;border-radius:99px;background:var(--surface-3);overflow:hidden}
.tb-track b{display:block;height:100%;border-radius:99px;background:linear-gradient(90deg,var(--brand),var(--gold))}
.tb-row .tb-n{font-family:var(--font-mono);font-size:.72rem;color:var(--text-mute);text-align:right}

/* ============================================================
   READER
   ============================================================ */
body.reader{--rd-bg:var(--bg);--rd-text:var(--text);background:var(--rd-bg);color:var(--rd-text)}
body.reader[data-rd="paper"]{--rd-bg:#FBFAF6;--rd-text:#1A211C;color-scheme:light}
body.reader[data-rd="sepia"]{--rd-bg:#F4ECDC;--rd-text:#3A3122;color-scheme:light}
body.reader[data-rd="night"]{--rd-bg:#0B0E0C;--rd-text:#C8D0C8;color-scheme:dark}
body.reader[data-rd="ink"]{--rd-bg:#000;--rd-text:#B9C2BA;color-scheme:dark}

.rd-top{
  position:fixed;top:0;left:0;right:0;z-index:50;display:flex;align-items:center;gap:1rem;
  padding:.7rem clamp(14px,3vw,26px);
  background:color-mix(in srgb, var(--rd-bg) 88%, transparent);backdrop-filter:blur(14px);
  border-bottom:1px solid color-mix(in srgb, var(--rd-text) 12%, transparent);
  transition:transform .3s var(--ease),opacity .3s;
}
.rd-top.hide{transform:translateY(-100%);opacity:0}
.rd-top .rd-title{font-weight:600;font-size:.9rem;flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rd-top .ibtn{background:transparent;border-color:color-mix(in srgb, var(--rd-text) 18%, transparent);color:var(--rd-text)}
.rd-top .ibtn:hover{background:color-mix(in srgb, var(--rd-text) 10%, transparent)}
.rd-prog{position:fixed;top:0;left:0;right:0;height:3px;z-index:60}
.rd-prog b{display:block;height:100%;width:0;background:linear-gradient(90deg,var(--brand),var(--gold));transition:width .1s linear}

.rd-page{
  max-width:var(--rd-width,680px);margin:0 auto;
  padding:calc(var(--header-h) + 3.5rem) clamp(18px,5vw,24px) 8rem;
  font-size:var(--rd-size,1.12rem);line-height:var(--rd-lead,1.85);
  font-family:var(--rd-font, var(--font-body));
}
.rd-page h1{font-size:clamp(1.9rem,4vw,2.6rem);margin-bottom:.4rem}
.rd-page .chap{
  font-family:var(--font-mono);font-size:.7rem;letter-spacing:.18em;text-transform:uppercase;
  color:var(--gold-deep);margin:3.4rem 0 1.2rem;display:flex;align-items:center;gap:.8rem;
  scroll-margin-top:6rem;
}
.rd-page .chap::after{content:"";flex:1;height:1px;background:color-mix(in srgb, var(--rd-text) 14%, transparent)}
.rd-page p{margin-bottom:1.15em;text-wrap:pretty}
.rd-page .chap + p::first-letter{
  font-family:var(--font-display);font-size:3.3em;float:left;line-height:.82;
  padding:.06em .1em 0 0;color:var(--gold-deep);font-weight:600;
}
.rd-end{
  margin-top:4rem;padding:2.4rem;border-radius:var(--radius);text-align:center;
  border:1px solid color-mix(in srgb, var(--rd-text) 14%, transparent);
  background:color-mix(in srgb, var(--rd-text) 4%, transparent);
}

/* reader settings sheet */
.sheet-back{position:fixed;inset:0;z-index:120;background:rgba(4,7,5,.5);display:none}
.sheet-back.open{display:block;animation:fade .2s ease}
.sheet{
  position:fixed;right:0;top:0;bottom:0;width:min(340px,90vw);z-index:130;
  background:var(--surface);border-left:1px solid var(--line);padding:1.6rem;overflow-y:auto;
  transform:translateX(100%);transition:transform .3s var(--ease);
  color:var(--text);
}
.sheet.open{transform:none}
.sheet h3{margin-bottom:1.4rem;display:flex;justify-content:space-between;align-items:center}
.set-row{margin-bottom:1.5rem}
.set-row label{display:block;font-family:var(--font-mono);font-size:.64rem;letter-spacing:.14em;text-transform:uppercase;color:var(--text-mute);margin-bottom:.6rem}
.seg{display:flex;gap:.3rem;background:var(--surface-2);padding:.25rem;border-radius:10px}
.seg button{flex:1;padding:.5rem;border-radius:7px;font-size:.84rem;color:var(--text-dim);transition:.15s}
.seg button.on{background:var(--surface-3);color:var(--text);font-weight:600;box-shadow:0 1px 4px rgba(0,0,0,.2)}
.swatches{display:flex;gap:.5rem}
.swatch{width:38px;height:38px;border-radius:9px;border:2px solid var(--line);transition:.15s}
.swatch.on{border-color:var(--gold);transform:scale(1.06)}
.range{width:100%;accent-color:var(--gold)}

/* ============================================================
   FORMS / AUTH
   ============================================================ */
.field{display:flex;flex-direction:column;gap:.45rem;margin-bottom:1.1rem}
.field label{font-weight:600;font-size:.88rem}
.field .hint{font-size:.79rem;color:var(--text-mute)}
.input{
  padding:.9rem 1rem;border:1.5px solid var(--line);border-radius:var(--radius-sm);
  background:var(--surface);width:100%;transition:.15s;
}
.input:focus{border-color:var(--brand);outline:none;box-shadow:var(--ring)}
.input.err{border-color:var(--danger)}
.f-err{font-size:.79rem;color:var(--danger);display:none}
.f-err.show{display:block}

.auth{display:grid;grid-template-columns:1.05fr .95fr;min-height:calc(100vh - var(--header-h))}
.auth-art{position:relative;overflow:hidden;isolation:isolate;display:flex;flex-direction:column;justify-content:center;padding:clamp(2rem,5vw,4rem);color:#fff}
.auth-art .art-bed{position:absolute;inset:0;z-index:-2;display:grid;grid-template-columns:repeat(4,1fr);gap:14px;padding:18px;transform:rotate(-8deg) scale(1.35);opacity:.5}
.auth-art .art-bed .cover{border-radius:3px}
.auth-art::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(160deg,rgba(6,10,8,.86),rgba(6,10,8,.95))}
.auth-art h2{font-size:clamp(1.8rem,3vw,2.5rem);margin-bottom:1rem}
.auth-art ul{list-style:none;margin-top:1.6rem;display:flex;flex-direction:column;gap:.6rem}
.auth-art li{display:flex;gap:.7rem;align-items:center;color:#C9D2CB}
.auth-art li::before{content:"✓";color:var(--gold);font-weight:700}
.auth-form{display:flex;align-items:center;justify-content:center;padding:clamp(2rem,5vw,3.5rem) var(--gut)}
.auth-form > div{width:100%;max-width:400px}
.steps{display:flex;gap:.45rem;margin-bottom:1.8rem}
.steps i{height:3px;flex:1;border-radius:99px;background:var(--line);transition:.3s}
.steps i.on{background:var(--gold)}
.genre-grid{display:grid;grid-template-columns:1fr 1fr;gap:.6rem;margin:.6rem 0 1.4rem}
.genre-tile{
  padding:.85rem;border-radius:var(--radius-sm);border:1.5px solid var(--line);background:var(--surface);
  font-size:.88rem;font-weight:500;color:var(--text-dim);text-align:left;transition:.16s var(--pop);
  display:flex;align-items:center;gap:.6rem;
}
.genre-tile:hover{border-color:var(--line-2);transform:translateY(-2px)}
.genre-tile.on{border-color:var(--gold);background:var(--gold-tint);color:var(--text)}
.genre-tile .sw{width:22px;height:22px;border-radius:6px;flex:none}

/* ============================================================
   PRICING
   ============================================================ */
.price-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1.4rem;align-items:stretch}
.price-card{
  background:var(--surface);border:1.5px solid var(--line);border-radius:var(--radius);
  padding:2rem;display:flex;flex-direction:column;position:relative;transition:.2s var(--ease);
}
.price-card:hover{transform:translateY(-4px);box-shadow:var(--shadow)}
.price-card.hot{border-color:var(--gold);background:linear-gradient(170deg,var(--gold-tint),var(--surface) 45%);box-shadow:var(--shadow-lg)}
.p-flag{
  position:absolute;top:-12px;left:50%;translate:-50% 0;background:var(--gold);color:#14100A;
  font-family:var(--font-mono);font-size:.6rem;letter-spacing:.12em;text-transform:uppercase;
  padding:.32rem .9rem;border-radius:999px;white-space:nowrap;font-weight:600;
}
.p-amount{font-family:var(--font-display);font-size:2.7rem;font-weight:600;margin:.5rem 0 .2rem;line-height:1}
.p-amount small{font-size:.95rem;font-family:var(--font-body);color:var(--text-mute);font-weight:500}
.price-card ul{list-style:none;margin:1.4rem 0 1.8rem;flex:1;display:flex;flex-direction:column;gap:.5rem}
.price-card li{font-size:.9rem;display:flex;gap:.6rem;align-items:flex-start;color:var(--text-dim)}
.price-card li::before{content:"✓";color:var(--brand);font-weight:700;flex:none}
.price-card li.no{color:var(--text-mute)}
.price-card li.no::before{content:"—";color:var(--line-2)}

/* ============================================================
   MARKETING BITS
   ============================================================ */
.section{padding-block:clamp(3rem,6vw,5.4rem)}
.section.tight{padding-block:clamp(2.2rem,4vw,3.4rem)}
.section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:1rem;margin-bottom:2.2rem;flex-wrap:wrap}
.section-head.center{justify-content:center;text-align:center;flex-direction:column}
.section-head.center .kicker{justify-content:center}
.band{border-block:1px solid var(--line);background:var(--bg-2)}

.feature-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1.2rem}
.feature{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:1.7rem;transition:.22s var(--ease)}
.feature:hover{transform:translateY(-4px);border-color:var(--line-2);box-shadow:var(--shadow)}
.feature .f-ic{
  width:46px;height:46px;border-radius:13px;display:grid;place-items:center;font-size:1.3rem;
  background:var(--brand-tint);margin-bottom:1.1rem;
}
.feature h3{margin-bottom:.45rem;font-size:1.14rem}
.feature p{font-size:.92rem;color:var(--text-dim)}

.cat-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:.9rem}
.cat-tile{
  position:relative;min-height:132px;border-radius:var(--radius);overflow:hidden;isolation:isolate;
  padding:1.2rem;display:flex;flex-direction:column;justify-content:flex-end;color:#fff;
  transition:.24s var(--ease);border:1px solid var(--line);
}
.cat-tile .art{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2;transition:transform .5s var(--ease)}
.cat-tile::before{content:"";position:absolute;inset:0;z-index:-1;background:linear-gradient(0deg,rgba(4,7,5,.8),rgba(4,7,5,.1))}
.cat-tile:hover{transform:translateY(-4px);box-shadow:var(--shadow-lg);border-color:var(--gold)}
.cat-tile:hover .art{transform:scale(1.08)}
.cat-tile b{font-family:var(--font-display);font-size:1.1rem;font-weight:600;line-height:1.2}
.cat-tile span{font-size:.75rem;opacity:.8;margin-top:.15rem}
.cat-tile .cnt{
  position:absolute;top:.9rem;right:1rem;font-family:var(--font-mono);font-size:.64rem;
  background:rgba(0,0,0,.4);padding:.18rem .45rem;border-radius:99px;backdrop-filter:blur(4px);
}

.proof{display:flex;gap:clamp(1.5rem,4vw,3rem);flex-wrap:wrap;margin-top:2.4rem}
.proof .st b{font-family:var(--font-display);font-size:1.7rem;font-weight:600;display:block;line-height:1.1}
.proof .st span{font-size:.8rem;color:var(--text-mute)}

.marquee{border-block:1px solid var(--line);background:var(--bg-2);padding:1rem 0;overflow:hidden}
.marquee .track{display:flex;gap:3rem;align-items:center;font-family:var(--font-mono);font-size:.7rem;letter-spacing:.14em;text-transform:uppercase;color:var(--text-mute);justify-content:center;flex-wrap:wrap;padding-inline:var(--gut)}

.quote-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:1.2rem}
.quote{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:1.7rem;transition:.2s}
.quote:hover{border-color:var(--line-2)}
.quote p{font-family:var(--font-display);font-size:1.06rem;line-height:1.55;font-style:italic}
.q-who{display:flex;gap:.8rem;align-items:center;margin-top:1.3rem}
.q-av{width:40px;height:40px;border-radius:50%;flex:none;display:grid;place-items:center;font-weight:700;font-size:.8rem;background:var(--surface-3);color:var(--gold)}
.q-who b{display:block;font-size:.9rem}
.q-who span{font-size:.77rem;color:var(--text-mute)}
.q-stars{color:var(--gold);font-size:.85rem;letter-spacing:.1em;margin-bottom:.8rem}

.faq{max-width:800px;margin:0 auto}
.faq details{border-bottom:1px solid var(--line)}
.faq summary{
  padding:1.25rem .2rem;font-weight:600;cursor:pointer;list-style:none;
  display:flex;justify-content:space-between;gap:1rem;font-size:1rem;transition:color .15s;
}
.faq summary::-webkit-details-marker{display:none}
.faq summary:hover{color:var(--gold)}
.faq summary::after{content:"+";font-family:var(--font-display);font-size:1.5rem;color:var(--gold);transition:.25s var(--ease);line-height:1}
.faq details[open] summary::after{transform:rotate(45deg)}
.faq details p{padding:0 .2rem 1.4rem;color:var(--text-dim);max-width:66ch}

.cta-band{
  position:relative;border-radius:calc(var(--radius) * 1.6);padding:clamp(2.6rem,5vw,4.2rem) var(--gut);
  text-align:center;overflow:hidden;isolation:isolate;border:1px solid var(--line);
  background:linear-gradient(150deg,var(--surface-2),var(--surface));
}
.cta-band::before{
  content:"";position:absolute;inset:0;z-index:-1;
  background:radial-gradient(ellipse at 80% -10%,var(--gold-tint),transparent 60%),
             radial-gradient(ellipse at 10% 110%,var(--brand-tint),transparent 55%);
}
.cta-band p{color:var(--text-dim);max-width:46ch;margin:.9rem auto 1.8rem}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer{border-top:1px solid var(--line);background:var(--bg-2);margin-top:4rem}
.site-footer .wrap{padding-block:3.6rem 2.2rem}
.foot-grid{display:grid;grid-template-columns:1.7fr 1fr 1fr 1fr 1fr;gap:2rem}
.site-footer h4{font-family:var(--font-mono);font-size:.66rem;letter-spacing:.16em;text-transform:uppercase;color:var(--text-mute);margin-bottom:1rem;font-weight:500}
.site-footer a{display:block;padding:.26rem 0;font-size:.88rem;color:var(--text-dim);transition:.15s}
.site-footer a:hover{color:var(--gold)}
.foot-bottom{
  display:flex;justify-content:space-between;gap:1rem;flex-wrap:wrap;
  border-top:1px solid var(--line);margin-top:2.6rem;padding-top:1.4rem;
  font-size:.79rem;color:var(--text-mute);
}

/* ============================================================
   FEEDBACK: toast · modal · skeleton
   ============================================================ */
.toast-host{position:fixed;bottom:24px;left:50%;translate:-50% 0;z-index:300;display:flex;flex-direction:column;gap:.5rem;align-items:center}
.toast{
  display:flex;align-items:center;gap:.7rem;padding:.75rem 1.3rem;border-radius:999px;
  background:var(--surface);border:1px solid var(--line-2);color:var(--text);
  font-size:.9rem;box-shadow:var(--shadow-lg);animation:toastIn .3s var(--pop);
}
.toast .t-dot{width:7px;height:7px;border-radius:50%;background:var(--gold);flex:none}
.toast.win .t-dot{background:var(--brand)}

.modal-back{position:fixed;inset:0;z-index:200;background:rgba(4,7,5,.6);backdrop-filter:blur(4px);display:none;align-items:center;justify-content:center;padding:20px}
.modal-back.open{display:flex;animation:fade .18s ease}
.modal{
  background:var(--surface);border:1px solid var(--line-2);border-radius:var(--radius);
  max-width:440px;width:100%;padding:1.8rem;box-shadow:var(--shadow-lg);
  max-height:86vh;overflow-y:auto;animation:popIn .26s var(--pop);
}
.modal h3{margin-bottom:1.1rem}
.modal-acts{display:flex;gap:.6rem;justify-content:flex-end;margin-top:1.2rem}
.pick-row{
  display:flex;align-items:center;justify-content:space-between;gap:.8rem;width:100%;
  padding:.75rem .9rem;border:1px solid var(--line);border-radius:var(--radius-sm);
  background:var(--surface-2);margin-bottom:.5rem;transition:.15s;text-align:left;
}
.pick-row:hover{border-color:var(--gold)}
.pick-row span{font-size:.78rem;color:var(--text-mute)}

.skel{background:linear-gradient(90deg,var(--surface-2) 25%,var(--surface-3) 50%,var(--surface-2) 75%);background-size:200% 100%;animation:shimmer 1.4s infinite;border-radius:var(--radius-sm)}
.skel.cover{aspect-ratio:2/3;border-radius:4px 9px 9px 4px}

/* ============================================================
   MOTION
   ============================================================ */
@keyframes fade{from{opacity:0}to{opacity:1}}
@keyframes popIn{from{opacity:0;transform:scale(.94)}to{opacity:1;transform:none}}
@keyframes toastIn{from{opacity:0;transform:translateY(14px)}to{opacity:1;transform:none}}
@keyframes shimmer{to{background-position:-200% 0}}
@keyframes riseIn{from{opacity:0;transform:translateY(22px)}to{opacity:1;transform:none}}

.reveal{opacity:0}
.reveal.in{animation:riseIn .7s var(--ease) both}
.reveal.in.d1{animation-delay:.08s}
.reveal.in.d2{animation-delay:.16s}
.reveal.in.d3{animation-delay:.24s}

/* ============================================================
   RESPONSIVE
   Mobile is the primary device for this audience — a Kenyan reader on
   a phone on a matatu is the design target, not an afterthought. The
   header in particular is rebuilt, not just squeezed.
   ============================================================ */

/* desktop-only / mobile-only helpers used by the header */
.m-only{display:none}
.lbl-short{display:none}
.mm-you{display:flex;align-items:center;gap:.8rem;padding:.9rem .6rem 1.1rem;border-bottom:1px solid var(--line);margin-bottom:.5rem}
.mm-you b{display:block;font-size:.95rem}
.mm-you span:last-child{font-size:.8rem;color:var(--text-mute)}

@media (max-width:1120px){
  .cat-grid{grid-template-columns:repeat(3,1fr)}
  .foot-grid{grid-template-columns:1.5fr 1fr 1fr 1fr}
  .foot-grid > div:nth-child(5){display:none}
  .detail-lower{grid-template-columns:1fr!important}
  .stats-lower{grid-template-columns:1fr!important}
}

@media (max-width:980px){
  .nav-links,.search-trigger{display:none}
  .m-only{display:grid}
  .burger{display:grid}
  .nav{gap:.6rem}
  .nav-right{gap:.45rem}
  .d-only{display:none!important}         /* streak pill, avatar menu, "Log in" — all live in the burger */
  .browse-layout{grid-template-columns:1fr;gap:1.4rem}

  /* Filters become a slide-over. On a phone, ten rows of filter chrome above
     the grid means you scroll past the whole UI to reach a single book. */
  .filter-bar{
    display:flex;align-items:center;justify-content:space-between;gap:1rem;
    margin-bottom:1.2rem;
  }
  .filter-bar .fcount{
    display:inline-grid;place-items:center;min-width:18px;height:18px;padding:0 .3rem;
    border-radius:99px;background:var(--gold);color:#14100A;font-size:.68rem;font-weight:700;
  }
  .filters{
    position:fixed;top:0;right:0;bottom:0;left:auto;z-index:140;
    width:min(340px,88vw);padding:1.4rem;gap:1.5rem;
    background:var(--surface);border-left:1px solid var(--line);
    overflow-y:auto;overscroll-behavior:contain;
    transform:translateX(100%);transition:transform .3s var(--ease);
  }
  body.filters-open .filters{transform:none}
  .filters-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:-.4rem}
  .filter-scrim{
    display:block;position:fixed;inset:0;z-index:135;background:rgba(4,7,5,.6);
    opacity:0;visibility:hidden;transition:.3s;
  }
  body.filters-open .filter-scrim{opacity:1;visibility:visible}
  /* solid band, or the sticky CTA floats over the last filter row */
  .filters-foot{
    display:block;position:sticky;bottom:-1.4rem;margin-top:auto;
    margin-inline:-1.4rem;padding:1rem 1.4rem 1.4rem;
    background:var(--surface);border-top:1px solid var(--line);
  }
  .browse-top .count{display:none}   /* the count lives on the filter bar now */
  .detail-grid{grid-template-columns:170px 1fr;gap:1.6rem}
  .auth{grid-template-columns:1fr}
  .auth-art{display:none}
  .feature-grid,.quote-grid,.price-grid{grid-template-columns:1fr 1fr}
  .price-card.hot{grid-column:1 / -1}
}

@media (max-width:680px){
  :root{--header-h:62px}
  .logo{font-size:1.25rem}
  .logo .mark{width:24px;height:24px}
  .lbl-full{display:none}
  .lbl-short{display:inline}
  .btn-sm{padding:.45rem .8rem}

  .cat-grid,.feature-grid,.quote-grid,.price-grid{grid-template-columns:1fr}
  .price-card.hot{grid-column:auto}
  .book-grid{grid-template-columns:repeat(auto-fill,minmax(140px,1fr));gap:1.6rem .9rem}
  .continue-grid{grid-template-columns:1fr}
  .coll-grid{grid-template-columns:1fr 1fr}
  .foot-grid{grid-template-columns:1fr 1fr}
  .foot-grid > div:nth-child(5){display:block}
  .card-peek{display:none}                /* no hover on touch — the card links straight through */

  /* billboard: a phone hero should sell in one thumb-length, not one screen */
  .billboard{min-height:auto;padding-top:2rem;padding-bottom:1rem}
  .billboard .bb-art{height:62vh;bottom:auto}
  .billboard::before{
    background:
      linear-gradient(0deg, var(--bg) 24%, color-mix(in srgb,var(--bg) 55%,transparent) 52%, transparent 88%),
      linear-gradient(90deg, color-mix(in srgb,var(--bg) 55%,transparent), transparent 70%);
  }
  .bb-inner{padding-block:34vh 1.6rem}
  .bb-inner h1{font-size:clamp(1.8rem,7.4vw,2.4rem)}
  .bb-hook{font-size:.98rem;margin-bottom:1.1rem}
  .bb-meta{gap:.5rem;font-size:.8rem;margin-bottom:1rem}
  .bb-acts{gap:.5rem;flex-wrap:nowrap}
  .bb-acts .btn-lg{padding:.85rem 1rem;font-size:.92rem;flex:1;min-width:0}
  .bb-acts .ibtn{flex:none}
  .bb-dots{display:none}
  .bb-cover{display:none}   /* the banner art carries the phone hero on its own */

  /* detail page */
  .detail-grid{grid-template-columns:1fr}
  .detail-cover{width:min(190px,50%);margin-inline:auto}
  .detail-title{font-size:clamp(1.8rem,7vw,2.4rem);text-align:center}
  .detail-by,.detail-hero .crumbs{text-align:center;justify-content:center}
  .detail-hero .flag-row{justify-content:center}
  .stat-row{gap:.9rem 1.4rem;justify-content:space-between}
  .stat-row .st b{font-size:1.05rem}
  .stat-row .st.st-shelf{display:none}    /* already in the breadcrumb — don't say it twice */
  .detail-acts{gap:.5rem}
  .detail-acts .btn-lg{flex:1 1 100%}
  .detail-blurb{font-size:1rem}

  /* rails: one-and-a-bit cards visible is the cue that it scrolls */
  .rail{grid-auto-columns:44vw;gap:.9rem}
  .rail.ranked{grid-auto-columns:74vw}
  .rail-sec{margin-bottom:2.2rem}
  .rail-head h2{font-size:1.2rem}

  .section-head{margin-bottom:1.4rem}
  .tabs{margin-inline:calc(var(--gut) * -1);padding-inline:var(--gut)}
  .modal{padding:1.4rem}
  .toast-host{left:var(--gut);right:var(--gut);transform:none;translate:0}
  .toast{width:100%;justify-content:center}
  .palette-back{padding-top:0}
  .palette{border-radius:0 0 var(--radius) var(--radius)}
}

@media (max-width:400px){
  .btn-lg{padding:.9rem 1.4rem;font-size:.98rem}
  .book-grid{grid-template-columns:1fr 1fr;gap:1.4rem .8rem}
  .coll-grid{grid-template-columns:1fr}
}

/* ---------- touch devices ----------
   Anything that only appears on :hover is invisible forever on a phone.
   Quick actions were still *tappable* while fully transparent — an invisible
   button over the artwork is worse than no button. */
@media (hover:none){
  .card-acts{opacity:1;transform:none}
  .rail-head .more{opacity:1}
  .cover-gloss{display:none}
  .rail-nav{display:none}
}

/* Comfortable thumb targets. 34px icon buttons are a miss on a phone. */
@media (max-width:680px){
  .ibtn-sm{width:38px;height:38px}
  .card-acts .ibtn{width:34px;height:34px;font-size:.9rem}
  .rail-head .more{padding:.4rem 0;font-size:.86rem}
  .site-footer a{padding:.45rem 0}
  .tab{padding:.9rem 1rem}
  .f-opt{padding:.6rem}

  /* Get the books above the fold. The intro copy stays in the DOM for
     crawlers and context, but it doesn't get to own half the screen. */
  .browse-head{margin-bottom:1.2rem}
  .browse-head .lede{
    font-size:.92rem;margin-top:.4rem;
    display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;
  }
  .browse-top{gap:.6rem;margin-bottom:1rem}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{animation-duration:.01ms!important;animation-iteration-count:1!important;transition-duration:.01ms!important}
  html{scroll-behavior:auto}
  .reveal{opacity:1}
}
@media print{.site-header,.site-footer,.rd-top,.rail-nav{display:none}}
