/* ============================================================
   DARK — FreeReads dark theme + reading controls
   Scopes to html.theme-dark / [data-font] / [data-spacing].
   Only recolors; never re-layouts.
   ============================================================ */

/* ---------- dark theme ---------- */
html.theme-dark{
  --ink: #eae4d4;              /* main text on dark */
  --ink-soft: #f2ecdc;
  --paper: #17140f;            /* page background */
  --paper-2: #201c15;          /* alt sections */
  --paper-3: #2b251a;          /* wells, hovers */
  --card: #1e1a13;             /* card surface */
  --accent: #d68a63;           /* bright oxblood for contrast */
  --accent-2: #e29a72;
  --accent-soft: #3a241a;
  --brass: #c2a45c;
  --white: #232028;
  --line: rgba(234,228,212,.14);
  --line-strong: rgba(234,228,212,.3);
  --shadow: 0 14px 28px rgba(0,0,0,.5);
  color-scheme: dark;
}
html.theme-dark body{background:var(--paper);color:var(--ink)}
html.theme-dark .lead{color:rgba(234,228,212,.72)}
html.theme-dark .hero__lede,
html.theme-dark .hero__note,
html.theme-dark .hero__caption,
html.theme-dark .hero__nameplate{color:rgba(234,228,212,.62)}
html.theme-dark .btn--ghost{border-color:var(--ink);color:var(--ink)}
html.theme-dark .btn--ghost:hover{background:var(--ink);color:var(--paper)}
html.theme-dark .book-card,
html.theme-dark .faq__item,
html.theme-dark .search-box,
html.theme-dark .layout-toggle,
html.theme-dark .saved-toggle,
html.theme-dark .action-btn,
html.theme-dark .key-ideas,
html.theme-dark .botd__card,
html.theme-dark .spotlight__card,
html.theme-dark .manifesto__item{background:var(--card);border-color:var(--line)}
html.theme-dark .book-card__title,
html.theme-dark .list-row__title,
html.theme-dark .faq__heading,
html.theme-dark .reader__title,
html.theme-dark .key-ideas__title,
html.theme-dark .spotlight__name,
html.theme-dark .botd__title,
html.theme-dark .manifesto__statement,
html.theme-dark .manifesto__item h3,
html.theme-dark .how__step-title,
html.theme-dark .nf h1{color:var(--ink)}
html.theme-dark .book-card__author,
html.theme-dark .book-card__time,
html.theme-dark .list-row__author,
html.theme-dark .list-row__time,
html.theme-dark .library__meta,
html.theme-dark .reader__by,
html.theme-dark .reader__note,
html.theme-dark .summary,
html.theme-dark .key-ideas li,
html.theme-dark .np-bar__title small,
html.theme-dark .library__empty p,
html.theme-dark .botd__author,
html.theme-dark .botd__desc,
html.theme-dark .spotlight__bio,
html.theme-dark .manifesto__item p,
html.theme-dark .how__step p,
html.theme-dark .figure__label{color:rgba(234,228,212,.72)}
html.theme-dark .botd{background:var(--paper-2)}
html.theme-dark .spotlight{background:var(--paper-2)}
html.theme-dark .keep-going{background:var(--paper-2)}
html.theme-dark .header{background:var(--paper);border-bottom-color:var(--line)}
html.theme-dark .footer{background:#0f0d09}
html.theme-dark .closing__panel{background:#0f0d09}
html.theme-dark .closing__panel .h2{color:#f6f2e9}
html.theme-dark .summary h2,
html.theme-dark .reader__cover-wrap .cover{color:var(--ink)}
html.theme-dark :focus-visible{outline-color:var(--accent)}
html.theme-dark .btn:focus-visible,
html.theme-dark .pill:focus-visible,
html.theme-dark .action-btn:focus-visible{outline-color:var(--accent)}
html.theme-dark .faq__arrow-box{background:var(--paper-3)}
html.theme-dark .tag{background:var(--paper-3);color:var(--ink)}
html.theme-dark .tag--accent{background:var(--accent-soft);color:var(--accent-2)}
html.theme-dark .saved-toggle__count{background:var(--accent-soft);color:var(--accent-2)}
html.theme-dark .search-box input{color:var(--ink)}
html.theme-dark .search-box input::placeholder{color:rgba(234,228,212,.4)}
html.theme-dark .key-ideas li::before{color:var(--accent)}
html.theme-dark .copy-toast{background:var(--paper-3);color:var(--ink)}
html.theme-dark img,
html.theme-dark .cover{filter:brightness(.92)}

/* ---------- reading controls: font size ---------- */
html[data-font='s'] .summary{font-size:16px}
html[data-font='s'] .key-ideas li{font-size:15.5px}
html[data-font='m'] .summary{font-size:17.5px}
html[data-font='m'] .key-ideas li{font-size:16.5px}
html[data-font='l'] .summary{font-size:19.5px}
html[data-font='l'] .key-ideas li{font-size:18px}
@media screen and (max-width:560px){
  html[data-font='s'] .summary{font-size:15px}
  html[data-font='l'] .summary{font-size:18px}
}

/* ---------- reading controls: line height ---------- */
html[data-spacing='comfortable'] .summary{line-height:1.75}
html[data-spacing='comfortable'] .key-ideas li{line-height:1.55}
html[data-spacing='compact'] .summary{line-height:1.45}
html[data-spacing='compact'] .key-ideas li{line-height:1.35}

/* ---------- reading toolbar (book page) ---------- */
.read-tools{
  display:flex;align-items:center;justify-content:center;gap:14px;
  flex-wrap:wrap;margin-top:18px;
}
.read-tools__group{
  display:inline-flex;align-items:center;gap:2px;
  background:var(--paper-2);border-radius:var(--r-md);padding:3px;
}
.read-tools__btn{
  padding:6px 13px;border-radius:var(--r-sm);
  font-size:14px;font-weight:600;color:rgba(36,31,22,.6);
  transition:background .2s, color .2s;
}
html.theme-dark .read-tools__btn{color:rgba(234,228,212,.66)}
.read-tools__btn:hover{color:var(--ink)}
.read-tools__btn.is-active{background:var(--ink);color:var(--paper)}
html.theme-dark .read-tools__btn.is-active{background:var(--accent);color:#17140f}
.read-tools__label{font-size:12px;font-weight:700;letter-spacing:.14em;text-transform:uppercase;color:rgba(36,31,22,.45)}
html.theme-dark .read-tools__label{color:rgba(234,228,212,.45)}
.read-tools .action-btn{padding:6px 14px;font-size:14px}

/* ---------- time left ---------- */
.time-left{
  display:inline-flex;align-items:center;gap:6px;
  font-size:14px;font-weight:600;color:rgba(36,31,22,.55);
}
html.theme-dark .time-left{color:rgba(234,228,212,.6)}
.time-left svg{width:14px;height:14px}

/* ---------- finished button + badge ---------- */
.action-btn.is-finished{background:var(--cover-3);border-color:var(--cover-3);color:#fff}
.action-btn.is-finished .action-btn__label-finish{display:none}
.action-btn:not(.is-finished) .action-btn__label-finished{display:none}
.book-card__finished{
  position:absolute;top:8px;left:8px;z-index:2;
  background:var(--cover-3);color:#fff;
  font-size:10.5px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;
  padding:3px 9px;border-radius:999px;
}
.book-card__finished[hidden]{display:none}

/* ---------- shortcut overlay ---------- */
.shortcuts-overlay{
  position:fixed;inset:0;z-index:130;
  display:flex;align-items:center;justify-content:center;
  background:rgba(36,31,22,.45);
  opacity:0;pointer-events:none;transition:opacity .2s;
}
.shortcuts-overlay.is-open{opacity:1;pointer-events:auto}
.shortcuts-panel{
  background:var(--paper);border-radius:var(--r-lg);
  padding:30px 34px;max-width:420px;width:calc(100% - 40px);
  box-shadow:0 30px 70px rgba(0,0,0,.35);
}
.shortcuts-panel h2{font-family:var(--font-display);font-size:22px;margin-bottom:16px}
.shortcuts-panel dl{display:grid;grid-template-columns:auto 1fr;gap:10px 18px;align-items:center}
.shortcuts-panel dt{margin:0}
.shortcuts-panel kbd{
  display:inline-block;min-width:26px;text-align:center;
  background:var(--paper-2);border:1px solid var(--line);border-bottom-width:2.5px;
  border-radius:7px;padding:3px 8px;
  font-family:var(--font);font-size:13px;font-weight:700;
}
.shortcuts-panel dd{font-size:15px;color:rgba(36,31,22,.7)}
html.theme-dark .shortcuts-panel dd{color:rgba(234,228,212,.7)}
.shortcuts-panel .btn{margin-top:20px;width:100%;padding:10px}
@media screen and (max-width:560px){.shortcuts-panel{padding:24px 22px}}

/* ---------- ad slots (dark) ---------- */
html.theme-dark .ad-slot--has-code{background:var(--paper-2);border-color:var(--line)}
html.theme-dark .ad-sticky{background:var(--paper-2)}
html.theme-dark .ad-sticky__close{color:rgba(234,228,212,.6)}
html.theme-dark .ad-sticky__close:hover{color:var(--ink)}
