/* ════════════════════════════════════════════════════════════════════════
   global-tokens.css — canonical Reckon / Revenant / RetroFuture tokens
   Supersedes: brand/reckon-design-system/tokens/colors.css (stale amber default),
   the 3 divergent revenant-ds.css copies, and the DS bundle's dark RetroFuture entry.
   Source of every value: measured in astro-reckon/src/styles/tokens.css
   (mermaid-jewel, 2026-07-29) + the retrofuture vendor revenant-ds.css contrast
   fixes (on-accent/on-accent-ink split, verdict register, jewel categories).

   NAMED as [data-skin="mermaid-jewel"] (2026-08-24), in addition to staying the
   bare-:root default — this is reckon.systems' actual, unchanged, live color
   identity (light cream ground / deep sea-green ink / emerald accent), not a
   new reskin. Naming it turns "the ambient default" into an explicit, durable,
   swappable option in the shared system — mirroring how [data-skin=
   "amber-vintage"] and [data-brand="retrofuture"] are named below — so a
   future default change elsewhere can never silently drag reckon.systems
   along with it. ════════════════════════════════════════════════════════════ */

:root, [data-skin="mermaid-jewel"] {
  color-scheme: light;
  /* Reckon + Revenant shared light default — "mermaid-jewel" */
  --paper:          #FCFAF4;
  --paper-mid:      #F2F6F3;
  --paper-deep:     #E3EDE7;
  --paper-rule:     #9CC4B4;
  --ink:            #0E211B;
  --ink-mid:        #1D3A31;
  --ink-light:      #3E5F54;
  --ink-faint:      #8AA79C;

  --accent:         #0A7052;   /* emerald — 5.83:1 on paper, safe as text */
  --accent-dk:      #06563E;
  --accent-lt:      #D8F2E6;
  --accent-mid:     #12A377;   /* FILL WEIGHT ONLY — never text */
  --on-accent:      #FFFFFF;   /* legal on --accent-dk fills only */
  /* MEASURED 2026-09-14, and the measurement reversed the comment that used to sit here.
     It claimed "cream/white fails there" and set this to var(--ink). Computed against
     --accent #0A7052 at WCAG AA (4.5:1 for normal text):
         #FFFFFF        on #0A7052  =  6.08:1   PASS
         var(--ink)     on #0A7052  =  2.76:1   FAIL
     So the canonical token was the failing one and the justification was backwards. This is
     live on CTA buttons and layer badges (astro-reckon proof-public.astro uses it eight
     times), where it decides whether a filled button's label is readable at all.
     foundry/packages/core had #FFFFFF and was right. */
  --on-accent-ink:  #FFFFFF;

  --garnet:         #7B2233;
  --garnet-soft:    #F3DDE1;
  --sapphire:       #1E4E8C;
  --sapphire-soft:  #DCE8F7;
  --amethyst:       #6B3FA0;
  /* ABSORBED 2026-09-14 from foundry/packages/core/src/styles/ds-tokens.css, which was
     deleted in the same commit. Core carried 36 tokens of which 31 were byte-identical
     duplicates of this file; these five were the only ones it alone defined. --amethyst-soft
     completes the garnet/sapphire/amethyst soft set that was already here minus one, and
     --teal is the fourth jewel register this system has always claimed to have. Keeping them
     in a second file meant the palette was only whole if you loaded both. */
  --amethyst-soft:  #EDE3F5;
  --teal:           #0C6E77;
  --teal-soft:      #D4EDF2;
  --color-success:      #27AE74;
  --color-success-soft: #E1F3E9;

  /* Jewel category registers — fixed hues, never skin-derived (a legend code
     that re-hues stops being a code) */
  --jewel-teal:       #1A5C6E;
  --jewel-teal-soft:  #D4EDF2;
  --jewel-teal-ink:   #0D3A47;
  --jewel-sapphire:      #2563EB;
  --jewel-sapphire-ink:  #1E3A8A;

  /* Forest / custody verdict register */
  --leaf-emerald:      #1F9D6B;
  --leaf-emerald-soft: #D8F2E6;
  --leaf-hunter:       #2F5D46;
  --bark-pinecone:     #5C4433;
  --bark-pinecone-dk:  #3E2D21;
  --root-garnet:       #7B2233;
  --root-garnet-soft:  #F3DDE1;
  --withered:          #8A7A63;
  --withered-ink:      #5F564A;

  --verdict-ok:          var(--root-garnet);
  --verdict-ok-soft:     var(--root-garnet-soft);
  --verdict-entry:       var(--leaf-emerald);
  --verdict-entry-soft:  var(--leaf-emerald-soft);
  --verdict-structure:   var(--bark-pinecone);
  --verdict-refused:     var(--withered);
  --verdict-refused-ink: var(--withered-ink);

  --color-danger:      #C5302A;
  --color-danger-soft: #FBECEA;
  --color-success-ink: #1A5E33;

  /* ── Semantic action button colors ── */
  --button-success:      #2A7D46;      /* success/verified/publish action */
  --button-success-hover: #31904f;     /* hover state */
  --label-gold:          #7A5D1A;      /* readable label color (dark ink on pale surface) */

  --font-display: 'IM Fell English', 'EB Garamond', Georgia, serif;
  --font-body:    'EB Garamond', Georgia, serif;
  --font-ui:      'Jost', system-ui, sans-serif;
  --font-label:   'Space Grotesk', 'Jost', system-ui, sans-serif;
  --font-heading: 'Cinzel', 'Space Grotesk', sans-serif;
  --font-read:    'Atkinson Hyperlegible', system-ui, sans-serif;
  --font-mono:      'Courier Prime', 'Courier New', monospace;
  --font-mono-tech: 'Space Mono', 'Courier New', monospace;
  --font-mono-retro:'VT323', 'Courier New', monospace;

  --radius-sm: 3px; --radius: 6px; --radius-lg: 12px; --radius-pill: 999px;
  --shadow-sm: 0 1px 6px rgba(14,33,27,.07);
  --shadow-md: 0 3px 18px rgba(14,33,27,.10);
  --shadow-lg: 0 8px 36px rgba(14,33,27,.14);

  --surface:        var(--paper-mid);
  --surface-raised: #FFFFFF;
  --border:         var(--paper-rule);

  /* ── Bearing colors — canonical N/S/E/W compass register, matches the
     @reckon/canvas base hues 1:1 (--palette-bearing-* in packages/canvas/
     src/tokens/colors.css) plus the soft/ink pairs the revenant design-system
     export adds for pill/badge treatments (BearingPill). Ported here so
     global-tokens.css — the door astro-reckon + astro-retrofuture both
     actually consume — carries the full triad, not just the bases canvas
     already had. */
  --bearing-n: #E74C3C; --bearing-n-soft: #FBE4E1; --bearing-n-ink: #B23327;
  --bearing-s: #27AE74; --bearing-s-soft: #E1F3E9; --bearing-s-ink: #1F7A4C;
  --bearing-e: #C9A84C; --bearing-e-soft: #F5EBD2; --bearing-e-ink: #7A5D1A;
  --bearing-w: #5DA8E0; --bearing-w-soft: #E1EBF7; --bearing-w-ink: #2E5FA3;

  /* ── Spacing scale — 4px base, matches packages/canvas/src/tokens/spacing.css
     numerically (that file uses rem; this file's own convention is px
     throughout, so ported in px here rather than copying the file). */
  --space-1: 4px;  --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 20px; --space-6: 24px;  --space-8: 32px;  --space-10: 40px;
  --space-12: 48px; --space-16: 64px; --space-20: 80px;

  /* ── Z-index scale — DS-scoped (nav/popover/modal); the fuller app-chrome
     scale (toast/drawer/tooltip/topbar/...) stays in packages/canvas/src/
     tokens/spacing.css, not duplicated here. */
  --z-nav: 50; --z-popover: 100; --z-modal: 1000;

  /* ── Motion — easing + duration, matches packages/canvas/src/tokens/motion.css. */
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-settle:  cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 120ms; --duration-base: 220ms; --duration-slow: 400ms;

  /* ── Type scale — matches the revenant design-system export exactly
     (11/13/15/19/22/26/32/44px); packages/canvas/src/tokens/typography.css
     runs a slightly different rem-based scale for its own app chrome —
     legitimate divergence, not ported here, see that file directly. */
  --text-xs: 11px; --text-sm: 13px; --text-base: 15px; --text-lg: 19px;
  --text-xl: 22px; --text-2xl: 26px; --text-3xl: 32px; --text-4xl: 44px;
  --tracking-wide: 0.06em; --tracking-wider: 0.08em; --tracking-widest: 0.12em;

  /* ── Flowsearch product tokens ── */
  --fs-primary:     #3E8E7E;
  --fs-primary-dk:  #2A6459;
  --fs-secondary:   #547E71;
  --fs-seed:        #1F9D6B;
  --fs-toggle-bg:   #E3EDE9;
  --fs-badge-border:#A9C7BC;
  --fs-overlay:     rgba(14,33,27,0.3);
  --fs-pipe-purple:     #6B3FA0;
  --fs-pipe-purple-bg:  #EDE3F5;
  --fs-pipe-purple-ink: #4A2A70;
  --fs-spider:        #B85C1A;
  --fs-spider-bg:     #FDF3EB;
  --fs-spider-ink:    #6B3410;
  --fs-spider-border: #D9A876;
  --fs-spider-dot:    #E07B2A;
}

