/* ============================================================
   AGATE UI — one stylesheet, seven ventures
   Set in Agate · v1.0 · July 2026

   How it works:
   1. :root carries everything shared — paper, ink, the two
      typefaces, spacing, and motion.
   2. [data-brand="…"] on <html> or any container switches the
      single accent. Nothing else changes. That is the system:
      one ink, one paper, one color each.
   3. Brand-specific components (bead sliders, record lines,
      the vermilion stop) live at the bottom, namespaced.

   Rules encoded here, from the brand book:
   - No venture ever uses another venture's color.
   - Tints of ink are free to all.
   - Gold is never running text. Vermilion is never small text.
   - The agate line appears at the foot of every page.
   ============================================================ */

/* ------------------------------------------------------------
   1 · SHARED TOKENS
   ------------------------------------------------------------ */
:root {
  /* Surfaces — the paper system */
  --paper:        #F1EDE3;   /* page background, all ventures */
  --card:         #FFFDF6;   /* raised panels, inputs, tables */
  --shelf:        #F8F5EE;   /* covers, secondary panels */
  --line:         #DDD7C8;   /* hairline borders, dividers */

  /* Ink — tints are free to all */
  --ink:          #1B1B19;   /* text, marks, strong borders */
  --ink-80:       #3D3B35;   /* body text on paper */
  --ink-60:       #6E6A5E;   /* secondary text, captions */
  --ink-40:       #8A8578;   /* labels, eyebrows, disabled */

  /* Dark surfaces — Agate's registers, usable by all for footers */
  --dark:         #1B1B19;
  --dark-raised:  #24231F;
  --dark-line:    #3A3833;
  --dark-text:    #F1EDE3;
  --dark-text-2:  #B9B4A6;
  --dark-text-3:  #8A8578;

  /* Accent — overridden per brand; defaults to Agate oxblood */
  --accent:       #8C4A3C;
  --accent-text:  #8C4A3C;   /* contrast-safe variant for small text */
  --on-accent:    #F1EDE3;   /* text placed on accent fills */

  /* Type — two faces, all tiers */
  --font-ui:      Helvetica, "Helvetica Neue", Arial, sans-serif;
  --font-serif:   "Source Serif 4", Georgia, serif;
  --font-agate:   Georgia, serif;   /* the agate line only */

  /* Type scale — Helvetica for headlines/numbers/UI, serif for argument */
  --fs-display:   clamp(38px, 5vw, 64px);
  --fs-h1:        clamp(28px, 3.5vw, 38px);
  --fs-h2:        26px;
  --fs-h3:        20px;
  --fs-body:      17px;      /* serif body */
  --fs-ui:        14px;      /* controls, tables, nav */
  --fs-caption:   12px;
  --fs-label:     10px;      /* letterspaced eyebrows */
  --fs-agate:     7.5px;     /* genuine agate size — never enlarged */

  --lh-body:      1.75;
  --lh-tight:     1.2;

  --track-label:  3px;
  --track-agate:  1.5px;

  /* Space — an 8px base with generous editorial gaps */
  --sp-1: 4px;  --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px;  --sp-7: 48px;  --sp-8: 70px;
  --gutter: clamp(24px, 6vw, 90px);
  --measure: 62ch;

  /* Shape — the house has square corners. Radius exists only
     for beads, dots, and seals, which are circles. */
  --radius: 0;

  /* Motion — the family is calm. One easing, short durations,
     and almost nothing moves. */
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --t-fast: 120ms;
  --t-base: 200ms;

  /* Focus — ink ring offset on paper, readable on every surface */
  --focus-ring: 2px solid var(--ink);
  --focus-offset: 2px;
}

/* ------------------------------------------------------------
   2 · BRAND SWITCHES
   Apply data-brand to <html>, <body>, or any subtree.
   ------------------------------------------------------------ */

[data-brand="agate"] {          /* the holding partnership */
  --accent: #8C4A3C;            /* oxblood — mark core & initial caps only */
  --accent-text: #8C4A3C;
  --on-accent: #F1EDE3;
}

[data-brand="il-research"] {    /* the think tank */
  --accent: #D6552B;            /* vermilion — the full stop */
  --accent-text: #A93F1D;       /* darkened for text under 18px */
  --on-accent: #F1EDE3;
}

