/* workspace/tokens.css: design tokens for the author workspace (/workspace/).
   CTO-owned, read-only to every coder (workspace/CONTRACT.md section 2).

   Source: the :root and html[data-theme="dark"] blocks of AnalysisReader/index.html
   (lines 14-141), copied verbatim at commit 5202c71 (index.html last changed in
   07c63b9). Re-copy from there when the reading app's palette changes.

   Workspace additions (UI polish pass, 2026-10-13; keep them when re-copying):
   - --on-accent      cream text on every filled accent control, both lightings
                      (BUG-0133: var(--paper) text on rust was 3.4:1 in Evening);
   - --accent-press   hover/pressed fill that keeps --on-accent >= 4.5:1;
   - --chip-low-fg    light value deepened to #655d4f (5.2:1 on --chip-low-bg;
                      BUG-0150, was 3.7:1);
   - --chip-med-fg    light value deepened to #7d5c12 (5.0:1 on --chip-med-bg,
                      was 4.4:1: offline/busy save status, flags, badges);
   - --material-*     the registry palette's cloth / wood / desk materials
                      (served/themes.json "paper-and-ink");
   - --ws-ground      the desk the workspace sheets lie on (plain paper under
                      Quiet paper);
   - --ws-scrim       the dimming behind the phone drawer and modal dialogs;
   - --ui-size        chrome type base, set by html[data-ui-scale] (marg.uiScale,
                      shared with the reading app).

   Deliberately NOT copied (they belong to the reading view, not the workspace):
   - --world-*         artwork url() tokens; the workspace resolves only its own
                       slot (--world-keeping) from the registry at runtime;
   - --reader-step, --reader-size, --reader-col, --notes-size, --rail-w.

   Theme switching: the page sets html[data-theme] to "light" or "dark" from
   localStorage["marg.theme"] (JSON string; absent = follow prefers-color-scheme
   live), and html[data-visual-theme] from marginalia.visualTheme
   (workspace/CONTRACT.md section 5). Leaves use var(--token) only. */

:root{
  color-scheme: light;
  --font-serif: "Iowan Old Style", "Source Serif 4", Georgia, "Times New Roman",
                "Noto Serif SC", "Songti SC", "SimSun", serif;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", "Avenir Next",
             "Helvetica Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --paper:        #f6f1e7;
  --paper-2:      #efe8da;
  --paper-3:      #e7ddcb;
  --ink:          #2b2620;
  --ink-soft:     #57503f;
  --ink-faint:    #6d6455;
  --hairline:     #ddd2bf;
  --hairline-2:   #cfc2aa;
  --accent:       #b3452a;            /* cinnabar */
  --accent-soft:  #c96a4f;
  --accent-wash:  rgba(179,69,42,.08);
  /* Text-only accent: deep enough to read as copy on paper, paper-2
     and paper-3. --accent itself stays the filled-button colour. */
  --accent-text:  #92391f;
  --on-accent:    #fdf7ef;
  --accent-press: #9c3b23;
  --chip-high-bg: #e4ecd9;  --chip-high-fg: #3f6b2f;
  --chip-med-bg:  #f3e8c9;  --chip-med-fg:  #7d5c12;
  --chip-low-bg:  #ece5d8;  --chip-low-fg:  #655d4f;
  --chip-payoff-bg: #e0e9e4; --chip-payoff-fg: #2f6b57;
  --chip-partial-bg:#f3e8c9; --chip-partial-fg:#8a6414;
  --chip-growth-bg: #e4e4ef; --chip-growth-fg: #55548a;
  --caution-bg:   #f7e9e2;  --caution-fg: #9c3d22;
  --card-bg:      #faf6ee;
  --shadow:       0 1px 2px rgba(60,45,20,.06), 0 6px 24px rgba(60,45,20,.07);
  /* Bookplate art tokens — kept separate from functional text/button
     colors so illustration strokes can stay subtle without ever
     touching the contrast of copy, placeholders or actions. */
  --art-line:     #8a7d64;
  --art-line-soft:#b3a78d;
  --art-accent:   #b3452a;
  --art-paper:    #efe8da;
  --material-cloth: #35565a;
  --material-wood:  #bbae8c;
  --material-desk:  #e4dbc9;
  --ws-ground:    var(--material-desk);
  --ws-sheet-shadow: 0 1px 1px rgba(60,45,20,.05), 0 3px 14px rgba(60,45,20,.07);
  --ws-scrim:     rgba(43,38,32,.34);
  /* chrome type base: 13px, growing to 15px at 1920px wide (the reading app's formula) */
  --ui-size:      clamp(.8125rem, calc(.6875rem + .1042vw), .9375rem);
  --topbar-h:     max(52px, calc(var(--ui-size) * 4));
}
html[data-theme="dark"]{
  color-scheme: dark;
  --paper:        #211e1a;
  --paper-2:      #29251f;
  --paper-3:      #332e26;
  --ink:          #e6dfd2;
  --ink-soft:     #bdb4a2;
  --ink-faint:    #a29a8b;
  --hairline:     #3b352b;
  --hairline-2:   #4a4336;
  --accent:       #a85c40;
  --accent-soft:  #c06a4e;
  --accent-wash:  rgba(208,122,95,.10);
  --accent-text:  #d89677;
  --accent-press: #964f36;
  --chip-high-bg: #2c3a2a;  --chip-high-fg: #9cc488;
  --chip-med-bg:  #3d3520;  --chip-med-fg:  #d4b05e;
  --chip-low-bg:  #332f28;  --chip-low-fg:  #a39a89;
  --chip-payoff-bg:#263a33; --chip-payoff-fg:#8fc4ac;
  --chip-partial-bg:#3d3520;--chip-partial-fg:#d4b05e;
  --chip-growth-bg:#30304a; --chip-growth-fg:#a9a8d6;
  --caution-bg:   #3a2620;  --caution-fg:  #e08a6d;
  --card-bg:      #262320;
  --shadow:       0 1px 2px rgba(0,0,0,.3), 0 8px 28px rgba(0,0,0,.35);
  --art-line:     #9a8f78;
  --art-line-soft:#6f6654;
  --art-accent:   #c98a6d;
  --art-paper:    #2e2a24;
  --material-cloth: #263e42;
  --material-wood:  #414333;
  --material-desk:  #191d1b;
  --ws-sheet-shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.28);
  --ws-scrim:     rgba(0,0,0,.55);
}
html[data-visual-theme="quiet-paper"]{ --ws-ground: var(--paper); --ws-sheet-shadow: none; }
html[data-ui-scale="compact"]{ --ui-size: clamp(.75rem, calc(.625rem + .1042vw), .875rem); }
html[data-ui-scale="large"]{ --ui-size: clamp(.9375rem, calc(.8125rem + .1042vw), 1.0625rem); }
