/* ============================================================
   SEMICO.AI — Shared Design System
   Premium executive enterprise UI · dark silicon theme
   Every page loads this file. Page-specific styles live in
   assets/css/<page>.css and may ONLY add, never redefine tokens.
   ============================================================ */

/* ---------- 1. Design tokens ---------- */
/* v2 THEME: light "silicon sand" page (chips begin as sand) with DARK
   component islands — header, menus, cards, demo chrome stay deep navy so
   every box reads as a die sitting on the sand substrate.
   The island re-scope lives in §1b (.di) — components listed there flip the
   ink/glass tokens back to the dark palette. Page-level text is dark ink. */
:root {
  /* Page plane (textured sand — see body background) */
  --bg-page: #f2ecdf;
  --bg-deep: #e9e0cc;        /* deeper sand band (alternating sections) */

  /* Dark island surfaces (cards, menus, demo bars — unchanged from v1) */
  --surface-1: #0d1526;      /* island panel */
  --surface-2: #101a2c;      /* card / chart surface */
  --surface-3: #16233b;      /* raised card / hover */

  /* Contextual tokens — LIGHT values here; .di re-scopes them dark */
  --glass: rgba(36, 31, 22, 0.05);
  --glass-strong: rgba(36, 31, 22, 0.09);
  --glass-border: rgba(36, 31, 22, 0.16);
  --hairline: rgba(36, 31, 22, 0.13);

  /* Ink on sand (13.9:1 / 7.4:1 / 5.0:1) */
  --ink: #241f16;
  --ink-2: #554a38;
  --ink-3: #6f6350;

  /* Accents on sand */
  --link: #0b66a3;           /* 5.2:1 on sand */
  --copper: #8a4517;         /* kickers, warm accents — 6.1:1 */
  --kicker-c: var(--copper);
  --focus-c: #0b66a3;
  --grad-text: linear-gradient(100deg, #8a4517 0%, #a67420 100%); /* copper→bronze */

  /* Suite colors deepened for use ON SAND (≥4.5:1) — the bright originals
     in products.js remain correct inside dark islands */
  --sand-engineering: #5d4fc0;
  --sand-manufacturing: #1a6ab8;
  --sand-equipment: #8f5f00;
  --sand-supply-chain: #0e7a54;
  --sand-quality: #b23a66;
  --sand-business: #0e7ab8;

  --sand-finance: #0c6b6a;
  --sand-platform: #6d34b8;

  /* On-sand status pair (island --good-text/--critical fail contrast on sand) */
  --sand-good: #0d6b0d;
  --sand-bad: #a02424;

  /* Brand accents (decorative — charts use --series-*) */
  --cyan: #38bdf8;
  --cyan-deep: #0e7ab8;
  --violet: #8b5cf6;
  --violet-soft: #a78bfa;
  --brand-grad: linear-gradient(100deg, #38bdf8 0%, #818cf8 55%, #a855f7 100%);
  --brand-grad-soft: linear-gradient(100deg, rgba(56,189,248,.16), rgba(168,85,247,.16));

  /* Categorical chart palette — validated (CVD-safe order, dark surface #101a2c) */
  --series-1: #2f8fe0;  /* blue    */
  --series-2: #c98500;  /* amber   */
  --series-3: #199e70;  /* green   */
  --series-4: #9085e9;  /* violet  */
  --series-5: #d55181;  /* magenta */

  /* Status (reserved — never used as series colors) */
  --good: #0ca30c;
  --good-text: #35c96a;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #e25555;

  /* Chart chrome */
  --grid-line: rgba(169, 182, 204, 0.13);
  --axis-line: rgba(169, 182, 204, 0.28);

  /* Typography */
  --font-display: "Space Grotesk", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Scale */
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --radius-pill: 999px;
  --shadow-1: 0 4px 24px rgba(2, 6, 16, 0.45);
  --shadow-2: 0 12px 48px rgba(2, 6, 16, 0.6);
  --glow-cyan: 0 0 32px rgba(56, 189, 248, 0.22);
  --maxw: 1240px;
  --nav-h: 74px;

  /* Motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-1: 220ms;
  --dur-2: 420ms;
  --dur-3: 700ms;

  color-scheme: light;
}

/* ---------- 1b. Dark islands ----------
   Any component that should read as a dark "die on the sand substrate"
   re-scopes the contextual tokens. Page CSS may add its own roots to this
   list by giving them class="di". */
.di,
.mega, .card, .stat-tile, .viz-root, .wf-player, .wizard,
.accordion-item, .ai-console, .modal, .opt-card, .side-nav,
.chip, .ba-switch, .skip-link {
  --ink: #f2f6ff;
  --ink-2: #a9b6cc;
  --ink-3: #8090aa;
  --glass: rgba(148, 184, 255, 0.05);
  --glass-strong: rgba(148, 184, 255, 0.09);
  --glass-border: rgba(148, 184, 255, 0.14);
  --hairline: rgba(255, 255, 255, 0.08);
  --link: #38bdf8;
  --kicker-c: #38bdf8;
  --focus-c: #38bdf8;
  --grad-text: linear-gradient(100deg, #38bdf8 0%, #818cf8 55%, #a855f7 100%);
  color: var(--ink);
  color-scheme: dark;
}
.di { background: var(--surface-2); }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    /* fine grain — the sand grains */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.13'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)'/%3E%3C/svg%3E"),
    /* coarse mottle — soft dune tonal drift */
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='640' height='640'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.016' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='linear' slope='0.06'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='640' height='640' filter='url(%23m)'/%3E%3C/svg%3E"),
    radial-gradient(1100px 700px at 92% -8%, rgba(201, 133, 0, 0.12), transparent 60%),
    radial-gradient(900px 640px at -12% 32%, rgba(93, 79, 192, 0.06), transparent 55%),
    linear-gradient(180deg, #f6f0e3 0%, var(--bg-page) 48%, #e7ddc7 100%);
  background-attachment: fixed, fixed, scroll, scroll, scroll;
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, canvas, video { max-width: 100%; height: auto; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2.4rem, 5.2vw, 4.2rem); font-weight: 700; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.7rem); font-weight: 700; }
h3 { font-size: clamp(1.2rem, 2vw, 1.55rem); font-weight: 600; }
h4 { font-size: 1.05rem; font-weight: 600; }
p { margin: 0 0 1em; color: var(--ink-2); }
strong { color: var(--ink); }
::selection { background: rgba(11, 102, 163, 0.22); }
:focus-visible { outline: 2px solid var(--focus-c); outline-offset: 2px; border-radius: 4px; }

/* Skip link (a11y) */
.skip-link {
  position: absolute; left: -999px; top: 8px; z-index: 200;
  background: var(--surface-3); color: var(--ink);
  padding: 10px 18px; border-radius: var(--radius-s);
}
.skip-link:focus { left: 8px; }

/* ---------- 3. Layout ---------- */
.container { width: min(var(--maxw), 92vw); margin-inline: auto; }
.section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
.section--tight { padding: clamp(40px, 6vw, 72px) 0; }
.section--panel { background: var(--bg-deep); border-block: 1px solid var(--hairline); }
.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1020px) { .grid--4 { grid-template-columns: repeat(2, 1fr); } .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; } }

/* Section headers */
.sec-head { max-width: 780px; margin-bottom: clamp(32px, 5vw, 56px); }
.sec-head--center { margin-inline: auto; text-align: center; }
.kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--kicker-c); margin-bottom: 14px;
}
.kicker::before { content: ""; width: 22px; height: 2px; background: var(--brand-grad); border-radius: 2px; }
.sec-head--center .kicker::after { content: ""; width: 22px; height: 2px; background: var(--brand-grad); border-radius: 2px; }
.lede { font-size: clamp(1.02rem, 1.5vw, 1.2rem); color: var(--ink-2); }

