/* Home page only (src/views/home.ejs). Shared components are in site.css; everything here is prefixed h- so it cannot leak.
   Overrides of shared components, kept here on purpose: .readouts (no bottom margin, four columns), .steps (rail layout, no card on the
   number), .matline (sits in the section header), .live (full width of the hero column). */

.home { display: block; }
.h-sec { position: relative; }

/* ---------- Section headers ---------- */
.h-head { max-width: 720px; margin: 0 0 clamp(32px, 4vw, 48px); }
.h-head h2 { margin: 0; text-wrap: balance; }
.h-head-split { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-7); max-width: none; }
.h-head-split > div { max-width: 640px; }
.h-head-note { max-width: 40ch; margin: 0; font-size: .9375rem; }
.h-more { margin: var(--space-6) 0 0; }

/* ---------- 1. Hero ---------- */
.h-hero { position: relative; isolation: isolate; }
.h-hero::before {   /* a local signal glow behind the instrument */
  content: ""; position: absolute; z-index: -1; right: max(0px, calc(50% - 720px)); top: 40px; width: min(720px, 80vw); height: 620px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 107, 26, .13), transparent 75%);
}
.h-hero-in {
  display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr); align-items: center; gap: clamp(32px, 5vw, 72px);
  max-width: calc(var(--maxw) + 2 * var(--gutter)); margin-inline: auto; padding: clamp(40px, 6vw, 88px) var(--gutter) clamp(40px, 5vw, 64px);
}
.h-copy { min-width: 0; }
.h-cap { display: flex; }
.h-cap .cap { margin-bottom: var(--space-5); }
.h-title { margin: 0 0 var(--space-5); font-size: clamp(2.5rem, 1.2rem + 3.7vw, 4.25rem); line-height: 1; letter-spacing: -.047em; max-width: 15ch; text-wrap: balance; }
.h-title .grad { background: linear-gradient(180deg, #fff 25%, #A9B7CF 115%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.h-hot {
  background: linear-gradient(100deg, var(--signal-hi) 0%, var(--signal) 45%, #FFB27F 100%); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.h-lead { margin: 0 0 var(--space-6); max-width: 54ch; font-size: clamp(1.0625rem, 1rem + .25vw, 1.1875rem); }
.h-copy .live { max-width: 560px; margin-bottom: var(--space-5); }
.h-btns { margin: 0; }

/* The instrument: a glass frame around the canvas */
.h-instr {
  position: relative; margin: 0; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-width: 0;
  aspect-ratio: 5 / 5.6; max-height: 640px; border-radius: var(--r-lg); overflow: hidden;
  border: 1px solid var(--line-strong);
  background:
    radial-gradient(90% 70% at 50% 62%, rgba(255, 107, 26, .07), transparent 70%),
    linear-gradient(rgba(148, 178, 255, .045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, rgba(148, 178, 255, .045) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(180deg, rgba(15, 24, 41, .82), rgba(7, 11, 20, .92));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 0 0 1px rgba(0, 0, 0, .4), 0 50px 100px -40px rgba(0, 0, 0, .9), 0 0 80px -30px var(--glow);
}
.h-instr.corners::before { inset: 10px; --l: 14px; border-radius: 0; z-index: 2; }
.h-instr-head, .h-hud {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  padding: 18px 26px; font: 500 var(--fs-mono-s)/1 var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3);
}
.h-instr-title { display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); }
.h-instr-title i { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); box-shadow: 0 0 10px var(--signal); animation: blink 1.6s steps(2, start) infinite; }
.h-instr-tag { padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; color: var(--text-3); font-size: .625rem; letter-spacing: .14em; }
.h-stage { position: relative; min-height: 0; }
.h-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.h-hud { justify-content: flex-start; gap: var(--space-6); border-top: 1px solid var(--line); background: rgba(5, 8, 15, .45); }
.h-hud span { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.h-hud b { font-weight: 500; color: var(--text-3); }
.h-hud em { font-style: normal; font-variant-numeric: tabular-nums; letter-spacing: .02em; color: var(--text); font-size: .8125rem; }
.h-hud span:first-child em { color: var(--signal-hi); }
.h-hud small { font-size: .625rem; color: var(--text-3); margin-left: -4px; }
.h-hud-h { margin-left: auto; }

/* Without the animation (no JS, or a browser hero.js does not start in): a still, drawn in CSS: a stack of layer lines under a scan line */
.h-fallback {
  position: absolute; left: 50%; top: 50%; width: 46%; height: 64%; transform: translate(-50%, -46%);
  border-radius: 38% 38% 30% 30% / 14% 14% 10% 10%;
  background: repeating-linear-gradient(180deg, rgba(233, 238, 247, .38) 0 1px, transparent 1px 7px);
  -webkit-mask-image: linear-gradient(180deg, transparent 0 34%, #000 36%); mask-image: linear-gradient(180deg, transparent 0 34%, #000 36%);
  opacity: .8;
}
.h-fallback::after { content: ""; position: absolute; left: -24%; right: -24%; top: 35%; height: 1px; background: var(--signal); box-shadow: 0 0 14px var(--signal); }
.h-instr[data-on] .h-fallback { display: none; }

/* Proof strip */
.h-proof { max-width: calc(var(--maxw) + 2 * var(--gutter)); margin-inline: auto; padding: 0 var(--gutter); }
.h-readouts { grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.h-readouts .readout { padding: 22px 24px; gap: 10px; }
.h-readouts .readout .sub { line-height: 1.45; }
.h-readouts .readout dd { white-space: nowrap; }

/* ---------- 2. How it works: three steps on a rail ---------- */
.h-steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); }
.h-steps > li { padding: 0; border: 0; background: none; box-shadow: none; }
.h-step-top { position: relative; display: flex; align-items: center; height: 28px; margin-bottom: var(--space-5); }
.h-steps .h-step-top b { margin: 0; position: relative; z-index: 1; background: var(--bg-1); box-shadow: 0 0 0 4px var(--bg), 0 0 16px -4px var(--glow); }
.h-rail { position: absolute; left: 44px; right: calc(-1 * var(--space-5) + 0px); top: 50%; height: 1px; background: linear-gradient(90deg, rgba(255, 107, 26, .7), rgba(255, 255, 255, .14) 60%); }
.h-viz {
  width: 100%; height: auto; margin: 0 0 var(--space-5); padding: 18px; border-radius: var(--r); border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, .04), rgba(255, 255, 255, .012)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.h-steps h3 { margin-bottom: var(--space-2); }
.h-steps p { max-width: 34ch; }

/* Shared strokes for the small inline drawings */
.v-line, .v-mesh, .v-ring, .v-sig, .v-text, .v-mono, .v-pick, .v-halo, .v-node, .v-dim { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.v-line { stroke: rgba(233, 238, 247, .34); stroke-width: 1.5; }
.v-mesh { stroke: rgba(125, 211, 252, .55); stroke-width: 1.2; }
.v-ring { stroke: rgba(255, 107, 26, .35); stroke-width: 1.5; stroke-dasharray: 3 4; }
.v-sig { stroke: var(--signal); stroke-width: 2; }
.v-sig-fill { fill: var(--signal); }
.v-text { stroke: rgba(233, 238, 247, .16); stroke-width: 6; }
.v-mono { stroke: rgba(255, 138, 71, .55); stroke-width: 6; }
.v-pick { stroke: rgba(255, 107, 26, .7); stroke-width: 1.5; fill: rgba(255, 107, 26, .08); }
.v-done { fill: var(--good); }
.v-halo { stroke: rgba(255, 107, 26, .35); stroke-width: 1.5; }
.v-node { fill: var(--bg); stroke: rgba(233, 238, 247, .3); stroke-width: 1.5; }
.v-dim { stroke: rgba(125, 211, 252, .5); stroke-width: 1; }

/* ---------- 3. Pick your speed ---------- */
.h-speeds { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
a.h-speed { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-6); border-radius: var(--r-lg); }
.h-speed .label { color: var(--text-2); }
.h-speed-v { font-size: clamp(1.875rem, 1.35rem + 1.5vw, 2.5rem); font-weight: 500; line-height: 1; letter-spacing: -.045em; color: var(--text); }
.h-speed-v.is-word { font-family: var(--font-head); font-weight: 600; letter-spacing: -.035em; }
.h-speed-p { color: var(--text-2); line-height: 1.55; }
.h-speed-p .num { color: var(--text); }
.h-speed-hot { border-color: rgba(255, 107, 26, .4); background: radial-gradient(110% 90% at 100% 0%, rgba(255, 107, 26, .16), transparent 60%), linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02)); }
.h-speed-hot .label { color: var(--signal-hi); }
.h-speed-hot .h-speed-v { color: var(--signal-hi); text-shadow: 0 0 28px var(--glow); }
/* dispatch track: order (left) to dispatch, three working days wide */
.h-track { position: relative; display: block; height: 18px; margin: 2px 0 2px; }
.h-track::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; border-radius: 2px; background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .14) 0 calc(33.33% - 3px), transparent calc(33.33% - 3px) 33.33%); }
.h-track i { position: absolute; top: 3px; left: calc(var(--at) * (100% - 12px)); width: 12px; height: 12px; border-radius: 50%; background: var(--text-2); box-shadow: 0 0 0 4px rgba(233, 238, 247, .08); }
.h-speed-hot .h-track i { background: var(--signal); box-shadow: 0 0 0 4px rgba(255, 107, 26, .18), 0 0 14px var(--signal); }
/* Rows (label, figure, rail, text) line up across the three cards even when one figure wraps. */
@supports (grid-template-rows: subgrid) {
  a.h-speed { display: grid; grid-row: span 4; grid-template-rows: subgrid; gap: var(--space-4); }
}
.h-speed-note { margin: var(--space-5) 0 0; display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline; }

