/* System style: the page coloured with the ArchUI system tokens (archui-system.css).
 *
 * Everything here is scoped to html.style-system, which the dev menu's Style
 * switch toggles. Without the class the page is exactly the unstyled wireframe
 * (browser colours), so this file can change freely while we review.
 *
 * Tokens resolve with light-dark(): the page's light and dark themes get the
 * matching ArchUI values. The CTA banner is forced to the light scheme, so it
 * stays the same (total black) in both themes.
 *
 * Map (light values):
 *   Ink        headings sys-txt-dark #061e4d · body and descriptions sys-txt-gray-dark #424b5f
 *              notes and labels sys-txt-secondary #2855ad · links sys-txt-primary #173e88
 *              index numbers sys-txt-tertiary #3561b9
 *   Surfaces   chrome (ruler, navbar, breadcrumbs, footer) sys-bg-white #fff · sections alternate:
 *              even numbers sys-bg-white, odd sys-bg-primary #f5f8fd, all grained · drafting table sys-bg-primary, hatched
 *              image placeholders sys-bg-secondary #e9f1ff · hover sys-bg-tertiary #c7d1eb
 *   Lines      neutral greys, each the same OKLCH lightness as the ArchUI blue it replaces:
 *              hairlines and hatch --brd-hair #cfcfcf (was sys-brd-gray-light #c2d0ea)
 *              rails and + markers --brd-mark #929292 (was sys-brd-tertiary #6b92d3)
 *              controls --brd-ui #5a5a5a (was sys-brd-primary #2855ad)
 *              high contrast --brd-strong #222 (was sys-txt-dark #061e4d)
 *              Focus rings, the nav underline and the carousel timer stay blue.
 *   Banner     #000 (total black), sys-txt-light #e7edff
 */