/* Gradient text */
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}

/* ---------- 4. Header / sticky nav ---------- */
.site-header {
  /* v3: light premium band — the new wordmark is dark-on-transparent */
  position: fixed; inset: 0 0 auto 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: rgba(250, 246, 238, 0.88);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(36, 31, 22, 0.10);
  transition: box-shadow var(--dur-2), background var(--dur-2);
}
.site-header.is-scrolled {
  background: rgba(251, 248, 242, 0.97);
  box-shadow: 0 6px 24px rgba(36, 31, 22, 0.10);
}
.logo-semai { height: 27px; width: auto; display: block; overflow: visible; }
.site-footer .logo-semai { height: 21px; }
/* Brand animation: the mark loads as "Semi"; the cyan A drops in between
   m and i — semiconductor plus AI, told in half a second. Runs once. */
.logo-semai:not(.logo-semai--static) .lg-a {
  opacity: 0; transform: translateY(-20px);
  animation: lgADrop 0.55s var(--ease-out) 1.3s forwards;
}
.logo-semai:not(.logo-semai--static) .lg-i {
  transform: translateX(-118px);
  animation: lgISlide 0.55s var(--ease-out) 1.3s forwards;
}
@keyframes lgADrop { 70% { opacity: 1; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes lgISlide { to { transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .logo-semai .lg-a { opacity: 1 !important; transform: none !important; }
  .logo-semai .lg-i { transform: none !important; }
}
.nav-bar { display: flex; align-items: center; gap: 28px; width: min(var(--maxw), 94vw); margin-inline: auto; position: relative; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); font-family: var(--font-display); font-weight: 700; font-size: 1.38rem; letter-spacing: -0.02em; }
.brand .logo-mark { width: 42px; height: 42px; flex: none; }
.brand small { font-weight: 500; color: var(--ink-3); font-size: 0.68rem; letter-spacing: 0.02em; display: block; line-height: 1; margin-top: 2px; }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: auto; list-style: none; padding: 0; }
.nav-links > li { position: static; } /* mega anchors to .nav-bar, not the li */
.nav-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: var(--radius-s);
  color: var(--ink-2); font-size: 0.92rem; font-weight: 500;
  transition: color var(--dur-1), background var(--dur-1);
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.nav-link:hover, .nav-link[aria-expanded="true"] { color: var(--ink); background: var(--glass); }
.nav-link.is-active { color: var(--link); }
.nav-link .caret { transition: transform var(--dur-1); }
.nav-link[aria-expanded="true"] .caret { transform: rotate(180deg); }
.nav-cta { margin-left: 10px; }

/* Mega menu */
.mega {
  /* anchored to .nav-bar (position:relative) so it never clips off-viewport */
  position: absolute; top: calc(100% + 14px); right: 0;
  width: min(880px, 92vw);
  background: rgba(13, 21, 38, 0.97);
  backdrop-filter: blur(24px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow-2);
  padding: 26px;
  max-height: min(76vh, calc(100dvh - var(--nav-h) - 28px));
  overflow-y: auto; overscroll-behavior: contain;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity var(--dur-1), transform var(--dur-1), visibility var(--dur-1);
}
.mega.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.mega-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 22px; }
.mega-suite { padding: 6px 0; }
.mega-suite-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px;
}
.mega-suite-title .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.mega a.mega-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 7px 10px; margin: 0 -10px; border-radius: var(--radius-s);
  color: var(--ink-2); font-size: 0.9rem; transition: background var(--dur-1), color var(--dur-1);
}
.mega a.mega-item:hover { background: var(--glass); color: var(--ink); }
.mega a.mega-item .mi-ic {
  flex: none; width: 24px; height: 24px; border-radius: 6px;
  display: grid; place-items: center; font-size: 0.82rem; line-height: 1;
  background: var(--glass-strong); border: 1px solid var(--glass-border);
}
.mega a.mega-item b { display: block; color: var(--ink); font-weight: 600; }
.mega a.mega-item span { display: block; font-size: 0.76rem; color: var(--ink-3); line-height: 1.35; }
.mega .mega-df {
  display: flex; align-items: center; gap: 10px; margin-top: 6px;
  padding: 10px 12px; border-radius: var(--radius-s);
  background: rgba(139, 92, 246, 0.10); border: 1px solid rgba(139, 92, 246, 0.35);
  color: var(--ink); font-size: 0.9rem;
}
.mega .mega-df:hover { background: rgba(139, 92, 246, 0.18); }
.mega .mega-df b { font-weight: 700; }
.mega .mega-df span { color: var(--ink-3); font-size: 0.78rem; }
.mega-footer { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--hairline); display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }

