/* ═══════════════════════════════════════════════════════════════════
   library.css — the one shared stylesheet for books.mbuhamad.com
   (and books2, which copies it via generate_static.py MAP_ASSETS).

   Load it BEFORE a page's own <style>, so page rules still win:
     <link rel="stylesheet" href="/library.css?v=1">
   Bump ?v= on every change (Cloudflare caches .css).

   Rules (2026-10-26):
   - Colours come from these tokens only. A page that needs a new
     colour adds a token here, not a hex in its own <style>.
   - Text colour on any surface must reach 4.5:1 (WCAG AA).
     --muted #9090b4 is ≥4.8:1 on every background below, incl. --border.
     --gold-dim is for fills/borders/gradients, never for text.
   - Smallest type is --fs-xs (11px). Nothing smaller, badges included.
   - Components are prefixed lb- so they never collide with page classes.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* surfaces, darkest → lightest */
  --bg:        #0c0c14;
  --surface:   #13131f;
  --card:      #1a1a2e;
  --card2:     #1e1e32;
  --border:    #252540;

  /* text */
  --text:      #e4e4f0;   /* 13.5:1 on --card */
  --muted:     #9090b4;   /* 5.5:1 on --card (was #7878a0 = 4.06:1, failed AA) */

  /* accent + status */
  --gold:      #c8961e;   /* 6.4:1 on --card — OK as text */
  --gold-dim:  #a07816;   /* fills/borders only */
  --gold-glow: rgba(200,150,30,.18);
  --danger:    #e05252;
  --success:   #22c77a;
  --info:      #38bdf8;
  --warn:      #f0a830;
  --purple:    #a78bfa;

  /* shape */
  --radius:    12px;
  --r:         var(--radius);   /* alias used by book_view.php */
  --shadow:    0 8px 32px rgba(0,0,0,.5);

  /* type scale */
  --fs-xs:   11px;   /* badges, pills — the floor */
  --fs-sm:   12px;   /* labels, metadata */
  --fs-md:   14px;   /* body / controls */
  --fs-lg:   16px;
  --fs-ar-read: 17px; /* Arabic reading text (quotes, notes, reviews) */
  --font:    'Inter', sans-serif;
  --font-display: 'Playfair Display', serif;
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font-family: var(--font); min-height: 100vh; }

/* Keyboard focus: one visible gold ring everywhere. :where() = zero
   specificity, so any page that styles its own focus still wins. */
:where(a, button, [role="button"], summary, [tabindex]):focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Arabic reading text breathes more than Latin at the same size.
   Opt-in class, not a blanket [dir=rtl] rule: card titles have fixed
   line clamps that a taller line-height would cut off. */
.lb-ar-read { font-size: var(--fs-ar-read); line-height: 1.8; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ── Components (adopt page by page) ── */
.lb-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.lb-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  font: 500 var(--fs-md)/1.2 var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer; text-decoration: none;
  transition: border-color .15s, background .15s, color .15s;
}
.lb-btn:hover { border-color: rgba(200,150,30,.45); }
.lb-btn--primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #000; font-weight: 700; border-color: transparent;
}
.lb-btn--danger:hover { border-color: var(--danger); color: var(--danger); }
.lb-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  font: 600 var(--fs-xs)/1.4 var(--font);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 20px;
}
.lb-chip--gold { color: var(--gold); background: rgba(200,150,30,.12); border-color: rgba(200,150,30,.35); }
.lb-field {
  width: 100%;
  padding: 9px 12px;
  font: var(--fs-md) var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.lb-field:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-glow); }
.lb-muted { color: var(--muted); font-size: var(--fs-sm); }

/* Paper (light) theme: /paper.css — loaded by nav.php only on pages checked in it. */