/* Legacy skins — kept, explicitly opt-in, never the default. */
[data-skin="amber-vintage"] {
  --paper:#FAF5E4; --paper-mid:#F2E8C8; --paper-deep:#E8D8A0; --paper-rule:#C8A850;
  --ink:#1E0F04; --ink-mid:#3C2008; --ink-light:#7A5020;
  --accent:#B86A08; --accent-dk:#7A4204; --accent-lt:#FDE8AA;
  --surface: var(--paper-mid); --surface-raised:#FFFDF4; --border: var(--paper-rule);
}

/* RetroFuture — distinct brand identity with measured jewel palette, light-only, never dark.
   CONTRAST MEASURED 2026-07-28 (versus white):
     emerald #196B3A 6.55 · sapphire #1A5CB8 6.43 · amethyst #5B2E8A 9.53 · ruby #A82419 7.16
     gold #C9A84C 2.29 — FILL/BORDER/ORNAMENT ONLY · gold-ink #8A7334 4.58 — text-safe variant
   Jewel assignment by information: emerald=verified/proven, sapphire=links/navigation,
   amethyst=gated/restricted, ruby=refusal/failure/stop, gold=the thing being sold (fill only).
   Gold and gold-ink pair ensures text readability while preserving identity. */
[data-brand="retrofuture"] {
  color-scheme: light;
  --paper:#FCFAF4; --paper-mid:#F2F6F3; --paper-deep:#E3EDE7;
  --paper-rule:#D9D4C7;
  --ink:#0A1525; --ink-mid:#2A343B; --ink-light:#5B6B72;

  /* Jewel palette — the canonical retrofuture identity */
  --jewel-emerald:#196B3A;      --jewel-emerald-ink:var(--ink);
  --jewel-sapphire:#1A5CB8;     --jewel-sapphire-ink:var(--ink);
  --jewel-amethyst:#5B2E8A;     --jewel-amethyst-ink:var(--ink);
  --jewel-ruby:#A82419;         --jewel-ruby-ink:var(--ink);
  --jewel-gold:#C9A84C;         --jewel-gold-ink:#8A7334;

  /* Legacy jewel-tone aliases for breadcrumb compat */
  --accent:#196B3A;             /* emerald as default accent */
  --accent-dk:#0F5328;          --accent-lt:#DCEFEC;
  --gold:#C9A84C;               /* non-text fill */
  --gold-ink:#8A7334;           /* text-safe gold */

  /* Retrotype branding — era tension: 17th-c letterpress meets machine voice */
  --font-display:'IM Fell English SC', Georgia, serif;
  --font-body:'Newsreader', Georgia, serif;
  --font-ui:'Space Grotesk', system-ui, sans-serif;
  --font-heading:'Space Grotesk', system-ui, sans-serif;
  --font-mono:'Space Mono', 'Courier New', monospace;

  /* Geometry: the letterpress impression — vintage texture, not mood */
  --border:#0A1525;
  --border-thick:2px;
  --radius:3px; --radius-sm:3px; --radius-lg:3px; --radius-pill:999px;
  --shadow-md: 3px 3px 0 var(--ink);
  --shadow-jewel:3px 3px 0 var(--jewel-emerald);
  --rule-hair:#D9D4C7;

  --surface: var(--paper-mid); --surface-raised:#FFFFFF;
}