/* Mobile nav */
.nav-burger { display: none; margin-left: auto; background: none; border: 0; color: var(--ink); cursor: pointer; padding: 8px; }
@media (max-width: 940px) {
  .nav-links { display: none; }
  .nav-burger { display: inline-flex; }
  .nav-links.is-mobile-open {
    display: flex; flex-direction: column; align-items: stretch;
    position: fixed; inset: var(--nav-h) 0 auto 0;
    background: rgba(7, 13, 26, 0.98); backdrop-filter: blur(20px);
    padding: 18px 5vw 28px; gap: 2px; margin: 0;
    border-bottom: 1px solid var(--hairline); box-shadow: var(--shadow-2);
    max-height: calc(100dvh - var(--nav-h)); overflow-y: auto;
  }
  .nav-links.is-mobile-open .mega { position: static; width: 100%; opacity: 1; visibility: visible; transform: none; display: none; margin-top: 6px; }
  .nav-links.is-mobile-open .mega.is-open { display: block; }
  .nav-links.is-mobile-open .mega-grid { grid-template-columns: 1fr; }
  .nav-cta { margin: 10px 0 0; }
}
body.nav-locked { overflow: hidden; }

/* Page offset below fixed header */
main { padding-top: var(--nav-h); }

/* ---------- 5. Buttons, badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border-radius: var(--radius-pill);
  font-family: var(--font-ui); font-size: 0.95rem; font-weight: 600;
  border: 1px solid transparent; cursor: pointer;
  transition: transform var(--dur-1) var(--ease-out), box-shadow var(--dur-1), background var(--dur-1), border-color var(--dur-1);
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: linear-gradient(100deg, #dcbb55 0%, #c49a2e 55%, #a87e1f 100%);
  color: #241f16; box-shadow: 0 4px 20px rgba(168, 126, 31, 0.30);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(168, 126, 31, 0.42); }
.btn--ghost { background: var(--glass); border-color: var(--glass-border); color: var(--ink); }
.btn--ghost:hover { background: var(--glass-strong); transform: translateY(-2px); }
.btn--link { background: none; color: var(--link); padding: 8px 4px; }
.btn--link:hover { gap: 12px; }
.btn--lg { padding: 15px 30px; font-size: 1.02rem; }
.btn--sm { padding: 8px 16px; font-size: 0.85rem; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: var(--glass); border: 1px solid var(--glass-border);
  font-size: 0.8rem; font-weight: 500; color: var(--ink-2);
}
.badge .pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--kicker-c); animation: pulse 2.4s infinite; flex: none; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(56,189,248,.5); } 55% { box-shadow: 0 0 0 8px rgba(56,189,248,0); } }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  border-radius: var(--radius-pill); background: var(--surface-3);
  border: 1px solid var(--hairline); font-size: 0.78rem; color: var(--ink-2); font-weight: 500;
}

/* ---------- 6. Cards ---------- */
.card {
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-m);
  padding: 26px;
  transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2), box-shadow var(--dur-2), background var(--dur-2);
}
/* Cards are dark islands — the glass variant must stay dark on the sand plane */
.card--glass { background: rgba(16, 26, 44, 0.88); backdrop-filter: blur(10px); border-color: rgba(148, 184, 255, 0.14); }
.card--hover:hover { transform: translateY(-5px); border-color: rgba(56, 189, 248, 0.35); box-shadow: var(--shadow-2), var(--glow-cyan); }
.card--accent { border-top: 2px solid; border-image: linear-gradient(90deg, #38bdf8, #a855f7) 1; }
.card .icon-tile {
  width: 46px; height: 46px; border-radius: 12px;
  display: grid; place-items: center; margin-bottom: 16px;
  background: var(--brand-grad-soft); border: 1px solid var(--glass-border);
  color: var(--cyan); font-size: 1.25rem;
}
.card h3 a { color: inherit; }

/* ---------- 7. Stat tiles / KPI (dataviz-compliant) ---------- */
.stat-tile { padding: 20px 22px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-m); }
.stat-tile .stat-label { font-size: 0.8rem; font-weight: 500; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px; }
.stat-tile .stat-value { font-family: var(--font-ui); font-size: clamp(1.9rem, 3vw, 2.6rem); font-weight: 700; color: var(--ink); line-height: 1.05; }
.stat-tile .stat-value .unit { font-size: 0.55em; font-weight: 600; color: var(--ink-2); margin-left: 2px; }
.stat-tile .stat-delta { font-size: 0.85rem; font-weight: 600; margin-top: 6px; display: inline-flex; align-items: center; gap: 5px; }
.stat-tile .stat-delta.up { color: var(--good-text); }
.stat-tile .stat-delta.down { color: var(--critical); }
.stat-tile .stat-note { font-size: 0.78rem; color: var(--ink-3); margin-top: 4px; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1020px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .kpi-row { grid-template-columns: 1fr; } }

/* Chart scaffolding */
.viz-root { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-m); padding: 20px; }
.viz-root .viz-title { font-size: 0.95rem; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.viz-root .viz-sub { font-size: 0.8rem; color: var(--ink-3); margin-bottom: 14px; }
.viz-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.8rem; color: var(--ink-2); margin-top: 12px; }
.viz-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }

