/* ============================================================
   MIDNIGHT: the shipped theme. Loaded last, after refit.css.
   Three colours and nothing else:
     black     #050505   the page (as it was under the refit)
     stone     #AFAEA2   ink, hairlines, wireframes
     crimson   #D21319   the one accent (was international orange)
   Type is the site's own: Saira Semi Condensed capitals for the
   headlines, Geist Mono for nav, buttons, taglines and data, Geist for
   body copy. A serif, Cormorant, sets the HEXERA wordmark and the
   headings inside sections (the mesh steps, the pipeline's step and phase
   names, the industry names, the frontier label, the footer's column
   heads). The three big statements (the hero, "Engineers lose weeks",
   "Send us a part") stay in Saira: they open, turn and close the page in
   one voice.
   The hero art and the smoke over Industries are the original
   plates, re-inked: orange to crimson, blue-grey to stone.
   Everything here overrides a token or repaints a colour. Layout
   and motion stay where they were, so dropping the link to this
   file returns the orange look.
   ============================================================ */

@font-face {
  font-family: "Cormorant Fallback";
  src: local("Georgia"), local("Times New Roman");
  size-adjust: 88%; ascent-override: 105%; descent-override: 32%; line-gap-override: 0%;
}

:root {
  --stone:        #AFAEA2;
  --stone-hi:     #E2E0D4;
  --crimson-fill: #D21319;
  --crimson-type: #E0302F;      /* display sizes */

  --bg:    #050505;
  --bg-rgb: 5,5,5;
  --bg-2:  #0c0c0c;
  --black: #050505;
  --green: #0a0a0a;             /* the raised panel under the ambition list */

  --ink:   var(--stone-hi);
  --muted: #B9B8AD;
  --faint: #86857C;

  /* the accent, in the two strengths it is used at: type and fills */
  --gold:      #E8403D;         /* crimson, lifted a step so small type holds on black */
  --gold-soft: #F25E57;
  --gold-ink:  #FFF6EE;
  --crimson:      #E8403D;
  --crimson-soft: #F25E57;
  /* the reference navy (#1B1E4A) lifted to read on black: used as a hint only, never a fill */
  --blue:         #6872D6;

  /* the old interactive tint retires into stone */
  --teal:      var(--stone);
  --teal-deep: #8E8D82;

  --line:   rgba(175, 174, 162, 0.14);
  --line-2: rgba(175, 174, 162, 0.28);

  --mesh-line-rgb:   175,174,162;
  --mesh-accent-rgb: 226,44,44;
  --mesh-ink-rgb:    226,224,212;
  /* the reference picture's navy (#1B1E4A), lifted so a wireframe reads on black: the second object colour */
  --mesh-blue-rgb:   104,114,214;
  --fluid-line-rgb:   175,174,162;
  --fluid-accent-rgb: 210,19,25;

  --font-serif: "Cormorant", "Cormorant Fallback", Georgia, "Times New Roman", serif;   /* the wordmark, the pipeline names, the footer heads */
}