/* ---------- 4. Bento ---------- */
.h-bento { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.h-b, a.h-b { display: flex; flex-direction: column; gap: 0; padding: var(--space-6); border-radius: var(--r-lg); min-height: 248px; overflow: hidden; }
.h-b-wide, a.h-b-wide { grid-column: span 2; flex-direction: row; align-items: stretch; gap: var(--space-6); }
.h-b-text { display: flex; flex-direction: column; flex: 1 1 0; min-width: 0; }
.h-b h3 { font-size: clamp(1.25rem, 1.1rem + .5vw, 1.5rem); letter-spacing: -.02em; }
.h-b p { margin-bottom: var(--space-4); max-width: 46ch; }
.h-b .go { margin-top: auto; }
.h-b-text h3 { margin-top: auto; }
a.h-b { transition: transform var(--dur-2) var(--ease), border-color var(--dur-2), box-shadow var(--dur-2); }
.h-b:not(a):hover { border-color: rgba(255, 255, 255, .14); }
/* sliced layers: the card's visual. Top rows are not sliced yet (dashed), the signal row is the cut, rows below are done. */
.h-layers { position: relative; flex: 0 0 40%; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 var(--space-2); }
.h-layers i { display: block; height: 2px; border-radius: 2px; margin-inline: auto; width: var(--w); background: rgba(233, 238, 247, .5); }
.h-layers i:nth-child(-n+4) { height: 1px; background: repeating-linear-gradient(90deg, rgba(233, 238, 247, .28) 0 4px, transparent 4px 8px); }
.h-layers i:nth-child(5) { position: relative; height: 2px; background: var(--signal); box-shadow: 0 0 14px var(--signal); width: calc(var(--w) + 4%); }
.h-layers i:nth-child(5)::after { content: ""; position: absolute; left: -18%; right: -18%; top: 0; height: 1px; background: linear-gradient(90deg, transparent, rgba(255, 107, 26, .5), transparent); }
.h-layers i:nth-child(1) { --w: 46%; } .h-layers i:nth-child(2) { --w: 40%; } .h-layers i:nth-child(3) { --w: 38%; } .h-layers i:nth-child(4) { --w: 44%; }
.h-layers i:nth-child(5) { --w: 54%; } .h-layers i:nth-child(6) { --w: 64%; } .h-layers i:nth-child(7) { --w: 70%; } .h-layers i:nth-child(8) { --w: 72%; }
.h-layers i:nth-child(9) { --w: 70%; } .h-layers i:nth-child(10) { --w: 64%; } .h-layers i:nth-child(11) { --w: 58%; }
.h-layers i:nth-child(6) { background: rgba(255, 138, 71, .6); } .h-layers i:nth-child(7) { background: rgba(255, 170, 120, .5); }
/* finish glyph: rough to smooth */
.h-glyph { display: block; width: 100%; height: 44px; margin-bottom: auto; padding-bottom: var(--space-5); }
.h-glyph-finish { background:
  repeating-linear-gradient(90deg, rgba(233, 238, 247, .26) 0 2px, transparent 2px 6px) left center / 48% 18px no-repeat,
  linear-gradient(90deg, rgba(255, 107, 26, .0), rgba(255, 107, 26, .6)) right center / 46% 2px no-repeat; }
/* swatches */
.h-swatches { display: flex; gap: 8px; margin-bottom: auto; padding-bottom: var(--space-5); }
.h-swatches i { width: 28px; height: 28px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .18); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), inset 0 -8px 12px rgba(0, 0, 0, .2); transition: transform var(--dur-2) var(--ease); }
.h-swatches i:nth-child(1) { background: #F2F0EA; } .h-swatches i:nth-child(2) { background: #1B1E24; } .h-swatches i:nth-child(3) { background: var(--signal); }
.h-swatches i:nth-child(4) { background: #3E6FD8; } .h-swatches i:nth-child(5) { background: #7A8596; }
a.h-b:hover .h-swatches i:nth-child(odd) { transform: translateY(-3px); }
.h-sketch { flex: 0 0 40%; display: grid; place-items: center; }
.h-sketch svg { width: 100%; max-width: 260px; height: auto; }

/* ---------- 5. Materials ---------- */
.h-head-split .matline { margin: 0; font-size: 1rem; }
.h-mats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }
.h-mat { padding: var(--space-6); border-radius: var(--r-lg); }
.h-mat-i { display: block; margin-bottom: var(--space-6); font-size: var(--fs-mono-s); letter-spacing: .12em; color: var(--text-3); }
.h-mat h3 { font: 500 clamp(1.75rem, 1.4rem + 1vw, 2.25rem)/1 var(--font-mono); letter-spacing: -.04em; margin-bottom: var(--space-3); }
.h-mat::after { content: ""; position: absolute; left: var(--space-6); right: var(--space-6); top: 62px; height: 1px; background: linear-gradient(90deg, var(--line-strong), transparent); }

/* ---------- 6. Promises ---------- */
.h-promises { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line-strong); }
.h-promise { position: relative; padding: var(--space-6) var(--space-6) var(--space-2) 0; }
.h-promise + .h-promise { padding-left: var(--space-6); border-left: 1px solid var(--line); }
.h-promise::before { content: ""; position: absolute; top: -1px; left: 0; width: 48px; height: 1px; background: var(--signal); box-shadow: 0 0 12px var(--signal); }
.h-promise + .h-promise::before { left: var(--space-6); }
.h-promise h3 { font-size: clamp(1.1875rem, 1.1rem + .35vw, 1.375rem); letter-spacing: -.02em; margin-bottom: var(--space-3); text-wrap: balance; }
.h-promise p { color: var(--text-2); margin: 0; }
.h-match { margin: var(--space-6) 0 0; }