/* ---------- 8. Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }
.reveal.in-view { opacity: 1; transform: none; }
.reveal-stagger > * { opacity: 0; transform: translateY(22px); transition: opacity var(--dur-3) var(--ease-out), transform var(--dur-3) var(--ease-out); }
.reveal-stagger.in-view > * { opacity: 1; transform: none; }
.reveal-stagger.in-view > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.in-view > *:nth-child(2) { transition-delay: 90ms; }
.reveal-stagger.in-view > *:nth-child(3) { transition-delay: 180ms; }
.reveal-stagger.in-view > *:nth-child(4) { transition-delay: 270ms; }
.reveal-stagger.in-view > *:nth-child(5) { transition-delay: 360ms; }
.reveal-stagger.in-view > *:nth-child(6) { transition-delay: 450ms; }
.reveal-stagger.in-view > *:nth-child(7) { transition-delay: 540ms; }
.reveal-stagger.in-view > *:nth-child(8) { transition-delay: 630ms; }
.reveal-stagger.in-view > *:nth-child(9) { transition-delay: 720ms; }
.reveal-stagger.in-view > *:nth-child(10) { transition-delay: 810ms; }
.reveal-stagger.in-view > *:nth-child(11) { transition-delay: 900ms; }
.reveal-stagger.in-view > *:nth-child(n+12) { transition-delay: 990ms; }

/* ---------- 9. Tabs ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--hairline); margin-bottom: 26px; }
.tab-btn {
  padding: 10px 18px; background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--ink-2); font-family: inherit; font-size: 0.92rem; font-weight: 500; cursor: pointer;
  transition: color var(--dur-1);
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.is-active { color: var(--link); border-bottom-color: var(--link); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; animation: fadeUp var(--dur-2) var(--ease-out); }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- 10. Accordion / expandable ---------- */
.accordion-item { border: 1px solid var(--hairline); border-radius: var(--radius-m); background: var(--surface-2); margin-bottom: 12px; overflow: hidden; }
.accordion-head {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 18px 22px; background: none; border: 0; cursor: pointer;
  color: var(--ink); font-family: inherit; font-size: 1rem; font-weight: 600;
}
.accordion-head:hover { background: var(--glass); }
.accordion-head .acc-icon { margin-left: auto; flex: none; transition: transform var(--dur-2) var(--ease-out); color: var(--ink-3); }
.accordion-item.is-open .accordion-head .acc-icon { transform: rotate(45deg); color: var(--link); }
.accordion-body { max-height: 0; overflow: hidden; transition: max-height var(--dur-2) var(--ease-out); }
.accordion-body-inner { padding: 0 22px 22px; }