/* ONE shared, contrast-checked dark theme — developed from RetroFuture's jewel-tone
   identity (teal/magenta/cobalt on near-black), refined for accessibility, and grounded
   in the "stage" backdrop already vetted elsewhere in the ecosystem (a dark surface for
   rendered content, not a page-background dark mode). Opt-in only, available to ANY
   brand — RetroFuture included, since this palette is its own dark identity matured. */
[data-theme="dark"] {
  color-scheme: dark;
  --paper:#14161C; --paper-mid:#1B1F29; --paper-deep:#242A38; --paper-rule:#323A4C;
  --ink:#ECEFF6; --ink-mid:#C3CAD9; --ink-light:#8890A3;

  --accent:#2FD9C4;        /* jewel teal — primary, ~9:1 on --paper */
  --accent-dk:#1FA893;
  --accent-lt:rgba(47,217,196,.14);
  --on-accent:#0E1116;     /* teal is bright — dark ink reads on it, not white */
  --on-accent-ink:#0E1116;

  /* RetroFuture jewels on dark — bright and retuned, every dark accent needs dark ink */
  --jewel-emerald:#5BC9A3;      --jewel-emerald-ink:var(--ink);
  --jewel-sapphire:#7FA3F5;     --jewel-sapphire-ink:var(--ink);
  --jewel-amethyst:#C9A8E8;     --jewel-amethyst-ink:var(--ink);
  --jewel-ruby:#F0679E;         --jewel-ruby-ink:var(--ink);
  --jewel-gold:#F2B84B;         --jewel-gold-ink:var(--ink);

  --jewel-magenta:#F0679E; /* rare punctuation — verified/highlight, never a field */
  --jewel-cobalt:#6C93FF;  /* category/info register */
  --jewel-amber:#F2B84B;   /* warn */

  --border: var(--paper-rule);
  --shadow-md: 4px 4px 0 rgba(0,0,0,.5), 0 0 0 1px var(--paper-rule);
  --surface: var(--paper-mid); --surface-raised: var(--paper-deep);

  --fs-primary:#5BC4B0; --fs-primary-dk:#3DA08C; --fs-secondary:#7FAA9D;
  --fs-seed:#3BC98A; --fs-toggle-bg:var(--paper-deep);
  --fs-badge-border:var(--paper-rule); --fs-overlay:rgba(10,16,22,0.5);
  --fs-pipe-purple:#B088E0; --fs-pipe-purple-bg:rgba(107,63,160,.15);
  --fs-pipe-purple-ink:#D4B8F0;
  --fs-spider:#E0A060; --fs-spider-bg:rgba(184,92,26,.12);
  --fs-spider-ink:#F0C898; --fs-spider-border:#6B5030; --fs-spider-dot:#E0A060;
}