[data-brand="illumine"] {       /* the friendly one */
  --accent: #F5B82E;            /* marigold — fills and the sun, NEVER text */
  --accent-text: #8A6210;       /* darkened for the rare unavoidable yellow-family numeral */
  --on-accent: #1B1B19;         /* ink sits on marigold, not paper */

  /* ILLUMINE-ONLY SURFACE EXCEPTION — sanctioned, not drift.
     The consumer product earns a brighter field; the professional/institutional
     ventures keep the shared house cream (#F1EDE3). Scoped to this selector so
     the rest of the family is untouched. 60/30/10: soft-white field (60),
     cream as the intentional warm surface (30), marigold accent (10). */
  --paper: #FCFBF8;             /* soft-white field — brighter than cream, not clinical */
  --card:  #FFFFFF;             /* pure white; raised = brighter, since the house has no shadows */
  --warm:  #F1EDE3;             /* the old paper, demoted to the deliberate warm panel */
  --warm-line: #E4DFD3;         /* hairline that reads on both white and warm */
}

[data-brand="publishing"] {     /* the imprint */
  --accent: #6E1F26;            /* oxblood leather — bands, seal, series marks */
  --accent-text: #6E1F26;
  --on-accent: #F8F5EE;         /* book cream on leather */
}

[data-brand="advantage"] {      /* ADV-antage AI */
  --accent: #2F4C8A;            /* cobalt — the model's color */
  --accent-text: #2F4C8A;
  --on-accent: #F1EDE3;
}

[data-brand="wealthlayer"] {
  --accent: #3E7256;            /* verdigris — user inputs */
  --accent-text: #3E7256;
  --on-accent: #F1EDE3;
}

[data-brand="ledgerworks"] {
  --accent: #2E5266;            /* registrar's blue-black */
  --accent-text: #2E5266;
  --on-accent: #F1EDE3;
}

/* ------------------------------------------------------------
   3 · BASE
   ------------------------------------------------------------ */

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-80);
  font-family: var(--font-serif);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-feature-settings: "onum" 0;
}

/* Dark register — Agate's home, everyone's footer */
.surface-dark {
  background: var(--dark);
  color: var(--dark-text-2);
}
.surface-dark :is(h1, h2, h3, h4, strong) { color: var(--dark-text); }
.surface-dark .rule { border-color: var(--dark-line); }

h1, h2, h3, h4 {
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--ink);
  line-height: var(--lh-tight);
  letter-spacing: -0.5px;
  margin: 0 0 var(--sp-4);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.3px; }

/* Editorial display heads (essay titles, chapter openers) are serif */
.display {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 1.08;
  letter-spacing: 0;
  color: var(--ink);
  max-width: 20ch;
}

p { max-width: var(--measure); margin: 0 0 var(--sp-4); }

a {
  color: var(--accent-text);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease);
}
a:hover { color: var(--ink); }

strong { color: var(--ink); font-weight: 600; }

/* Numbers are always Helvetica, always tabular — box-score discipline */
.num, td.num, .stat {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}

/* The eyebrow — letterspaced label above sections */
.eyebrow {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  font-weight: 400;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-40);
  margin-bottom: var(--sp-4);
}

.rule { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }

::selection { background: var(--accent); color: var(--on-accent); }

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}
.surface-dark :focus-visible { outline-color: var(--dark-text); }

/* ------------------------------------------------------------
   4 · LAYOUT
   ------------------------------------------------------------ */

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: var(--sp-7) var(--gutter) 120px;
}

.section {
  background: var(--paper);
  padding: var(--sp-8) var(--gutter);
}

/* The book's signature two-column argument: statement left, evidence right */
.split {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: clamp(28px, 5vw, 60px);
  align-items: start;
}
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------
   5 · COMPONENTS
   ------------------------------------------------------------ */

/* Card — the raised paper panel */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  padding: var(--sp-5) var(--sp-6);
}

/* Buttons — Helvetica, square, quiet. The accent is spent, not sprayed:
   one primary action per view. */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 12px 22px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }

.btn--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.btn--primary:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.btn--accent {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn--accent:hover { background: var(--ink); border-color: var(--ink); color: var(--paper); }

.btn:disabled {
  border-color: var(--line);
  color: var(--ink-40);
  background: transparent;
  cursor: not-allowed;
}

/* Inputs — a form is fine print the client fills in; keep it honest */
.field { display: flex; flex-direction: column; gap: 6px; max-width: 46ch; }

.field label {
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  font-weight: 700;
  color: var(--ink);
}

.field .hint { font-size: var(--fs-caption); color: var(--ink-60); font-family: var(--font-ui); }

.input, select.input, textarea.input {
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  padding: 11px 14px;
  transition: border-color var(--t-fast) var(--ease);
}
.input:hover { border-color: var(--ink-40); }
.input:focus { border-color: var(--ink); outline: none; }
.input::placeholder { color: var(--ink-40); }

.field .error {
  font-family: var(--font-ui);
  font-size: var(--fs-caption);
  color: var(--ink);
}
.field.has-error .input { border-color: var(--accent); border-width: 2px; }

/* Tables — actuarial discipline: hairlines, tabular numbers, no zebra */
.table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  background: var(--card);
  border: 1px solid var(--line);
}
.table th {
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  font-weight: 400;
  color: var(--ink-40);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--ink);
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-80);
}
.table td.num { text-align: right; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td {
  border-top: 3px double var(--ink);   /* the double rule: a figure is final */
  font-weight: 700;
  color: var(--ink);
}

/* Nav — wordmark left, few links, no chrome */
.nav {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-5);
  padding: var(--sp-5) var(--gutter);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-ui);
}
.nav a { text-decoration: none; font-size: var(--fs-ui); color: var(--ink-60); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); }
.nav .wordmark { font-weight: 700; font-size: 20px; letter-spacing: -0.5px; color: var(--ink); }

/* Findings / callout — where the accent is spent */
.finding {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--card);
  padding: var(--sp-4) var(--sp-5);
}
.finding .eyebrow { color: var(--accent-text); margin-bottom: var(--sp-2); }

/* The agate line — the foot of every page, deck, report, or screen.
   Genuine agate size. Never enlarged. Never a link. */
.agate-line {
  border-top: 1px solid var(--line);
  margin-top: var(--sp-7);
  padding: var(--sp-3) var(--gutter);
  font-family: var(--font-agate);
  font-size: var(--fs-agate);
  letter-spacing: var(--track-agate);
  color: var(--ink-40);
  text-transform: uppercase;
}
.surface-dark .agate-line { border-color: var(--dark-line); color: var(--dark-text-3); }

/* ------------------------------------------------------------
   6 · MOTION
   The family budget: one transition speed for hovers, and one
   named entrance per product (Illumine's pulse). Nothing loops.
   ------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
  }
}

/* ------------------------------------------------------------
   7 · VENTURE-SPECIFIC COMPONENTS
   ------------------------------------------------------------ */

/* --- IL Research: the full stop ------------------------------
   The period is the brand. It closes headlines, marks active
   nav items, bullets lists, and plots chart points. */
.il-stop { color: var(--accent); }               /* append inside a heading: <span class="il-stop">.</span> */

.il-list { list-style: none; padding: 0; margin: 0 0 var(--sp-4); }
.il-list li {
  padding-left: 1.1em;
  position: relative;
  margin-bottom: var(--sp-2);
}
.il-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.62em;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.nav a[aria-current="page"].il-current::after {
  content: ".";
  color: var(--accent);
  font-weight: 700;
}

/* --- Illumine: the pulse -------------------------------------
   Fires ONCE when an answer arrives. Add .is-arriving via JS,
   remove on animationend. The sun's rays breathe a single time. */
@keyframes illumine-pulse {
  0%   { transform: scale(1);    opacity: 1; }
  40%  { transform: scale(1.12); opacity: 0.85; }
  100% { transform: scale(1);    opacity: 1; }
}
.illumine-sun.is-arriving { animation: illumine-pulse 700ms var(--ease) 1; transform-origin: center; }

/* Marigold is a fill, never a letterform */
.illumine-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--accent);
  color: var(--on-accent);          /* ink on marigold */
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: var(--fs-caption);
  padding: 5px 12px;
}

/* The warm panel — cream's demoted role on the soft-white field.
   For hero bands, callouts, the arrived-state: warmth used on purpose. */
.illumine-warm {
  background: var(--warm);
  border: 1px solid var(--warm-line);
}