/* ---------- 11. Workflow player ---------- */
.wf-player { background: var(--surface-2); border: 1px solid var(--hairline); border-radius: var(--radius-l); overflow: hidden; }
.wf-steps { display: flex; gap: 0; border-bottom: 1px solid var(--hairline); overflow-x: auto; }
.wf-step {
  flex: 1; min-width: 120px; padding: 14px 16px; background: none; border: 0; border-bottom: 3px solid transparent;
  color: var(--ink-3); font-family: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; text-align: left;
  transition: color var(--dur-1);
  position: relative;
}
.wf-step .wf-step-num { display: block; font-size: 0.7rem; color: var(--ink-3); font-weight: 500; margin-bottom: 2px; }
.wf-step.is-active { color: var(--ink); border-bottom-color: var(--link); }
.wf-step.is-done { color: var(--ink-2); }
.wf-step.is-done .wf-step-num::after { content: " ✓"; color: var(--good-text); }
.wf-stage { padding: 28px; min-height: 220px; }
.wf-controls { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-top: 1px solid var(--hairline); }
.wf-progress { flex: 1; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.wf-progress .bar { height: 100%; width: 0; background: var(--brand-grad); transition: width 300ms linear; }

/* ---------- 12. Before / after ---------- */
.ba-switch { display: inline-flex; background: var(--surface-3); border: 1px solid var(--hairline); border-radius: var(--radius-pill); padding: 4px; gap: 4px; }
.ba-switch button {
  padding: 8px 20px; border: 0; border-radius: var(--radius-pill); background: none;
  color: var(--ink-2); font-family: inherit; font-size: 0.88rem; font-weight: 600; cursor: pointer;
  transition: background var(--dur-1), color var(--dur-1);
}
.ba-switch button.is-active { background: var(--brand-grad); color: #061018; }
.ba-pane { display: none; }
.ba-pane.is-active { display: block; animation: fadeUp var(--dur-2) var(--ease-out); }

/* ---------- 13. Wizard ---------- */
.wizard { background: var(--surface-1); border: 1px solid var(--glass-border); border-radius: var(--radius-l); overflow: hidden; box-shadow: var(--shadow-2); }
.wizard-progress { display: flex; gap: 6px; padding: 22px 28px 0; }
.wizard-progress .wp-seg { flex: 1; height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; position: relative; }
.wizard-progress .wp-seg::after { content: ""; position: absolute; inset: 0; background: var(--brand-grad); transform: scaleX(0); transform-origin: left; transition: transform var(--dur-2) var(--ease-out); }
.wizard-progress .wp-seg.is-done::after, .wizard-progress .wp-seg.is-active::after { transform: scaleX(1); }
.wizard-progress .wp-seg.is-active::after { animation: segPulse 1.8s infinite; }
@keyframes segPulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }
.wizard-step { display: none; padding: 30px; }
.wizard-step.is-active { display: block; animation: fadeUp var(--dur-2) var(--ease-out); }

/* Option cards used in wizard */
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.opt-card {
  padding: 16px; border-radius: var(--radius-m); text-align: left;
  background: var(--surface-2); border: 1px solid var(--hairline);
  color: var(--ink-2); font-family: inherit; font-size: 0.9rem; cursor: pointer;
  transition: border-color var(--dur-1), background var(--dur-1), transform var(--dur-1);
  display: flex; flex-direction: column; gap: 6px;
}
.opt-card:hover { border-color: rgba(56,189,248,0.4); transform: translateY(-2px); }
.opt-card.is-selected { border-color: var(--cyan); background: linear-gradient(rgba(56,189,248,0.08), rgba(56,189,248,0.08)), var(--surface-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--cyan); }
.opt-card .opt-icon { font-size: 1.3rem; }
.opt-card b { color: var(--ink); font-weight: 600; }
.opt-card small { color: var(--ink-3); font-size: 0.78rem; }

/* Form fields */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.field label .req { color: var(--critical); }
.field input, .field textarea, .field select {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-s);
  background: var(--surface-2); border: 1px solid var(--hairline);
  color: var(--ink); font-family: inherit; font-size: 0.95rem;
  transition: border-color var(--dur-1), box-shadow var(--dur-1);
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(56,189,248,0.15);
}
.field .hint { font-size: 0.78rem; color: var(--ink-3); margin-top: 5px; }
.field.has-error input, .field.has-error textarea { border-color: var(--critical); }
.field .err-msg { font-size: 0.8rem; color: var(--critical); margin-top: 5px; display: none; }
.field.has-error .err-msg { display: block; }