/* ---------- 7. Agents ---------- */
.h-agents-in { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 72px); align-items: center; }
.h-agents-copy > .muted { max-width: 56ch; }
.h-ticks { list-style: none; padding: 0; margin: var(--space-5) 0 0; display: grid; gap: var(--space-3); }
.h-ticks li { position: relative; padding-left: 26px; color: var(--text-2); font-size: .9375rem; line-height: 1.55; max-width: 58ch; }
.h-ticks li::before { content: ""; position: absolute; left: 2px; top: .52em; width: 10px; height: 5px; border-left: 1.5px solid var(--signal-hi); border-bottom: 1.5px solid var(--signal-hi); transform: rotate(-45deg); }
.h-term { padding: var(--space-5); border-radius: var(--r-lg); background: linear-gradient(180deg, rgba(10, 16, 28, .92), rgba(5, 8, 15, .92)); }
.h-term .panel-head { letter-spacing: .06em; text-transform: none; }
.h-tools { list-style: none; margin: 0; padding: 0; counter-reset: t; font: 400 .875rem/1.4 var(--font-mono); }
.h-tools li { counter-increment: t; display: grid; grid-template-columns: 28px minmax(0, auto) 1fr; align-items: baseline; gap: 4px 14px; padding: 11px 6px; border-bottom: 1px dashed var(--line); }
.h-tools li:last-child { border-bottom: 0; }
.h-tools li::before { content: counter(t, decimal-leading-zero); color: var(--text-3); font-size: .75rem; }
.h-tools code { padding: 0; border: 0; background: none; color: var(--ice); font-size: .875rem; }
.h-tools span { color: var(--text-3); font-size: .8125rem; text-align: right; }
.h-tools i { font-style: normal; color: var(--text-2); }
.h-tools .is-hot { margin: 0 -6px; padding-inline: 12px; border-radius: 8px; border-bottom-color: transparent; background: rgba(255, 107, 26, .08); box-shadow: inset 0 0 0 1px rgba(255, 107, 26, .3); }
.h-tools .is-hot code { color: var(--signal-hi); }