/* --- Line roles and ink ------------------------------------------------- */
html.style-system {
  /* Border greys: neutral stand-ins for the ArchUI blues, lightness-matched
     in both themes (dark values match the dark-theme blues). */
  /* dark hairline: a subtle grey above the dark surfaces (#2c2c2c, #202020), about
     1.6:1 like the light one on white; ArchUI's #242424 sat below them and read black */
  --brd-hair: light-dark(#cfcfcf, #4a4a4a);
  --brd-mark: light-dark(#929292, #737373);
  --brd-ui: light-dark(#5a5a5a, #d2d2d2);
  --brd-strong: light-dark(#222222, #f2f2f2);
  --line: var(--brd-hair);
  --mark: var(--brd-mark);
  --hatch: var(--brd-hair);
  --line-ui: var(--brd-ui);
  --rail: var(--brd-mark);
  --ink-heading: var(--sys-txt-dark);
  --ink-body: var(--sys-txt-gray-dark);
  --ink-note: var(--sys-txt-secondary);
  --ink-link: var(--sys-txt-primary);
  --ink-index: var(--sys-txt-tertiary);
  --focus: var(--sys-brd-primary);
  --corner-mark: var(--sys-icon-secondary);                /* section-corner icon */
  --nav-ink: var(--sys-txt-secondary);                     /* footer links at rest */
  --nav-ink-strong: var(--sys-txt-dark);                   /* hover, press, current */
  --nav-bar: var(--sys-brd-primary);
  --timer-ink: var(--sys-brd-primary);                     /* carousel timer line: blue */
  --dot-idle: var(--arch-gray-8);                          /* carousel picker, unselected: grey #828eac */
  /* Buttons: primary is the strongest ink on the page colour (navy / pale in
     dark), so it passes contrast in both themes; secondary is outlined. */
  --btn-primary-bg: var(--studio-orange);    --btn-primary-fg: #000;   /* studio orange #E15E06 (not an ArchUI token); black text 5.8:1 */
  --btn-secondary-bg: var(--sys-txt-dark);    --btn-secondary-fg: var(--sys-bg-primary);
  --btn-tertiary-bg: transparent;            /* sits on white or tinted sections alike */  --btn-tertiary-fg: var(--sys-txt-dark);
  --btn-tertiary-brd: var(--brd-ui);
  --btn-ghost-fg: var(--sys-txt-dark);
  --btn-hover-tint: var(--sys-bg-tertiary);
  --btn-ring: color-mix(in srgb, var(--sys-brd-primary) 50%, transparent);
  /* Paper: the colour under the grain where nothing else sets one. */
  --paper: var(--surface-table);
  /* Grain: fractal noise pushed to near-black and near-white specks at 5%
     opacity. Dark specks read on the light paper, light specks on the dark one,
     so one texture serves both themes. Tiles seamlessly (stitchTiles). */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g' x='0' y='0' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='3 0 0 0 -1 3 0 0 0 -1 3 0 0 0 -1 0 0 0 0 0.05'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}
/* Site settings keep working on top: high contrast strengthens */
html.style-system.hc {
  --line: var(--brd-mark); --mark: var(--brd-strong); --line-ui: var(--brd-strong);
  --hatch: var(--brd-mark); --rail: var(--brd-strong); --ink-body: var(--sys-txt-dark);
  --ink-note: var(--sys-txt-primary);
}

/* --- Surfaces ------------------------------------------------------------ */
/* Two roles: the sheet (chrome, even sections, cards) and the table (the hatched
 * side margins, odd sections). Light: sheet white, table pale blue. Dark: swapped,
 * so the sheet is the darker #202020 and the margins the lighter #2c2c2c. */
html.style-system {
  --surface-sheet: light-dark(var(--sys-bg-white), var(--sys-bg-primary));
  --surface-table: light-dark(var(--sys-bg-primary), var(--sys-bg-white));
}
html.style-system body { background: var(--surface-table); color: var(--ink-body); }
html.style-system .bp-page { background-color: var(--surface-table); }          /* drafting table, under the hatch */
html.style-system .bp-grid { border-inline-color: var(--rail); }
/* Grained surfaces. The page chrome (ruler, navbar, breadcrumbs, footer, and
   what opens from them) is always white; the sections alternate by number:
   even (00 Hero, 02, 04, 06) white, odd (01, 03, 05) sys-bg-primary. Section
   00 is main's first child, so nth-of-type(odd) is the even numbers. */
html.style-system { --chrome: var(--surface-sheet); --sec-even: var(--surface-sheet); --sec-odd: var(--surface-table); }
html.style-system :is(.bp-grid, .ruler, .crumbs, #site-header, .settings-panel, .bp-grid > footer),
html.style-system.js #site-nav { background: var(--grain) 0 0 / 240px 240px repeat, var(--chrome); }
html.style-system main > section:nth-of-type(odd)  { background: var(--grain) 0 0 / 240px 240px repeat, var(--sec-even); }
html.style-system main > section:nth-of-type(even) { background: var(--grain) 0 0 / 240px 240px repeat, var(--sec-odd); }
html.style-system .ix-layer > svg.ix-corner { background: var(--chrome); }
/* the person card sits on the section as a white sheet of its own */
html.style-system { --card-bg: var(--surface-sheet); }
html.style-system { --ruler-ink: var(--brd-mark); }        /* ruler letters: light grey, decoration */
/* technology logos: fill sys-icon-tertiary #2855ad, lines sys-icon-secondary #173e88;
   the label and the names in grey (--brd-ui #5a5a5a, dark #d2d2d2) */
html.style-system { --logo-fill: var(--sys-icon-tertiary); --logo-ink: var(--sys-icon-secondary); --logo-label: var(--brd-ui); }
html.style-system .proof .proof-label { color: var(--logo-label); }
html.style-system { --hairline: var(--brd-hair); --sp-control: var(--brd-mark); }         /* the grid's grey for lines that stay when grid lines are hidden */
html.style-system { --band-line: color-mix(in srgb, var(--brd-mark) 50%, var(--brd-hair)); }  /* column band edges: a notch lighter grey (#b1b1b1; dark #4c4c4c), dashed 4/4 */
html.style-system .ruler li:hover { background-color: var(--band-tint); color: var(--ink-heading); }

/* --- Text ------------------------------------------------------------------ */
html.style-system :is(h1, h2, h3) { color: var(--ink-heading); }
html.style-system .desc { color: var(--ink-body); }
html.style-system :is(.note, .meta, .proj-facts dt, .facts dt) { color: var(--ink-note); }
html.style-system .proj-facts dt { opacity: 1; }
html.style-system .idx { color: var(--ink-index); }
html.style-system a:not(.btn) { color: var(--ink-link); }
html.style-system :is(.hdr .brand, .foot-brand) { color: var(--ink-heading); }   /* navbar mark and wordmark: the hero heading ink */
html.style-system :is(.foot-col, .foot-end) a:not(.foot-brand) { color: var(--nav-ink); }
html.style-system :is(.foot-col, .foot-end) a:not(.foot-brand):hover { color: var(--nav-ink-strong); }
html.style-system :focus-visible { outline-color: var(--focus); }
/* Navbar links: a higher-contrast blue than the footer's. Light sys-txt-primary
   #173e88; dark arch-blue-4 #acd8fc (the light end of the dark blues). */
html.style-system :is(#site-nav, .git-switch) { --nav-ink: light-dark(var(--sys-txt-primary), var(--arch-blue-4)); }

/* --- Controls: outlined in grey, tinted on hover ---------------------------- */
html.style-system .nav-cta { color: var(--sys-brd-primary); border-color: var(--brd-ui); }
html.style-system .nav-cta:hover { background: var(--sys-bg-tertiary); }
html.style-system .faq-tabs [role="tab"][aria-selected="true"] { color: var(--ink-heading);
  background: color-mix(in srgb, var(--sys-brd-primary) 12%, transparent);
  box-shadow: inset 3px 0 0 var(--sys-brd-primary); }     /* blue tint and leading bar: clear in both themes */
html.style-system .faq-tabs [role="tab"]:not([aria-selected="true"]):hover { background: var(--sys-bg-primary); }
html.style-system .card-media { background: repeating-linear-gradient(45deg, var(--hatch) 0 var(--stroke),
  transparent var(--stroke) var(--hatch-gap)) var(--sys-bg-secondary); }
html.style-system .seg-opt input:checked + .seg-face,
html.style-system .sp-switch input:checked { background: var(--sys-bg-blueprint); color: var(--sys-txt-light); }
html.style-system .sp-switch input:checked::before { background: var(--sys-txt-light); }
html.style-system :is(.seg-opt input, .sp-switch input):focus-visible + .seg-face,
html.style-system .sp-switch input:focus-visible { outline-color: var(--focus); }

/* --- CTA banner: total black, in both themes --------------------------------- */
html.style-system .banner-cell {
  color-scheme: light;                                     /* light values: pale ink */
  --banner-bg: #000;                                       /* total black (was sys-bg-blueprint navy) */
  background: var(--banner-bg); color: var(--sys-txt-light);
  --line: color-mix(in srgb, var(--sys-txt-light) 22%, transparent);
  --floor-ink: var(--sys-brd-tertiary);                    /* projection lines and horizon: light blue */
  --floor-accent: var(--sys-txt-light);                    /* the square floor: white */
  --ink-heading: var(--sys-txt-light); --ink-body: var(--sys-txt-light);
  --ink-index: var(--sys-brd-tertiary); --focus: var(--sys-txt-light);
}
html.style-system .banner-cell .desc { color: color-mix(in srgb, var(--sys-txt-light) 80%, transparent); }
html.style-system .banner-cell .cta a { background: var(--sys-txt-light); color: var(--banner-bg);
  border-color: var(--sys-txt-light); }
html.style-system .banner-cell .cta a:hover { background: transparent; color: var(--sys-txt-light); }
html.style-system .banner-cell .cta a:focus-visible { outline-color: var(--sys-txt-light); }
