/* =====================================================================
   TTL · Teeny Tiny Library — design tokens ("e-ink / EPUB reader" theme)
   Light = "paper", dark = "night ink" via [data-mode="dark"].
   UI theme: this file is the "eink" default; theme-minimal.css overrides
   these same token names under [data-theme="minimal"].
   Every colour pair used for text is checked by tools/contrast.py (WCAG AA).
   Fonts (Google Fonts): Literata (serif: titles + reading), Inter (sans: UI).
   ===================================================================== */

:root,
[data-mode="light"] {
  color-scheme: light;

  /* --- surfaces ------------------------------------------------------ */
  --c-paper:        #f7f5ef;  /* page background — warm paper, never #fff   */
  --c-surface:      #fbfaf6;  /* cards, sidebar, top bar                    */
  --c-sunken:       #eeebe3;  /* tracks, fills, selected chips, code        */
  --c-scrim:        rgba(28, 27, 24, .42); /* modal backdrop (flat, no blur) */

  /* --- ink ----------------------------------------------------------- */
  --c-ink:          #1c1b18;  /* primary text            15.8:1 on paper    */
  --c-ink-muted:    #59554c;  /* secondary text           6.8:1 on paper    */
  --c-border:       #d6d0c3;  /* 1px hairline rules / card edges (decor.)   */
  --c-border-strong:#7a7568;  /* input + control borders  4.4:1 (≥3:1)      */

  /* --- the one accent: ink blue -------------------------------------- */
  --c-accent:       #1f4a7a;  /* primary actions, links   8.3:1 on paper    */
  --c-accent-hover: #183b62;
  --c-on-accent:    #fbfaf6;  /* label on accent          8.7:1             */
  --c-accent-soft:  #e4e9ef;  /* selected nav / tab tint  accent 7.4:1      */

  /* --- status (text-level only, never large fills) ------------------- */
  --c-danger:       #9a2b1e;  /* 7.3:1 on surface */
  --c-success:      #2e5a37;  /* 7.6:1 on surface */

  /* --- focus --------------------------------------------------------- */
  --c-focus:        var(--c-accent);

  /* --- typographic book covers (CSS-only, same in both modes) -------- */
  --cover-ink:      #f3efe4;  /* title colour on dark covers               */
  --cover-1: #24456b;  /* ink blue   */
  --cover-2: #6b4a2b;  /* sepia      */
  --cover-3: #3f5a4a;  /* sage       */
  --cover-4: #6e2f2a;  /* oxblood    */
  --cover-5: #2b2a27;  /* charcoal   */
  --cover-6: #4a4560;  /* dusk       */
  --cover-paper: #e8e1cf; /* light "paperback" cover, ink title */
}

[data-mode="dark"] {
  color-scheme: dark;

  --c-paper:        #191714;  /* warm near-black, not #000                  */
  --c-surface:      #211e1a;
  --c-sunken:       #2b2823;
  --c-scrim:        rgba(0, 0, 0, .6);

  --c-ink:          #ece6da;  /* soft off-white ink       14.4:1 on paper   */
  --c-ink-muted:    #aaa293;  /*                           7.1:1 on paper   */
  --c-border:       #3d3931;
  --c-border-strong:#7f786b;  /*                           3.8:1 on surface */

  --c-accent:       #9dbbe0;  /* same ink blue, lifted     9.0:1 on paper   */
  --c-accent-hover: #b6cde9;
  --c-on-accent:    #191714;  /*                           9.0:1 on accent  */
  --c-accent-soft:  #26303b;

  --c-danger:       #ec9b8c;
  --c-success:      #9cc9a4;
}

:root {
  /* --- type families ------------------------------------------------- */
  /* Literata and Inter are latin subsets. Tamil (and other Indic) text falls
     through to the Tamil-capable fonts listed before the generic family, so
     Latin keeps its look and Tamil is shaped by a font that has its glyphs. */
  --font-serif: "Literata", "Source Serif 4", Georgia, "Times New Roman", "Noto Serif Tamil", "Tamil Sangam MN", "Nirmala UI", Latha, serif;
  --font-sans:  "Inter", "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Tamil", "Tamil Sangam MN", "Nirmala UI", Latha, sans-serif;
  --font-mono:  ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  /* --- type scale -----------------------------------------------------
     UI (sans) is compact; display + reading (serif) are generous.      */
  --fs-2xs: 11px;   /* labels / overlines (uppercase, tracked)          */
  --fs-xs:  12px;   /* meta, captions                                   */
  --fs-sm:  13px;   /* dense UI, table cells                            */
  --fs-md:  14px;   /* default UI text                                  */
  --fs-lg:  16px;   /* inputs on mobile, lead UI text                   */
  --fs-xl:  20px;   /* serif h3 / card titles                           */
  --fs-2xl: 26px;   /* serif h1 in app pages                            */
  --fs-3xl: 32px;   /* serif section titles (public)                    */
  --fs-4xl: 44px;   /* serif hero (public)                              */
  --fs-read: 19px;  /* reader body text (user-adjustable)               */

  --lh-tight: 1.2;
  --lh-ui:    1.45;
  --lh-read:  1.65;

  --fw-regular: 400;
  --fw-medium:  500;
  --fw-semibold:600;

  --tracking-label: .06em;

  /* --- spacing (4px base) -------------------------------------------- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px; --sp-5: 20px;
  --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 56px; --sp-10: 80px;

  /* --- radius: e-ink crisp ------------------------------------------- */
  --radius-xs: 2px;   /* chips, progress bars, covers */
  --radius-sm: 3px;   /* buttons, inputs              */
  --radius-md: 4px;   /* cards, modal, popup          */
  --radius-round: 999px; /* avatars only              */

  /* --- lines --------------------------------------------------------- */
  --line: 1px;              /* every border is 1px — no shadows anywhere */
  --focus-width: 2px;
  --focus-offset: 2px;

  /* --- layout -------------------------------------------------------- */
  --sidebar-w: 220px;
  --topbar-h: 60px;
  --measure: 640px;   /* reader column ≈ 66 characters at 19px Literata */
  --popup-w: 360px;

  /* --- motion: e-ink has none; only instant state changes ------------ */
  --dur: 0ms;
}