/* ---------- 14. AI reasoning / typing ---------- */
.ai-console {
  background: #05090f; border: 1px solid var(--hairline); border-radius: var(--radius-m);
  padding: 20px 22px; font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.75; color: var(--ink-2);
}
.ai-console .ai-line { display: flex; gap: 10px; opacity: 0; animation: aiLine 400ms var(--ease-out) forwards; }
@keyframes aiLine { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.ai-console .ai-tag { color: var(--cyan); flex: none; }
.ai-console .ai-ok { color: var(--good-text); }
.ai-cursor { display: inline-block; width: 8px; height: 1.1em; background: var(--cyan); vertical-align: text-bottom; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.thinking-dots span { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--cyan); animation: tdots 1.2s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.15s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes tdots { 0%,80%,100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

/* ---------- 15. Timeline ---------- */
.timeline { position: relative; padding-left: 34px; }
.timeline::before { content: ""; position: absolute; left: 10px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(180deg, var(--kicker-c), #5d4fc0); opacity: 0.45; border-radius: 2px; }
.tl-item { position: relative; padding-bottom: 30px; }
.tl-item::before {
  content: ""; position: absolute; left: -30px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg-page); border: 2px solid var(--kicker-c);
}
.tl-item .tl-when { font-size: 0.78rem; font-weight: 700; color: var(--kicker-c); letter-spacing: 0.08em; text-transform: uppercase; }
.tl-item h4 { margin: 4px 0 6px; }

/* ---------- 16. Modal / drawer ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 150; background: rgba(4, 8, 16, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity var(--dur-2), visibility var(--dur-2);
  display: grid; place-items: center; padding: 4vh 4vw;
}
.modal-backdrop.is-open { opacity: 1; visibility: visible; }
.modal {
  width: min(860px, 100%); max-height: 88vh; overflow-y: auto;
  background: var(--surface-1); border: 1px solid var(--glass-border);
  border-radius: var(--radius-l); box-shadow: var(--shadow-2); padding: 34px;
  transform: translateY(18px) scale(0.98); transition: transform var(--dur-2) var(--ease-out);
}
.modal-backdrop.is-open .modal { transform: none; }
.modal-close {
  position: sticky; top: 0; float: right; margin: -10px -10px 0 0;
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--hairline);
  background: var(--surface-3); color: var(--ink-2); font-size: 1.1rem; cursor: pointer;
}
.modal-close:hover { color: var(--ink); border-color: var(--link); }

/* ---------- 17. Sidebar layout (platform / docs-style pages) ---------- */
.side-layout { display: grid; grid-template-columns: 250px 1fr; gap: 44px; align-items: start; }
.side-nav { position: sticky; top: calc(var(--nav-h) + 24px); max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; background: var(--surface-1); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius-m); padding: 18px 16px 18px 22px; }
.side-nav .sn-group { margin-bottom: 18px; }
.side-nav .sn-title { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; display: flex; align-items: center; gap: 7px; }
.side-nav .sn-title .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.side-nav a { display: block; padding: 6px 10px; margin-left: -10px; border-left: 2px solid transparent; border-radius: 0 var(--radius-s) var(--radius-s) 0; color: var(--ink-2); font-size: 0.87rem; transition: all var(--dur-1); }
.side-nav a:hover { color: var(--ink); background: var(--glass); }
.side-nav a.is-active { color: var(--link); border-left-color: var(--link); background: rgba(56,189,248,0.06); }
@media (max-width: 940px) { .side-layout { grid-template-columns: 1fr; } .side-nav { position: static; max-height: none; display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; } .side-nav .sn-group { margin: 0; flex: none; } }

/* ---------- 18. Marquee / trust bar ---------- */
.trust-bar { display: flex; flex-wrap: wrap; gap: 14px 34px; align-items: center; justify-content: center; opacity: 0.85; }
.trust-bar .t-item { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-3); font-size: 0.86rem; font-weight: 500; }
.trust-bar .t-item svg { color: var(--kicker-c); }

/* ---------- 19. Footer ---------- */
.site-footer {
  background: #ece5d3; /* v4: light sand footer, tight */
  border-top: 1px solid var(--hairline);
  padding: 24px 0 14px; margin-top: 40px;
}
.footer-brandcol p { font-size: 0.82rem; max-width: 300px; margin: 10px 0 2px; color: var(--ink-2); }
.footer-mail { color: var(--ink-3); font-family: var(--font-mono); font-size: 0.78rem !important; }

/* Slim assessment CTA merged into the footer (replaces the old full band) */
.footer-cta {
  display: flex; justify-content: space-between; align-items: center; gap: 12px 28px; flex-wrap: wrap;
  padding-bottom: 16px; margin-bottom: 18px;
  border-bottom: 1px solid var(--hairline);
}
.footer-cta .kicker { margin-bottom: 4px; }
.footer-cta-line {
  font-family: var(--font-display); font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: 600; color: var(--ink); margin: 0; line-height: 1.3;
}
.footer-cta-sub { font-size: 0.82rem; color: var(--ink-3); margin: 5px 0 0; }
.footer-cta-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.footer-grid { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 20px 28px; margin-bottom: 16px; }
@media (max-width: 940px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-grid { grid-template-columns: 1fr; } }
.site-footer h5 { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 7px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; }
.site-footer ul li { margin-bottom: 4px; }
.site-footer ul a { color: var(--ink-2); font-size: 0.82rem; }
.site-footer ul a:hover { color: var(--copper); }
.footer-base { border-top: 1px solid var(--hairline); padding-top: 10px; display: flex; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; color: var(--ink-3); font-size: 0.74rem; }

/* ---------- 20. Decorative: circuit / wafer motifs ---------- */
.bg-orbs { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.bg-orbs::before, .bg-orbs::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.10;
}
.bg-orbs::before { width: 560px; height: 560px; background: #c98500; top: -180px; right: -120px; }
.bg-orbs::after { width: 480px; height: 480px; background: #8b5cf6; bottom: -200px; left: -140px; }
.section > .container { position: relative; z-index: 1; }
.circuit-divider { height: 1px; background: linear-gradient(90deg, transparent, rgba(138,69,23,0.45), rgba(93,79,192,0.45), transparent); border: 0; margin: 0; }

/* Number ticks for count-up */
[data-countup] { font-variant-numeric: tabular-nums; }

/* Photo frame — the user's dark-blue photography sits on the sand like a die */
.photo-frame {
  border-radius: var(--radius-l); overflow: hidden;
  border: 1px solid rgba(36, 31, 22, 0.18);
  box-shadow: var(--shadow-2);
  background: var(--surface-2);
}
.photo-frame img { display: block; width: 100%; height: auto; }
.photo-frame--tilt { transform: rotate(-1.2deg); }

/* Chip-etch typography — text as printed on a die: mono, spaced, silkscreen */
.etch {
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3);
}

/* ---------- 21. Motion safety & print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .reveal, .reveal-stagger > * { opacity: 1 !important; transform: none !important; }
}
@media print {
  .site-header, .site-footer, .nav-burger, .btn { display: none !important; }
  body { background: #fff; color: #111; }
}