/* ════════════════════════════════════════════════════════════════════════
   JEWEL ACCENTS — five interchangeable accent hues for Reckon/Revenant.
   Apply data-accent alongside :root (or [data-theme="dark"]) — only
   --accent/--accent-dk/--accent-lt swap; ground, ink and type stay put.
   Emerald is the default and needs no data-accent attribute.
   ════════════════════════════════════════════════════════════════════════ */
[data-accent="garnet"]   { --accent:#7B2233; --accent-dk:#5C1927; --accent-lt:#F3DDE1; }
[data-accent="sapphire"] { --accent:#1E4E8C; --accent-dk:#163A69; --accent-lt:#DCE8F7; }
[data-accent="amethyst"] { --accent:#6B3FA0; --accent-dk:#4A2A70; --accent-lt:#EDE3F5; }
[data-accent="teal"]     { --accent:#0C6E77; --accent-dk:#094F56; --accent-lt:#D4EDF2; }

/* Same five, retuned bright-on-dark — every dark accent needs DARK ink, not white. */
[data-theme="dark"][data-accent="garnet"]   { --accent:#F0679E; --accent-dk:#C24A7C; --accent-lt:rgba(240,103,158,.14); }
[data-theme="dark"][data-accent="sapphire"] { --accent:#6C93FF; --accent-dk:#4A6FE0; --accent-lt:rgba(108,147,255,.14); }
[data-theme="dark"][data-accent="amethyst"] { --accent:#C9A8E8; --accent-dk:#A57FD1; --accent-lt:rgba(201,168,232,.14); }
[data-theme="dark"][data-accent="teal"]     { --accent:#F2B84B; --accent-dk:#D19A2E; --accent-lt:rgba(242,184,75,.14); }

/* ════════════════════════════════════════════════════════════════════════
   FONT PAIRINGS — vendored self-hosted families, curated in the Résumé/Theme
   Studio (astro-retrofuture/theme-playground). Apply data-fonts on :root.
   Cartographer (IM Fell English + EB Garamond) is the Reckon/Revenant default
   and needs no attribute. Gothic/Pirata One intentionally excluded — doctrine
   says it reads too blackletter for Reckon branding.
   ════════════════════════════════════════════════════════════════════════ */
[data-fonts="modern"] {
  --font-display:'Space Grotesk',sans-serif; --font-body:'Inter',system-ui,sans-serif; --font-ui:'Inter',system-ui,sans-serif;
}
[data-fonts="editorial"] {
  --font-display:'Playfair Display',Georgia,serif; --font-body:'Newsreader',Georgia,serif; --font-ui:'Inter',system-ui,sans-serif;
}
[data-fonts="technical"] {
  --font-display:'Oswald',sans-serif; --font-body:'Roboto Condensed',sans-serif; --font-ui:'Oswald',sans-serif;
}
[data-fonts="monument"] {
  --font-display:'Bebas Neue',sans-serif; --font-body:'Raleway',sans-serif; --font-ui:'Raleway',sans-serif;
}
[data-fonts="deco"] {
  --font-display:'Cinzel Decorative',Georgia,serif; --font-body:'Cormorant SC',Georgia,serif; --font-ui:'Jost',system-ui,sans-serif;
}
[data-fonts="slab"] {
  --font-display:'Roboto Slab',Georgia,serif; --font-body:'Inter',system-ui,sans-serif; --font-ui:'Inter',system-ui,sans-serif;
}