/* Disc-backed sun — for a FUNCTIONAL sun on a light field (status, control,
   meaningful icon), where a bare marigold sun would sit below 3:1. The disc
   carries the contrast; the sun stays pure inside it (no keyline on the mark).
   Decorative suns and the logo don't need this. On dark fields the bare sun is
   fine (marigold ~10:1 there), so the disc is a light-field device. */
.illumine-sun-disc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  aspect-ratio: 1;
}
.illumine-sun-disc--cream {           /* soft warm reading */
  background: var(--warm);
  border: 1px solid var(--warm-line);
}
.illumine-sun-disc--ink {             /* confident, lamp-switched-on reading */
  background: var(--ink);
}
.illumine-sun-disc > svg { width: 62%; height: 62%; }

/* --- IL Research Publishing: bands and the seal --------------- */
.pub-cover {
  background: var(--shelf);
  border: 1px solid var(--line);
  display: flex;
}
.pub-cover .band-spine { width: 9px; background: var(--accent); flex: none; }   /* Library */
.pub-cover--papers { flex-direction: column; }
.pub-cover--papers .band-top {
  height: 22px; background: var(--accent); flex: none;
  display: flex; align-items: center; padding: 0 10px;
  color: var(--on-accent);
  font-family: var(--font-ui); font-size: 7px; letter-spacing: 1.5px;
}
/* The seal never scales below 16px — legibility floor */
.ilr-seal { width: 16px; min-width: 16px; }
.ilr-seal--display { width: 108px; }

/* --- ADV-antage: human then machine ---------------------------
   Cobalt marks what the model produced; ink marks the human's.
   The chevron pair is the working/progress glyph. */
.adv-model {                       /* wraps model-generated content */
  border-left: 3px solid var(--accent);
  padding-left: var(--sp-4);
}
.adv-model .source-tag {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-text);
}
@keyframes adv-step {
  0%, 100% { opacity: 0.25; }
  50%      { opacity: 1; }
}
.adv-working span { display: inline-block; animation: adv-step 900ms var(--ease) infinite; }
.adv-working span:nth-child(2) { animation-delay: 150ms; color: var(--accent); }

/* --- WealthLayer: beads on rods --------------------------------
   Every slider is the logo doing its job. Green beads are inputs
   the user moves; ink is what the math returns. */
.wl-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  background: var(--ink);            /* the rod */
  outline-offset: 6px;
  cursor: pointer;
}
.wl-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);         /* the bead */
  border: none;
  transition: transform var(--t-fast) var(--ease);
}
.wl-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }
.wl-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}
.wl-slider::-moz-range-track { height: 5px; background: var(--ink); }

.wl-input  { color: var(--accent-text); }   /* value the user set */
.wl-output {                                 /* value the math returned */
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}

/* --- LedgerWorks: the Record line and the Study line -----------
   Record = what the page printed. Full ink, wears the seal.
   Study = what we estimated. Visibly quarantined, never dressed
   as fact. Absence of the seal means computed. */
.lw-record {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--ink);
}
.lw-cite {
  font-family: var(--font-ui);
  font-size: var(--fs-label);
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-text);        /* the countersignature ink */
  white-space: nowrap;
}
.lw-study {
  font-family: var(--font-ui);
  font-variant-numeric: tabular-nums;
  font-weight: 400;                  /* never bold — estimates don't shout */
  font-style: italic;
  color: var(--ink-60);
  background: repeating-linear-gradient(
    -45deg,
    transparent 0 6px,
    color-mix(in srgb, var(--ink) 5%, transparent) 6px 7px
  );
  padding: 0 4px;
}
.lw-study::after {
  content: " est.";
  font-size: 0.75em;
  letter-spacing: 1px;
}
.lw-final td, .lw-final {
  border-top: 3px double var(--ink); /* the double rule — a figure is final */
}

/* --- Agate: the annual letter ----------------------------------
   Oxblood initial capitals; serif; dark or paper. The parent has
   no product UI — this is the only pattern it owns. */
.agate-letter { font-family: var(--font-serif); font-size: 19px; line-height: 1.8; max-width: var(--measure); }
.agate-letter > p:first-of-type::first-letter {
  font-size: 3.4em;
  line-height: 0.85;
  float: left;
  padding: 4px 10px 0 0;
  color: var(--accent);              /* oxblood — its only appearance in text */
  font-weight: 500;
}