/* ---------- 8. Closing CTA ---------- */
.h-cta { padding: clamp(56px, 8vw, 112px) 0; }
.h-cta-in {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-5) var(--space-7);
  padding: clamp(28px, 5vw, 56px); border-radius: var(--r-lg); border: 1px solid rgba(255, 107, 26, .35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 40px 90px -40px rgba(255, 107, 26, .4);
}
.h-cta-in.corners::before { inset: 10px; border-radius: 0; }
.h-cta-in h2 { margin-bottom: var(--space-3); }
.h-cta-in .muted { margin: 0; max-width: 52ch; }
.h-cta-in .btns { margin: 0; }
.h-trust { grid-column: 1 / -1; margin: 0; padding-top: var(--space-5); border-top: 1px solid var(--line); color: var(--text-3); font: 400 .8125rem/1.6 var(--font-mono); letter-spacing: .01em; }

/* ---------- Responsive ---------- */
@media (max-width: 1020px) {
  .h-hero-in { grid-template-columns: minmax(0, 1fr); }
  .h-instr { aspect-ratio: 16 / 11; max-height: 520px; }
  .h-title { max-width: 18ch; }
  .h-readouts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-agents-in { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .h-steps, .h-speeds, .h-mats, .h-promises { grid-template-columns: minmax(0, 1fr); }
  .h-steps { gap: var(--space-6); }
  .h-rail { display: none; }
  .h-viz { max-width: 420px; }
  .h-bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .h-b-wide, a.h-b-wide { grid-column: 1 / -1; }
  .h-promise, .h-promise + .h-promise { padding: var(--space-5) 0; border-left: 0; }
  .h-promise + .h-promise { border-top: 1px solid var(--line); }
  .h-promise + .h-promise::before { left: 0; }
  .h-cta-in { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .h-hero-in { padding-top: var(--space-6); gap: var(--space-6); }
  .h-instr { aspect-ratio: 1 / 1.02; }
  .h-instr-head, .h-hud { padding: 14px 18px; }
  .h-hud { gap: var(--space-5); }
  .h-hud-h { display: none !important; }
  .h-readouts { grid-template-columns: minmax(0, 1fr); }
  .h-readouts .readout { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; padding: 16px 18px; }
  .h-readouts .readout dt { grid-row: 1; }
  .h-readouts .readout dd { grid-row: 1 / span 2; grid-column: 2; align-self: center; }
  .h-readouts .readout .sub { grid-column: 1; }
  .h-bento { grid-template-columns: minmax(0, 1fr); }
  .h-b, .h-speed, .h-mat { padding: var(--space-5); }
  .h-b { min-height: 0; }
  .h-b-wide, a.h-b-wide { flex-direction: column-reverse; }
  .h-b-text h3 { margin-top: 0; }
  .h-layers { flex-basis: auto; padding: var(--space-2) 0 var(--space-3); }
  .h-sketch { flex-basis: auto; }
  .h-sketch svg { max-width: 200px; }
  .h-tools li { grid-template-columns: 24px minmax(0, 1fr); }
  .h-tools span { grid-column: 2; text-align: left; }
  .h-head-split { align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  .h-instr-title i { animation: none; }
}
