/* The AI Architecture Lab - main stylesheet. "The Instrument" direction. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--ground-porcelain);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  line-height: 1.7;
  font-weight: 380;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--chakra-navy); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--chakra-navy); outline-offset: 3px; border-radius: 2px;
}
:where(h1, h2, h3) { font-family: var(--display); font-weight: 600; line-height: 1.02; letter-spacing: -0.01em; margin: 0; }

/* Layout */
.wrap { max-width: var(--max); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 9vw, 128px); position: relative; scroll-margin-top: calc(var(--header-h) + 14px); }
.kicker {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 500; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--saffron); margin: 0 0 20px;
}
.ground-graphite .kicker { color: var(--saffron-bright); }
.lede { font-size: clamp(1.15rem, 1rem + 0.7vw, 1.5rem); line-height: 1.5; max-width: 34ch; color: var(--muted); }
.prose { max-width: 66ch; }
.prose p { margin: 0 0 1.1em; }
.h2 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.5rem); max-width: 18ch; }
.implication { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); border-top: 1px solid var(--line); padding-top: 14px; margin-top: 28px; }

/* Grounds + atmosphere */
.ground-graphite { background: var(--ground-graphite); color: var(--ink-inverse); }
.ground-graphite a { color: #A9B6E6; }
.ground-graphite .muted, .ground-graphite .implication { color: var(--muted-inverse); border-color: var(--line-dark); }
.ground-sandstone { background: var(--ground-sandstone); }
.ground-paper { background: var(--ground-paper); }
.grain::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.04; mix-blend-mode: multiply;
}
.ground-graphite.grain::after { mix-blend-mode: screen; opacity: 0.03; }
.ground-graphite { background-image: linear-gradient(177deg, #14181F 0%, var(--ground-graphite) 46%, #0C0E12 100%); }
.blueprint {
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 40px 40px; background-position: center;
}
.blueprint::before { content: ''; position: absolute; inset: 0; background: inherit; opacity: 0.035; pointer-events: none; }
.section > .wrap { position: relative; z-index: 1; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50; height: var(--header-h);
  display: flex; align-items: center;
  background: color-mix(in srgb, var(--ground-porcelain) 86%, transparent);
  backdrop-filter: saturate(1.1) blur(8px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 20px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand img { width: 34px; height: 34px; }
.brand .wm { font-family: var(--display); font-weight: 600; font-size: 1rem; letter-spacing: 0.01em; line-height: 1.05; white-space: nowrap; }
.brand .wm .doctrine-sub { display: block; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.nav { display: flex; align-items: center; gap: 28px; }
.nav-link { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav-link:hover { color: var(--saffron); }
.nav .btn { padding: 9px 16px; white-space: nowrap; }
.nav .btn-primary { color: #fff; }
.nav .btn-primary:hover { color: #fff; }
.lbl-short { display: none; }
@media (max-width: 860px) { .nav-link { display: none; } .nav { gap: 16px; } }
@media (max-width: 560px) {
  .site-header .wrap { gap: 12px; }
  .brand { gap: 10px; }
  .brand .wm .doctrine-sub { display: none; }
  .brand .wm { font-size: 0.82rem; letter-spacing: 0; }
  .brand img { width: 30px; height: 30px; }
  .nav .btn { padding: 10px 13px; font-size: 0.72rem; }
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono);
  font-size: 0.82rem; letter-spacing: 0.04em; font-weight: 500; text-decoration: none;
  padding: 14px 24px; border-radius: 2px; border: 1px solid transparent; cursor: pointer;
  min-height: 44px; transition: transform 0.2s var(--ease-move), background 0.2s;
}
.btn-primary { background: var(--saffron); color: #fff; }
.btn-primary:hover { background: var(--saffron-bright); transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.ground-graphite .btn-ghost { color: var(--ink-inverse); border-color: var(--line-dark); }
.btn-ghost:hover { border-color: var(--saffron); }
.btn .arrow { transition: transform 0.2s var(--ease-move); }
.btn:hover .arrow { transform: translateX(3px); }

/* Hero */
.hero { min-height: calc(100svh - var(--header-h)); display: flex; align-items: center; padding-block: clamp(40px, 6vw, 80px); overflow: clip; }
.hero .wrap { display: grid; grid-template-columns: 1fr; gap: clamp(32px, 5vw, 64px); align-items: center; width: 100%; }
.hero-copy { max-width: 36ch; }
.hero h1 { font-size: clamp(2.6rem, 1.4rem + 5.4vw, 5.2rem); font-weight: 580; line-height: 0.98; }
.hero h1 .l2 { color: var(--saffron-bright); }
.hero .lede { margin: 28px 0 32px; max-width: 42ch; color: var(--muted-inverse); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 16px 20px; align-items: center; }
.hero-cta .sub { font-family: var(--mono); font-size: 0.76rem; letter-spacing: 0.04em; color: var(--muted-inverse); }
.hero-kicker { display: flex; flex-direction: column; gap: 4px; }
.hero-kicker .doctrine { color: var(--muted-inverse); letter-spacing: 0.2em; }

/* 3D stage box: fixed aspect ratio so poster, canvas and fallback never shift. */
.stage {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-width: 560px; margin-inline: auto;
  border-radius: 3px;
}
.stage__poster, .stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.stage__poster { object-fit: contain; z-index: 1; transition: opacity 0.6s ease; }
.stage canvas { z-index: 2; display: block; }
.stage[data-3d='on'] .stage__poster { opacity: 0; }
.stage__caption { position: absolute; left: 0; right: 0; bottom: -34px; text-align: center; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--muted-inverse); z-index: 3; }

/* Ledger */
.ledger { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-dark); }
.ledger div { padding: 22px 0; border-right: 1px solid var(--line-dark); padding-right: 20px; }
.ledger div:last-child { border-right: 0; }
.ledger dt { font-family: var(--display); font-size: clamp(1.6rem, 1rem + 2vw, 2.4rem); font-weight: 560; }
.ledger dd { margin: 6px 0 0; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted-inverse); text-transform: uppercase; }

/* Generic grids */
.split { display: grid; grid-template-columns: 1fr; gap: clamp(28px, 4vw, 56px); align-items: start; }
@media (min-width: 880px) { .split { grid-template-columns: 1.1fr 0.9fr; } .split.wide-left { grid-template-columns: 1.3fr 0.7fr; } }

/* Stats exhibit */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 32px 0; }
.stat { border-left: 2px solid var(--saffron); padding-left: 18px; }
.stat b { display: block; font-family: var(--display); font-size: clamp(2.2rem, 1.4rem + 3vw, 3.6rem); font-weight: 560; line-height: 1; }
.stat span { font-size: 0.95rem; color: var(--muted); }
.cite { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.03em; color: var(--muted); display: block; margin-top: 8px; }

/* Artefact list */
.artefacts { list-style: none; margin: 0; padding: 0; counter-reset: a; }
.artefacts li { counter-increment: a; display: grid; grid-template-columns: auto 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); align-items: baseline; }
.artefacts li::before { content: counter(a, decimal-leading-zero); font-family: var(--mono); font-size: 0.8rem; color: var(--saffron); font-weight: 500; }
.artefacts b { font-family: var(--display); font-weight: 560; font-size: 1.05rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 3px; padding: 24px; }
.panel h3 { font-size: 1.05rem; margin-bottom: 10px; }
.panel + .panel { margin-top: 16px; }
.panel ul { margin: 0; padding-left: 18px; }
.panel li { margin: 6px 0; font-size: 0.95rem; }

/* Table */
.table-scroll { overflow-x: auto; margin-top: 32px; border: 1px solid var(--line); border-radius: 3px; }
table.coverage { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 720px; }
table.coverage th, table.coverage td { text-align: left; padding: 14px 18px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.coverage thead th { position: sticky; top: var(--header-h); background: var(--ground-paper); font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
table.coverage tbody th { font-family: var(--display); font-weight: 560; font-size: 0.98rem; white-space: nowrap; }
table.coverage tbody th small { display: block; font-family: var(--mono); font-weight: 400; font-size: 0.66rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }

/* Stepper (governed example) */
.stepper { display: grid; grid-auto-flow: row; gap: 10px; margin-top: 36px; counter-reset: s; }
@media (min-width: 880px) { .stepper { grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; } }
.step { position: relative; padding: 18px; border: 1px solid var(--line-dark); background: color-mix(in srgb, var(--ground-graphite) 70%, #fff 4%); }
@media (min-width: 880px) { .step { border-right: 0; } .step:last-child { border-right: 1px solid var(--line-dark); } }
.step .n { font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.08em; color: var(--saffron-bright); }
.step b { display: block; font-family: var(--display); font-weight: 560; margin: 6px 0 4px; }
.step p { margin: 0; font-size: 0.82rem; color: var(--muted-inverse); }
.step.final { border-color: var(--saffron); border-width: 1px; box-shadow: inset 0 0 0 1px var(--saffron); }
.guards { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 24px; font-family: var(--mono); font-size: 0.72rem; color: var(--muted-inverse); }
.guards span b { color: var(--ink-inverse); }
.guards-light { color: var(--muted); }
.guards-light span b { color: var(--ink); }

/* Light stepper (porcelain sections) */
.step-light { border-color: var(--line); background: #fff; }
.step-light .n { color: var(--saffron); }
.step-light p { color: var(--muted); }
.step-light b { color: var(--ink); }
@media (min-width: 880px) { .step-light { border-right: 0; } .step-light:last-child { border-right: 1px solid var(--line); } }
.step-light.final { border-color: var(--saffron); box-shadow: inset 0 0 0 1px var(--saffron); }

/* Service lines grid */
.svc { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 36px; border-radius: 3px; overflow: hidden; }
@media (min-width: 680px) { .svc { grid-template-columns: 1fr 1fr; } }
@media (min-width: 980px) { .svc { grid-template-columns: repeat(3, 1fr); } }
.svc-card { background: var(--ground-paper); padding: 24px; }
.svc-card .n { font-family: var(--mono); font-size: 0.7rem; color: var(--saffron); letter-spacing: 0.08em; }
.svc-card b { display: block; font-family: var(--display); font-weight: 560; font-size: 1.1rem; margin: 8px 0 8px; }
.svc-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }

/* Spaghetti -> spine diagram */
.shift { display: grid; gap: 20px; margin-top: 36px; }
@media (min-width: 760px) { .shift { grid-template-columns: 1fr auto 1fr; align-items: center; } }
.shift figure { margin: 0; border: 1px solid var(--line); border-radius: 3px; padding: 20px; background: #fff; }
.shift figcaption { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted); margin-top: 14px; }
.shift .arrow-mid { font-family: var(--mono); color: var(--saffron); text-align: center; font-size: 0.8rem; letter-spacing: 0.1em; }
.shift svg { width: 100%; height: auto; display: block; }

/* Ownership list */
.own { list-style: none; margin: 24px 0 0; padding: 0; }
.own li { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 0.95rem; }
.own li b { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.06em; text-transform: uppercase; }
.own .yes { color: var(--banyan); }
.own .none { color: var(--muted); }

/* Commercials */
.formula { font-family: var(--mono); font-size: 0.85rem; background: var(--surface); border: 1px solid var(--line); padding: 14px 18px; border-radius: 3px; margin-top: 20px; overflow-x: auto; }
.price-rows { list-style: none; margin: 24px 0 0; padding: 0; }
.price-rows li { display: grid; grid-template-columns: auto 1fr; gap: 18px; padding: 14px 0; border-top: 1px solid var(--line); align-items: baseline; }
.price-rows b { font-family: var(--display); font-size: 1.3rem; font-weight: 560; white-space: nowrap; }

/* Founder */
.facts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; margin-top: 28px; }
@media (min-width: 720px) { .facts { grid-template-columns: repeat(4, 1fr); } }
.facts b { display: block; font-family: var(--display); font-size: clamp(1.6rem, 1rem + 2vw, 2.2rem); font-weight: 560; }
.facts span { font-size: 0.9rem; color: var(--muted); }

/* Steps / contact */
.steps { display: grid; gap: 16px; margin-top: 36px; }
@media (min-width: 760px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.steps li { list-style: none; border-top: 2px solid var(--saffron); padding-top: 16px; }
.steps .n { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--saffron); }
.steps b { display: block; font-family: var(--display); font-weight: 560; margin: 6px 0; }
.steps p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.contact-line { font-family: var(--mono); font-size: 1rem; margin-top: 28px; }

/* Footer */
.site-footer { padding-block: clamp(48px, 6vw, 80px); }
.site-footer .wrap { display: grid; gap: 36px; }
@media (min-width: 760px) { .site-footer .wrap { grid-template-columns: 1.4fr 1fr 1fr; } }
.site-footer .brand img { width: 44px; height: 44px; }
.site-footer .tagline { font-style: italic; color: var(--muted-inverse); margin: 16px 0 0; max-width: 32ch; }
.site-footer h4 { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted-inverse); margin: 0 0 14px; font-weight: 500; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.site-footer a { color: var(--ink-inverse); text-decoration: none; font-size: 0.95rem; }
.site-footer a:hover { color: #A9B6E6; }
.site-footer .signoff { grid-column: 1 / -1; border-top: 1px solid var(--line-dark); padding-top: 20px; font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.03em; color: var(--muted-inverse); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }

/* Draft banner (removed in production) */
.draft-banner { position: fixed; bottom: 12px; left: 12px; z-index: 99; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.1em; background: #7a1d1d; color: #fff; padding: 6px 10px; border-radius: 2px; }

/* Reveal animation (progressive: elements are visible by default) */
[data-reveal] { opacity: 1; }
.js [data-reveal] { opacity: 0; transform: translateY(18px); }
.js [data-reveal].in { opacity: 1; transform: none; transition: opacity var(--dur-reveal) var(--ease-entrance), transform var(--dur-reveal) var(--ease-entrance); }

/* Responsive hero */
@media (min-width: 980px) {
  .hero .wrap { grid-template-columns: 1.02fr 0.98fr; }
  .hero-copy { max-width: none; }
}
@media (max-width: 979px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero-stage-col { order: -1; }
  .stage { max-width: 420px; }
}
@media (max-width: 620px) {
  .ledger { grid-template-columns: 1fr; }
  .ledger div { border-right: 0; border-bottom: 1px solid var(--line-dark); }
  .stats { grid-template-columns: 1fr; }
}

/* Reduced motion: a designed static variant. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  .js [data-reveal] { opacity: 1; transform: none; }
}

@media print {
  .site-header, .stage canvas, .draft-banner, .hero-cta .btn { display: none; }
  body, .ground-graphite { background: #fff; color: #000; }
  .ground-graphite * { color: #000 !important; }
}
