/* ============================================================================
   Cortexia main landing page - committed design tokens (theme-factory pass)
   2026-07-20. Apple-esque light system, formalised from Jacob's endorsed
   reference template (cortexia_main). This is a deliberate, brief-specific
   theme, NOT a swapped preset: white/near-white surfaces, one restrained
   Apple-blue accent that carries meaning (the machine is working / a link to
   act), SF system type, soft grey depth instead of glow. British English.
   Imported by index.html <link> before the inline stylesheet; the whole page
   derives colour, type, radius, motion and rhythm from these variables.
   ============================================================================ */
:root {
  /* ---- Surfaces ---- */
  --surface-primary: #ffffff;
  --surface-secondary: #f5f5f7;
  --surface-dark: #1d1d1f;      /* the single dark section: the device moment */
  --surface-dark-alt: #2d2d2f;

  /* ---- Ink ---- */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;
  --text-inverse: #f5f5f7;

  /* ---- Accent (Apple blue, meaning-bearing) ---- */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-deep: #0058b0;
  --accent-subtle: rgba(0, 113, 227, 0.08);
  --accent-glow: rgba(0, 113, 227, 0.16);

  /* ---- Lines ---- */
  --border-light: #d2d2d7;
  --border-faint: rgba(0, 0, 0, 0.04);
  --hairline: rgba(0, 0, 0, 0.06);

  /* ---- Status ---- */
  --status-good: #34c759;
  --status-warn: #ff9f0a;

  /* ---- Depth (soft greys, never glow) ---- */
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.08);
  --shadow-xl: 0 20px 60px rgba(0,0,0,0.10);
  --shadow-device: 0 8px 40px rgba(0,0,0,0.10), 0 44px 90px -38px rgba(0,0,0,0.55);

  /* ---- Radius ---- */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 980px;
  --radius-device: 44px;

  /* ---- Type ---- */
  --font-system: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, monospace;

  /* ---- Motion (ease-out only, no bounce, no elastic) ---- */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-apple: cubic-bezier(0.4, 0, 0, 1);
  --dur-fast: 200ms;
  --dur-normal: 400ms;
  --dur-slow: 700ms;

  /* ---- Rhythm ---- */
  --wrap: 1060px;
  --wrap-wide: 1180px;
  --gut: clamp(1.25rem, 4vw, 3rem);
  --section-pad: clamp(80px, 12vw, 160px);

  /* ---- Canvas graph palette (r,g,b triplets read by makeGraph) ---- */
  --g-signal: 0,113,227;
  --g-ember: 255,159,10;
  --g-line: 142,142,147;

  /* ---- Hero wordmark (dark hero band only) ----
     Sourced verbatim from the endorsed standalone build's Nightfield tokens
     (agent_outputs/cortexia_hero/cortexia_hero_original_tuned.html): the
     wordmark reads near-white (--peak) and the accented X carries the engine's
     warm "signal" colour (--amber, the same amber the wave sparks the X to at
     each peak). Kept as the exact oklch values so this hero matches Jacob's
     reference screenshot of that standalone build. */
  --hero-wordmark-ink: oklch(0.96 0.020 240);
  --hero-x-accent: oklch(0.83 0.130 78);
  --hero-x-glow: oklch(0.83 0.130 78 / 0.30);

  /* ==========================================================================
     REBUILD 2026-07-31, "Ledger Rule" theme extension (theme-factory pass).
     A custom extension, NOT a preset swap: none of the stock decks fit a page
     whose visual system is already pinned. Every value below is derived from
     the existing scale above (same blue, same greys, same easing) so the new
     sections read as the same product. No existing token value is changed.

     The device: this product reports in one-line receipts, so the structural
     unit for every new section is a RECEIPT ROW: hairline rule, mono micro-
     label left, tabular figure right. It encodes what the thing actually does
     rather than decorating around it.
     ========================================================================== */

  /* ---- Ledger rows (value math, comparison rows, slider receipt) ---- */
  --ledger-rule: rgba(0, 0, 0, 0.08);          /* the hairline itself */
  --ledger-rule-strong: rgba(0, 0, 0, 0.14);   /* section-closing rule */
  --ledger-label: var(--text-secondary);       /* mono micro-label, left (AA on all surfaces) */
  --ledger-figure: var(--text-primary);        /* tabular figure, right */
  --ledger-struck: rgba(29, 29, 31, 0.66);     /* a role being replaced (0.38 failed AA) */
  --ledger-row-h: 3.25rem;                     /* one row of the ledger */

  /* Money and counted figures share one treatment everywhere on the page. */
  --figure-track: -0.035em;
  --figure-weight: 640;

  /* ---- Premium slider (cost section) ---- */
  --slider-track: #e8e8ed;                     /* unfilled rail */
  --slider-fill: var(--accent);                /* accrued value */
  --slider-fill-soft: rgba(0, 113, 227, 0.16); /* the stepped bars behind */
  --slider-thumb: #ffffff;
  --slider-thumb-ring: rgba(0, 0, 0, 0.10);
  --slider-thumb-shadow: 0 1px 2px rgba(0,0,0,0.10), 0 6px 16px rgba(0,0,0,0.14);
  --slider-h: 6px;                             /* rail thickness */
  --slider-thumb-d: 30px;                      /* >=44px hit area via padding */

  /* ---- Comparison table ---- */
  --cmp-rule: rgba(0, 0, 0, 0.07);
  --cmp-col-bg: var(--surface-primary);
  --cmp-win-bg: #ffffff;
  --cmp-win-ring: rgba(0, 113, 227, 0.28);     /* the drawn border on the winner */
  /* Neutral grey depth, not a coloured glow. The house rule at the top of this
     file is explicit about it ("soft grey depth, never glow") and a tinted
     shadow behind the one column we are selling reads as a sales device. */
  --cmp-win-lift: 0 12px 44px rgba(0,0,0,0.07), 0 2px 8px rgba(0,0,0,0.04);
  --cmp-quiet: var(--text-secondary);          /* the two non-winner columns */

  /* ---- Trust spine (draw-on-scroll) ---- */
  --spine-line: rgba(0, 0, 0, 0.09);
  --spine-line-lit: var(--accent);
  --spine-node: #ffffff;
  --spine-node-ring: var(--border-light);
  --spine-draw-dur: 900ms;                     /* icon stroke draw */

  /* ---- Boundary semantics ----
     Amber already carries "waits for you" in the hero X. Reuse it, do not
     introduce a second warning hue. */
  --gate-ink: #8f5400;                         /* darkened from #b26a00, which was 3.6:1 on the amber tint */
  --gate-bg: rgba(255, 159, 10, 0.10);
  --gate-rule: rgba(255, 159, 10, 0.34);
  --auto-ink: #1a7f37;
  --auto-bg: rgba(52, 199, 89, 0.10);
  --auto-rule: rgba(52, 199, 89, 0.32);

  /* ==========================================================================
     REBUILD 2 additions (2026-07-31). Two new devices, both derived from the
     scale above so they read as the same product. No existing token changed.
     ========================================================================== */

  /* ---- Cost divergence plot (the slider, rebuilt as two diverging lines) ----
     The section's whole argument is that one line climbs while the other stays
     flat. So the chart, not a bar, is the control. Colours come straight from
     the existing accent and grey ramp. */
  --plot-worth: var(--accent);                 /* the climbing "what it is worth" line */
  --plot-worth-soft: rgba(0, 113, 227, 0.12);  /* the leverage gap, shaded as it fills */
  --plot-price: #8e8e93;                        /* the flat "what you pay" line, calm grey */
  --plot-price-dot: #6e6e73;
  --plot-grid: rgba(0, 0, 0, 0.05);            /* faint value gridlines */
  --plot-guide: rgba(0, 113, 227, 0.30);       /* the plumb line under the handle */

  /* ---- Metered-vs-flat range (the API cost section) ----
     A spend AXIS, not a ledger: metered use is a wide uncertain band, the flat
     fee is a single fixed pin. The right tail runs into amber, which already
     means "careful, this waits on a condition" everywhere else on the page, so
     it reads as risk without inventing a new hue. */
  --meter-band-lo: rgba(0, 113, 227, 0.14);    /* calm, cheap left end */
  --meter-band-hi: rgba(255, 159, 10, 0.30);   /* the costly, uncertain right tail */
  --meter-tail-ink: #8f5400;                    /* AA amber ink, shared with the gate */
  --meter-axis: rgba(0, 0, 0, 0.14);
  --meter-tick: var(--text-secondary);
  --meter-pin: var(--accent);                   /* the flat fee, one fixed point */

  /* ==========================================================================
     REBUILD 3 additions (2026-07-31). Two interactive instruments, kept in the
     same scale (same blue, same amber, same grey ramp, same easing) so they
     read as one product. No existing token value is changed.
     ========================================================================== */

  /* ---- Odometer worth counter (cost slider) ----
     Mechanical reels that roll as the worth figure climbs. The blur cap is the
     motion smear while a reel spins; it scales with drag speed in JS. */
  --odo-ink: var(--accent-deep);
  --odo-blur-max: 2.2px;
  --odo-roll-dur: 460ms;

  /* ---- Tactile slider groove (shared by both sliders) ----
     A recessed rail so the raised knob reads as a physical control, not a
     painted line. */
  --tslider-groove: #e6e6ec;
  --tslider-groove-in: rgba(0, 0, 0, 0.10);
  --tslider-fill: var(--accent);
  /* Detent rail (the #costs track has NO growing fill; it is a machined rail
     with stops the knob clicks between, so it never reads as a level meter). */
  --detent-tick: rgba(0, 0, 0, 0.17);
  --odo-seam: rgba(0, 0, 0, 0.11);
  --odo-window: rgba(0, 0, 0, 0.17);

  /* ---- Climbing gauge (api cost) ----
     Calm blue at the cheap left, amber at the costly right (the same amber that
     means "careful, this waits on a condition" everywhere else on the page). The
     metered figure turns amber once it passes the flat reference. */
  --gauge-lo: var(--accent);
  --gauge-hi: var(--status-warn);
  --gauge-track: #ececf1;
  --gauge-ref: var(--text-primary);
  --gauge-fig-hi: var(--gate-ink);
}