::selection { background: var(--crimson-fill); color: #fff; }
:focus-visible { outline-color: var(--blue); }

/* ---------- Hero art: the original plate, re-inked ---------- */
.hero-art { background: var(--bg) url("assets/hero-bg-midnight.jpg?v=4") center / cover no-repeat; }
.page-bg {
  background:
    radial-gradient(115% 80% at 82% -12%, rgba(175, 174, 162, 0.07), transparent 56%),
    radial-gradient(95% 70% at -5% 6%, rgba(210, 19, 25, 0.07), transparent 52%),
    var(--bg);
}

/* ---------- Nav ---------- */
.scrollprog i { background: var(--crimson-fill); }
.brand__word { font-family: var(--font-serif); font-weight: 600; font-size: 1.2rem; letter-spacing: 0.2em; }
.btn--solid { background: var(--stone-hi); color: #0a0a0a; border-color: var(--stone-hi); }

/* ---------- Buttons ---------- */
.btn--gold { background: var(--crimson-fill); border-color: var(--crimson-fill); color: var(--gold-ink); }
.btn--gold:hover { background: #E3262B; border-color: #E3262B; box-shadow: none; }
.btn--ghost { border-color: rgba(175, 174, 162, 0.6); }
.btn--ghost:hover { border-color: var(--stone-hi); box-shadow: none; }

/* ---------- Headlines: the site's own face and sizes, in the theme's two colours ----------
   The outlined second lines of the refit are solid stone, so each headline reads
   crimson, then stone. */
.hero__l--solid { color: var(--crimson-type); }
.hero__l--outline, .il2__out, .h2 em, .fend__h em {
  color: var(--stone); -webkit-text-stroke: 0; font-style: normal;
}
.hero__sub .num { color: var(--gold); }
.il2__pre { color: var(--stone-hi); }
.il2__pre b { color: var(--crimson-type); }
/* a section's own heading is in the serif, like everything else inside the section */
.h2 { color: var(--crimson-type); font-family: var(--font-serif); font-weight: 500; letter-spacing: 0.01em; line-height: 0.98;
  font-size: clamp(2.2rem, 1.2rem + 2.3vw, 3.5rem); }
.fend__h { color: var(--crimson-type); }
.fend__col-h { font-family: var(--font-serif); font-size: 1.3rem; font-weight: 500; }
/* the serif also sets the headings inside the scroll sections: the mesh steps, the industry names, the frontier label */
.mstep__h, .spec-env__name, .amb__label-t { font-family: var(--font-serif); font-weight: 500; letter-spacing: 0; text-transform: none; }
.mstep__h { font-size: clamp(1.9rem, 1.3rem + 1.6vw, 2.9rem); line-height: 1; }
.spec-env__name { font-size: clamp(2.1rem, 1.4rem + 2vw, 3.4rem); line-height: 1; }
.amb__label-t { font-size: clamp(2.1rem, 1.3rem + 2.4vw, 3.5rem); line-height: 0.98; }

/* ---------- Product window (hero demo): neutral blacks, crimson accents ---------- */
.win { background: #161615; }
.win__bar { background: #0a0a0a; }
.chat { background: #111110; }
.msg--user .msg__body { background: rgba(210, 19, 25, 0.14); border-color: rgba(232, 64, 61, 0.4); color: var(--stone-hi); }
.pipe__spin.is-done { background: rgba(175, 174, 162, 0.18); }
.agent.is-done .agent__ic { background: rgba(175, 174, 162, 0.16); }
.tchip { border-color: rgba(175, 174, 162, 0.4); }
.mesh-loading-spinner { border-color: rgba(175, 174, 162, 0.15); border-top-color: var(--stone); }
.wl-corner { border-color: rgba(175, 174, 162, 0.55); }
.wl-submit:hover { box-shadow: none; }

/* ---------- Pills, tags ---------- */
.pill--orange, .mstep__tag, .spec-env__mode {
  color: var(--gold); border-color: rgba(232, 64, 61, 0.5); background: rgba(210, 19, 25, 0.1);
}

/* ---------- Pipeline rail ---------- */
.flow__map-loop, .rail__loop-path { stroke: rgba(232, 64, 61, 0.65); }
.rail__fill { background: linear-gradient(to bottom, rgba(210, 19, 25, 0.25), var(--crimson-fill) 18%, var(--crimson-fill)); }
.rail__fill::after { background: var(--gold); box-shadow: 0 0 14px 3px rgba(210, 19, 25, 0.5); }
.rail__step.is-active::before, .rail__step.is-past::before { border-top-color: rgba(232, 64, 61, 0.55); }
.rail__step.is-past .rail__node { border-color: rgba(232, 64, 61, 0.6); }
.rail__step.is-active .rail__node { box-shadow: 0 0 0 4px rgba(210, 19, 25, 0.18); }
.card__st--ok { color: var(--stone-hi); }
.kv--ask b em { border-color: rgba(232, 64, 61, 0.55); }

/* ---------- Industries: the original smoke plate, re-inked ---------- */
.indx::before { background-image: url("assets/header-smoke3-midnight.png?v=1"); }

/* ---------- Footer ---------- */
.fend__lead::before { background: radial-gradient(closest-side, rgba(210, 19, 25, 0.2), rgba(210, 19, 25, 0.06) 55%, transparent 75%); }
.fend__submit { background: var(--crimson-fill); color: var(--gold-ink); }
.fend__submit:hover { background: #E3262B; }

/* ============================================================
   ASCII: the statement, acted out (ascii.js).
   An airliner wing with its engine and winglet, drawn as real
   text. It starts as a shaded solid with its panel lines. First it is meshed by
   hand, one cell at a time ("Engineers lose weeks to manual
   meshing"). Then the mesh sweeps the whole wing in one pass
   ("We take that work away").
   ============================================================ */
.interlude { min-height: 86vh; }
@media (min-width: 960px) {
  /* the statement keeps the room its lines need; the wing takes the rest, and runs on past the
     page's right margin to a finger's width from the edge */
  .interlude {
    --il-pad: max(var(--pad-x), calc((100vw - 1560px) / 2));
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); column-gap: clamp(1.5rem, 3vw, 3.5rem);
    padding-left: var(--il-pad); padding-right: var(--il-pad);
  }
  .interlude .il2 { text-align: left; margin: 0; justify-self: start; }
  .interlude .ascii { justify-self: end; width: calc(100% + var(--il-pad) - 1.5rem); max-width: 1180px; margin-right: calc(1.5rem - var(--il-pad)); }
}
.ascii { margin: 0; width: 100%; max-width: 820px; justify-self: center; display: grid; gap: 1rem; }
.ascii__stage { position: relative; width: 100%; aspect-ratio: 72 / 50; overflow: hidden; }
.ascii__stage pre {
  position: absolute; inset: 0; margin: 0; font-family: var(--font-mono); font-weight: 500;
  font-size: var(--ascii-fs, 10px); line-height: 1; letter-spacing: 0; white-space: pre;
  user-select: none; -webkit-user-select: none;
}
.ascii__stage pre[data-ascii-solid] { color: rgba(175, 174, 162, 0.7); }
.ascii__stage pre[data-ascii-line]  { color: var(--stone-hi); }
.ascii__stage pre[data-ascii-hot]  { color: var(--gold); }
@media (max-width: 959px) {
  .interlude { row-gap: 3rem; padding-top: 5rem; padding-bottom: 5rem; }
  .ascii { max-width: 520px; }
}

/* ---------- Labels: the word, and nothing else ----------
   The step tags over the mesh scroll and the mode line over each industry were
   small tinted boxes. They are plain mono capitals now: no box, no rule. */
.mstep__tag, .spec-env__mode {
  padding: 0; border: 0; border-radius: 0; background: none;
  letter-spacing: 0.22em; color: var(--gold);
}

/* ============================================================
   PIPELINE: four plates.
   Each phase is a spread: the copy on one side, a figure drawn in
   text on the other, alternating down the page. No cards, no pills,
   no rail. The header carries the whole pipeline as one diagram.
   ============================================================ */
/* the header: the statement on the left, the pipeline as a short vertical list on the right */
.flow__head { grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr); grid-template-rows: 1fr auto auto 1fr; align-items: start; column-gap: clamp(2rem, 5vw, 6rem); row-gap: 0; }
/* the statement sits level with the middle of the line beside it */
.flow__head .h2 { margin-top: 0; grid-row: 2; }
.flow__head .flow__lede { grid-row: 3; }
.flow__lede { max-width: 44ch; }
.flowline { grid-column: 2; grid-row: 1 / -1; justify-self: center; display: block; width: min(100%, 520px); height: auto; overflow: visible; }
/* the line itself: a faint dotted path, with dashes running along it the way the air runs in the footer */
.flowline__path { fill: none; stroke: var(--stone); stroke-opacity: 0.8; stroke-width: 0.9; stroke-dasharray: 0.5 2.9; stroke-linecap: round; }
.flowline__run { fill: none; stroke: var(--blue); stroke-width: 1; stroke-linecap: round; stroke-dasharray: 15 49; animation: flowline-run 2.6s linear infinite; }
.flowline__path--retry { stroke: var(--gold); stroke-opacity: 0.95; }
.flowline__run--retry { stroke: var(--gold); stroke-dasharray: 9 55; animation-duration: 3.4s; }
@keyframes flowline-run { to { stroke-dashoffset: -64; } }
.flowline__head { fill: var(--stone-hi); }
.flowline__head--retry { fill: var(--gold); }
/* each step's number sits on the line, the way a contour line carries its height */
.flowline__s rect { fill: var(--bg); }
.flowline__no { font-family: var(--font-mono); font-weight: 500; font-size: 7.5px; letter-spacing: 0.14em; text-anchor: middle; text-transform: uppercase; fill: var(--gold); }
.flowline__n { font-family: var(--font-serif); font-weight: 500; font-size: 21px; fill: var(--ink); }
.flowline__d { font-family: var(--font-body); font-size: 9.6px; fill: var(--muted); }
.flowline__s--end .flowline__no { fill: var(--faint); }
.flowline__s--end .flowline__n { fill: var(--stone); }
.flowline__s--end .flowline__d { fill: var(--faint); }
.flowline__retry { font-family: var(--font-mono); font-weight: 500; font-size: 7px; letter-spacing: 0.16em; text-transform: uppercase; fill: var(--gold); }
@media (prefers-reduced-motion: reduce) { .flowline__run { animation: none; } }
@media (max-width: 1100px) {
  .flow__head { grid-template-columns: 1fr; grid-template-rows: none; }
  .flow__head .h2, .flow__head .flow__lede { grid-row: auto; }
  .flowline { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 3rem; width: min(100%, 460px); }
}

.phases { list-style: none; margin: clamp(4rem, 10vh, 7rem) 0 0; padding: 0; }
.phase {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: center;
  column-gap: clamp(2.5rem, 7vw, 8rem); row-gap: 2.5rem;
  padding: clamp(4.5rem, 12vh, 8rem) 0; border-top: 1px solid var(--line);
}
.phase:nth-child(even) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.phase:nth-child(even) .phase__copy { order: 2; }
.phase:last-child { padding-bottom: clamp(2rem, 6vh, 4rem); }

.phase__no {
  margin: 0 0 1.4rem; font-family: var(--font-mono); font-weight: 500; font-size: 0.7rem;
  letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted);
}
.phase__no b { font-weight: 500; color: var(--gold); margin-right: 0.9em; }
.phase__h {
  margin: 0; font-family: var(--font-serif); font-weight: 500; letter-spacing: 0; text-wrap: balance;
  font-size: clamp(2rem, 1.3rem + 2.1vw, 3.4rem); line-height: 1; color: var(--ink);
}
.phase__p { margin: 1.4rem 0 0; max-width: 46ch; color: var(--muted); line-height: 1.65; text-wrap: pretty;
  font-size: clamp(0.95rem, 0.92rem + 0.15vw, 1.02rem); }
.phase__facts { margin: 1.6rem 0 0; font-family: var(--font-mono); font-size: 0.66rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted); }
.phase__facts i { font-style: normal; color: var(--gold); margin: 0 0.5em; }

.plate { margin: 0; min-width: 0; }
.phase .plate { justify-self: center; max-width: 100%; }
.plate__art {
  margin: 0; font-family: var(--font-mono); font-weight: 500; line-height: 1.32; letter-spacing: 0; white-space: pre;
  /* sized so the widest line (--cols characters, 0.6em each) always fits its column */
  font-size: clamp(7px, calc((min(100vw, 1240px) - 2 * var(--pad-x)) / (var(--cols) * 0.6) * 0.98), 13px);
  color: rgba(175, 174, 162, 0.78); overflow: hidden;
  user-select: none; -webkit-user-select: none;
}
@media (min-width: 1101px) { .plate__art { font-size: clamp(9px, calc(0.56 * min(100vw, 1240px) / (var(--cols) * 0.6) * 0.96), 13px); } }
.plate__art b { font-weight: 500; color: var(--stone-hi); }
.plate__art i { font-style: normal; color: var(--gold); }
.plate__art .pl { display: block; min-height: 1.32em; opacity: 0; transform: translateY(0.35em);
  transition: opacity 0.5s var(--ease-expo), transform 0.5s var(--ease-expo); transition-delay: calc(var(--i, 0) * 26ms); }
.plate.is-in .pl { opacity: 1; transform: none; }
.plate__art .caret { animation: blink 1.1s steps(2) infinite; }
.plate__cap { margin-top: 1.5rem; padding-top: 0.8rem; border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--faint); }
.plate__cap b { font-weight: 500; color: var(--muted); margin-right: 0.9em; }
/* drawings keep square-ish cells: one line per row, so uprights join */
.plate__art--draw { line-height: 1.02; }
.plate__art--draw .pl { min-height: 1.02em; }
/* the lines of words under a drawing get room to be read */
.plate__art--draw .pl--tx { min-height: 1.5em; line-height: 1.5; }
.plate__art--map { line-height: 1.2; }
.plate__art--map .pl { min-height: 1.2em; }
@media (max-width: 1100px) {
  .phase, .phase:nth-child(even) { grid-template-columns: 1fr; }
  .phase:nth-child(even) .phase__copy { order: 0; }
  .phase .plate { justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .plate__art .pl { opacity: 1; transform: none; transition: none; }
  .plate__art .caret { animation: none; }
}

/* ---------- Footer: two full screens ----------
   Screen one is the pitch, with the meshed cube behind it (the cube's canvas lives in
   .fend__stage, exactly one screen tall, so it is drawn as it always was).
   Screen two is the wind tunnel: the car and the air fill the whole screen, and the link
   columns and the legal line are set over it. */
.footer--end { min-height: 0; }
.fend__stage { position: absolute; top: 0; left: 0; right: 0; height: 100vh; height: 100svh; pointer-events: none; }
.fend__lead { flex: none; min-height: calc(100vh - clamp(2.5rem, 6vh, 5rem)); min-height: calc(100svh - clamp(2.5rem, 6vh, 5rem)); }

.fend__foot {
  position: static; width: min(100%, 1320px); justify-content: space-between;
  min-height: calc(100vh - clamp(2.5rem, 6vh, 5rem)); min-height: calc(100svh - clamp(2.5rem, 6vh, 5rem));
  padding-top: calc(var(--nav-h) + clamp(2rem, 7vh, 5rem));
}
.tunnel { position: absolute; left: 0; right: 0; bottom: 0; height: 100vh; height: 100svh; overflow: hidden; pointer-events: none; }
.tunnel pre { position: absolute; inset: 0; margin: 0; font-family: var(--font-mono); font-weight: 500;
  font-size: 12px; line-height: 1; letter-spacing: 0; white-space: pre; overflow: hidden;
  user-select: none; -webkit-user-select: none; }
.tunnel pre[data-tunnel-car]  { color: rgba(175, 174, 162, 0.5); }
.tunnel pre[data-tunnel-carhi] { color: var(--stone-hi); }
.tunnel pre[data-tunnel-flow] { color: rgba(175, 174, 162, 0.62); }
.tunnel pre[data-tunnel-hot]  { color: rgba(232, 64, 61, 0.95); }

/* the links are set larger, to stand up to a full-screen scene behind them */
.fend__nav, .fend__bar { position: relative; z-index: 1; }
.fend__nav { width: 100%; margin: 0; gap: clamp(2rem, 5vw, 5rem); text-shadow: 0 0 14px #050505, 0 0 4px #050505; }
.fend__col { gap: 1rem; }
.fend__col-h { font-size: clamp(1.7rem, 1.2rem + 1.4vw, 2.6rem); line-height: 1; margin-bottom: 0.7rem; }
.fend__col a { font-size: clamp(1rem, 0.94rem + 0.35vw, 1.25rem); color: var(--ink); }
.fend__col a:hover { color: var(--gold); }
.fend__bar { width: 100%; font-size: 0.82rem; text-shadow: 0 0 10px #050505; }
.fend__bar a { font-size: 0.82rem; }

/* ---------- Figures always fit their column ----------
   A figure's type is sized from the width of the column it actually sits in (a container
   query unit), not from a guess at it, so a wide figure can never be cut off at the edge. */
.plate { container-type: inline-size; }
.phase .plate { justify-self: stretch; width: 100%; max-width: 100%; }
.plate__art { width: max-content; max-width: 100%; margin-inline: auto; overflow: visible;
  font-size: clamp(3px, calc(100cqw / (var(--cols) * 0.61)), 13px); }
.plate__cap { width: min(100%, calc(var(--cap-cols, 110) * 0.61 * 13px)); margin-inline: auto; }
@media (max-width: 1100px) {
  .plate__art { margin-inline: 0; }
  .plate__cap { margin-inline: 0; }
}
}
