/* ============================================================
   pi-arcweld — the page is a weld.
   Two members: steel monochrome. One filler: titanium heat.
   ============================================================ */

/* registered so scroll-driven keyframes can interpolate it */
@property --weld {
  syntax: "<number>";
  inherits: true;
  initial-value: 0;
}

:root {
  color-scheme: dark;

  /* night shop */
  --steel-0: #0a0f17;
  --steel-1: #0e1520;
  --steel-2: #131c2a;
  --ink: #e9eef6;
  --ink-dim: #94a4ba;
  --ink-faint: #55657b;
  --line: rgba(233, 238, 246, 0.09);
  --line-strong: rgba(233, 238, 246, 0.22);

  --arc: #7fb2ff;
  --arc-core: #edf5ff;
  --arc-glow: rgba(94, 148, 255, 0.55);

  /* titanium oxidation sequence: straw, bronze, purple, violet, blue */
  --heat-1: #f5c34d;
  --heat-2: #e2894f;
  --heat-3: #b76bd6;
  --heat-4: #7b7df2;
  --heat-5: #4b93f0;
  --heat-run: linear-gradient(90deg, var(--heat-1), var(--heat-2) 30%, var(--heat-3) 55%, var(--heat-4) 78%, var(--heat-5));
  --heat-drop: linear-gradient(180deg, var(--heat-1), var(--heat-2) 30%, var(--heat-3) 55%, var(--heat-4) 78%, var(--heat-5));

  --display: "Big Shoulders", "Arial Narrow", "Helvetica Neue", sans-serif;
  --body: "Schibsted Grotesk", "Helvetica Neue", system-ui, sans-serif;
  --mono: "Martian Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --content: 90rem;
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --header-h: 4.25rem;
  --rail-w: 0rem;
  --weld: 0;
}

:root[data-theme="day"] {
  color-scheme: light;

  /* mill sheet at noon */
  --steel-0: #edf0f4;
  --steel-1: #f6f8fb;
  --steel-2: #e1e6ee;
  --ink: #0f1621;
  --ink-dim: #46586f;
  --ink-faint: #8493a9;
  --line: rgba(15, 22, 33, 0.11);
  --line-strong: rgba(15, 22, 33, 0.26);

  --arc: #1d5bd6;
  --arc-core: #0d3ea8;
  --arc-glow: rgba(29, 91, 214, 0.35);

  --heat-1: #c08a16;
  --heat-2: #c05f27;
  --heat-3: #9440bd;
  --heat-4: #5356e0;
  --heat-5: #1f6bd9;
}

* { box-sizing: border-box; }

html {
  min-width: 20rem;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 2rem);
  overflow-x: clip;
}

body {
  margin: 0;
  min-width: 20rem;
  color: var(--ink);
  background: var(--steel-0);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-x: clip;
  transition: color 260ms ease, background-color 260ms ease;
}

/* distant arc light behind the hero */
body::before {
  content: "";
  position: fixed;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(52rem 34rem at 18% -6%, var(--arc-glow), transparent 62%);
  opacity: 0.16;
}

:root[data-theme="day"] body::before { opacity: 0.12; }

::selection { color: var(--steel-0); background: var(--arc); }

a { color: inherit; }
button, input { font: inherit; }

a:focus-visible,
button:focus-visible,
pre:focus-visible {
  outline: 2px solid var(--arc);
  outline-offset: 3px;
  border-radius: 1px;
}

strong { font-weight: 600; }

code {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.82em;
  color: var(--ink);
}

/* ---------- utility voices ---------- */

.tag,
.spec-key,
.plate-tag,
.ledger-key,
.pass-id,
.log-label,
.footer-meta,
.rail-pass a {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.shell {
  width: min(100% - var(--gutter) * 2, var(--content));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 200;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--steel-0);
  background: var(--arc);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  transform: translateY(-220%);
  transition: transform 160ms ease;
}

.skip-link:focus { transform: translateY(0); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ============================================================
   Seam rail — the weld runs the length of the page.
   Progress bead + arc dot + pass markers double as navigation.
   ============================================================ */

.seam-rail {
  position: fixed;
  z-index: 60;
  top: 0;
  bottom: 0;
  left: 0;
  display: none;
  width: var(--rail-w);
  border-right: 1px solid var(--line);
  background: color-mix(in srgb, var(--steel-0) 72%, transparent);
  backdrop-filter: blur(10px);
}

.rail-track {
  position: absolute;
  inset: calc(var(--header-h) + 1.75rem) auto 1.75rem 50%;
  width: 2px;
  translate: -50% 0;
  background:
    repeating-linear-gradient(180deg,
      var(--line-strong) 0 6px,
      transparent 6px 14px);
}

.rail-bead {
  position: absolute;
  inset: 0;
  background: var(--heat-drop);
  clip-path: inset(0 0 calc((1 - var(--weld)) * 100%) 0);
  box-shadow: 0 0 12px var(--arc-glow);
}

.rail-arc {
  position: absolute;
  left: 50%;
  top: calc(var(--weld) * 100%);
  width: 9px;
  height: 9px;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--arc-core);
  box-shadow:
    0 0 6px 1px var(--arc-core),
    0 0 18px 4px var(--arc-glow);
}

@media (prefers-reduced-motion: no-preference) {
  .rail-arc { animation: arc-breathe 2.6s ease-in-out infinite; }
}

@keyframes arc-breathe {
  50% { box-shadow: 0 0 8px 2px var(--arc-core), 0 0 26px 7px var(--arc-glow); }
}

.rail-passes {
  position: absolute;
  inset: var(--header-h) 0 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 2.5rem 0;
  list-style: none;
}

.rail-pass a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.75rem 0.4rem;
  color: var(--ink-faint);
  background: var(--steel-0);
  writing-mode: vertical-rl;
  text-decoration: none;
  transition: color 180ms ease;
}

.rail-pass a::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.rail-pass a:hover { color: var(--ink); }

.rail-pass a[aria-current="true"] {
  color: var(--ink);
}

.rail-pass a[aria-current="true"]::before {
  background: var(--arc);
  box-shadow: 0 0 8px 1px var(--arc-glow);
}

/* mobile: the seam survives as a slim bead on the left edge */
.edge-bead {
  position: fixed;
  z-index: 90;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  pointer-events: none;
  background: var(--heat-drop);
  clip-path: inset(0 0 calc((1 - var(--weld)) * 100%) 0);
}

@media (min-width: 64rem) {
  :root { --rail-w: 5.5rem; }
  .seam-rail { display: block; }
  .edge-bead { display: none; }
}

/* ============================================================
   Header
   ============================================================ */

.site-header {
  position: sticky;
  z-index: 80;
  top: 0;
  height: var(--header-h);
  padding-left: var(--rail-w);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--steel-0) 84%, transparent);
  backdrop-filter: blur(14px) saturate(120%);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  line-height: 1;
  text-decoration: none;
}

.brand-mark { width: 2.1rem; height: 2.1rem; flex: none; overflow: visible; }

.mark-leg {
  fill: none;
  stroke: var(--ink);
  stroke-width: 4.6;
  stroke-linecap: round;
}

.mark-bead {
  fill: none;
  stroke: url(#heat-mark);
  stroke-width: 5;
  stroke-linecap: round;
}

.mark-ripple {
  fill: none;
  stroke: var(--steel-0);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 0.012 0.055;
  opacity: 0.35;
}

.mark-arcdot { fill: var(--arc-core); }

@media (prefers-reduced-motion: no-preference) {
  .mark-bead,
  .mark-ripple {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation: seam-draw 900ms cubic-bezier(0.6, 0, 0.2, 1) 300ms forwards;
  }

  .mark-ripple {
    animation: seam-draw 900ms cubic-bezier(0.6, 0, 0.2, 1) 300ms forwards,
               ripple-settle 0ms linear 1250ms forwards;
  }

  .mark-arcdot {
    opacity: 0;
    animation: mark-arc-travel 900ms cubic-bezier(0.6, 0, 0.2, 1) 300ms forwards;
  }
}

@keyframes seam-draw { to { stroke-dashoffset: 0; } }
@keyframes ripple-settle { to { stroke-dasharray: 0.012 0.055; } }

@keyframes mark-arc-travel {
  0% { opacity: 1; transform: translateX(0); }
  92% { opacity: 1; }
  100% { opacity: 0; transform: translateX(36px); }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.header-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding-inline: 0.85rem;
  color: var(--ink-dim);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 160ms ease;
}

.header-link:hover { color: var(--ink); }
.header-link svg { width: 1.05rem; height: 1.05rem; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.icon-button:hover {
  border-color: var(--arc);
  background: color-mix(in srgb, var(--arc) 12%, transparent);
}

.icon-button svg { width: 1.1rem; height: 1.1rem; }

.menu-button { display: inline-grid; }
@media (min-width: 64rem) { .menu-button { display: none; } }

/* mobile overlay nav */
.overlay-nav {
  position: fixed;
  z-index: 70;
  inset: var(--header-h) 0 0;
  display: grid;
  align-content: start;
  padding: 2rem var(--gutter) 3rem;
  background: var(--steel-0);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.75rem);
  transition: opacity 200ms ease, transform 200ms ease;
}

.overlay-nav[data-open="true"] {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.overlay-nav a {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.overlay-nav .pass-id { color: var(--ink-faint); }

.overlay-nav .pass-word {
  font-family: var(--display);
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  font-weight: 700;
  letter-spacing: 0.015em;
  line-height: 1;
  text-transform: uppercase;
}

.overlay-nav a:hover .pass-word { color: var(--arc); }

@media (min-width: 64rem) { .overlay-nav { display: none; } }

/* ============================================================
   Main / hero
   ============================================================ */

main {
  display: block;
  padding-left: var(--rail-w);
}

section { scroll-margin-top: calc(var(--header-h) + 1rem); }

.hero { padding-block: clamp(4rem, 9vh, 8rem) 0; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 2rem;
  color: var(--ink-dim);
}

.tag::before {
  content: "";
  width: 2.6rem;
  height: 2px;
  background: var(--heat-run);
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-optical-sizing: auto;
  font-size: clamp(4.5rem, 12.5vw, 12rem);
  font-weight: 750;
  letter-spacing: 0.008em;
  line-height: 0.88;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: no-preference) {
  .is-striking .hero h1 {
    animation: hot-cool 1300ms ease-out 250ms backwards;
  }
}

@keyframes hot-cool {
  0% {
    color: var(--arc-core);
    text-shadow: 0 0 34px var(--arc-glow), 0 0 6px var(--arc-glow);
  }
  100% {
    color: var(--ink);
    text-shadow: 0 0 0 transparent;
  }
}

.hero-line2 {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 3.5vw, 3.5rem);
}

/* ---------- the weld run: joint line, bead, arc, flash, sparks ---------- */

.weld-run {
  position: relative;
  flex: 1 1 8rem;
  min-width: 6rem;
  height: 28px;
  align-self: center;
}

.weld-joint {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 1px;
  translate: 0 -50%;
  background: repeating-linear-gradient(90deg, var(--line-strong) 0 4px, transparent 4px 11px);
}

.weld-bead {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 4px;
  translate: 0 -50%;
  border-radius: 2px;
  background: var(--heat-run);
  filter: drop-shadow(0 0 7px var(--arc-glow));
}

/* stacked-dimes ripple over the bead */
.weld-bead::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(90deg,
    transparent 0 11px,
    color-mix(in srgb, var(--steel-0) 26%, transparent) 11px 13px);
}

.weld-arcdot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  translate: -50% -50%;
  background: var(--arc-core);
  box-shadow:
    0 0 8px 2px var(--arc-core),
    0 0 26px 8px var(--arc-glow);
  opacity: 0;
}

.weld-flash {
  position: absolute;
  top: 50%;
  left: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  translate: -50% -50%;
  pointer-events: none;
  background: radial-gradient(circle, var(--arc-core) 0%, var(--arc-glow) 30%, transparent 70%);
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .is-striking .weld-bead {
    clip-path: inset(-12px 100% -12px 0);
    animation: bead-draw 1150ms cubic-bezier(0.55, 0, 0.3, 1) 350ms forwards;
  }

  .is-striking .weld-arcdot {
    animation:
      arc-travel 1150ms cubic-bezier(0.55, 0, 0.3, 1) 350ms forwards,
      arc-breathe 2.6s ease-in-out 1.6s infinite;
  }

  .is-striking .weld-flash {
    animation: arc-strike 480ms ease-out 280ms;
  }
}

@keyframes bead-draw { to { clip-path: inset(-12px 0 -12px 0); } }

@keyframes arc-travel {
  0% { left: 0; opacity: 1; }
  100% { left: 100%; opacity: 1; }
}

@keyframes arc-strike {
  0% { opacity: 0; transform: scale(0.4); }
  22% { opacity: 0.95; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.25); }
}

/* reduced motion / no JS: the seam is simply welded */
@media (prefers-reduced-motion: reduce) {
  .weld-arcdot { opacity: 1; left: 100%; }
}

.spark {
  position: absolute;
  top: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  pointer-events: none;
  background: var(--heat-1);
  opacity: 0;
}

@media (prefers-reduced-motion: no-preference) {
  .is-striking .spark {
    animation: spark-fly 620ms cubic-bezier(0.2, 0.6, 0.4, 1) var(--spark-delay, 400ms) forwards;
  }
}

@keyframes spark-fly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--spark-x, 20px), var(--spark-y, -30px)) scale(0.3); }
}

.hero-under {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem 4rem;
  margin-top: clamp(2.5rem, 5vw, 4.5rem);
}

.hero-statement {
  max-width: 36rem;
  margin: 0;
  color: var(--ink-dim);
  font-size: clamp(1.1rem, 0.9vw + 0.9rem, 1.3rem);
  line-height: 1.55;
  text-wrap: pretty;
}

.hero-statement strong { color: var(--ink); font-weight: 500; }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.1rem;
  padding: 0.8rem 1.35rem;
  border: 1px solid var(--arc);
  color: var(--steel-0);
  background: var(--arc);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.button:hover {
  background: var(--arc-core);
  border-color: var(--arc-core);
  box-shadow: 0 0 22px var(--arc-glow);
}

.button--ghost {
  color: var(--ink);
  border-color: var(--line-strong);
  background: transparent;
}

.button--ghost:hover {
  color: var(--ink);
  border-color: var(--arc);
  background: color-mix(in srgb, var(--arc) 10%, transparent);
  box-shadow: none;
}

.button svg { width: 1rem; height: 1rem; }

/* ---------- joint diagram ---------- */

.joint {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  margin: clamp(3.5rem, 7vw, 6.5rem) 0 0;
  border: 1px solid var(--line);
  background: var(--steel-1);
}

.joint-plate {
  position: relative;
  padding: clamp(1.5rem, 3vw, 2.75rem);
  background:
    repeating-linear-gradient(180deg,
      color-mix(in srgb, var(--ink) 2%, transparent) 0 1px,
      transparent 1px 7px);
}

/* heat-affected zone: metal blushes near the seam */
.joint-plate--a { box-shadow: inset -4.5rem 0 4.5rem -4.5rem color-mix(in srgb, var(--heat-2) 26%, transparent); }
.joint-plate--b { box-shadow: inset 4.5rem 0 4.5rem -4.5rem color-mix(in srgb, var(--heat-2) 26%, transparent); }

.plate-tag { display: block; margin: 0 0 1.2rem; color: var(--ink-faint); }
.joint-plate--a .plate-tag { text-align: right; }

.plate-name {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 0.95;
  text-transform: uppercase;
}

.joint-plate--a .plate-name { text-align: right; }

.plate-note {
  max-width: 26rem;
  margin: 1rem 0 0;
  color: var(--ink-dim);
  font-size: 0.94rem;
  line-height: 1.55;
}

.joint-plate--a .plate-note { margin-left: auto; text-align: right; }

.joint-seam {
  position: relative;
  width: clamp(3.5rem, 6vw, 5.5rem);
  background: var(--steel-0);
}

.joint-seam::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 6px;
  translate: -50% 0;
  background: var(--heat-drop);
  box-shadow: 0 0 16px var(--arc-glow);
}

.joint-seam::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 6px;
  translate: -50% 0;
  background: repeating-linear-gradient(180deg,
    transparent 0 7px,
    color-mix(in srgb, var(--steel-0) 34%, transparent) 7px 9px);
}

.joint-seam-label {
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--steel-0);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  white-space: nowrap;
}

/* ---------- spec strip ---------- */

.spec-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-top: clamp(3rem, 6vw, 5rem);
  border-block: 1px solid var(--line);
}

.spec-cell {
  padding: 1.1rem 1.25rem 1.2rem 0;
}

.spec-cell + .spec-cell { padding-left: 1.25rem; border-left: 1px solid var(--line); }

.spec-key { display: block; margin-bottom: 0.3rem; color: var(--ink-faint); }

.spec-val {
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--ink-dim);
}

/* ============================================================
   Sections
   ============================================================ */

.pass-section { padding-block: clamp(6rem, 11vw, 10.5rem); }
.pass-section + .pass-section { border-top: 1px solid var(--line); }

.section-title {
  max-width: 14ch;
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3rem, 6.8vw, 6.75rem);
  font-weight: 700;
  letter-spacing: 0.012em;
  line-height: 0.9;
  text-transform: uppercase;
  text-wrap: balance;
}

.section-title code { text-transform: none; }

.section-lede {
  max-width: 34rem;
  margin: 0;
  color: var(--ink-dim);
  font-size: clamp(1.05rem, 0.6vw + 0.9rem, 1.2rem);
  line-height: 1.6;
  text-wrap: pretty;
}

.section-lede strong { color: var(--ink); font-weight: 500; }

/* Content remains readable before scripts run or sections enter view. */
.reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    transition: transform 600ms cubic-bezier(0.25, 0.6, 0.3, 1);
  }

  .js .reveal.is-set { opacity: 1; transform: none; }
}

/* ---------- root pass ---------- */

.root-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(3rem, 8vw, 9rem);
  align-items: start;
}

.root-copy { max-width: 34rem; }

.ledger {
  margin: 0;
  border-top: 1px solid var(--line-strong);
}

.ledger-row {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1.25rem;
  padding-block: 1.05rem;
  border-bottom: 1px solid var(--line);
}

.ledger-key { color: var(--ink-faint); padding-top: 0.2rem; }

.ledger-row dd {
  margin: 0;
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.82rem;
  color: var(--ink);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ledger-row dd span { color: var(--ink-dim); }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  color: var(--arc);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 0.25rem;
  transition: border-color 160ms ease;
}

.text-link:hover { border-color: var(--arc); }
.text-link svg { width: 0.95rem; height: 0.95rem; }

/* ---------- fill passes: the procedure sheet ---------- */

.fill-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 24rem);
  align-items: end;
  gap: 2.5rem;
  margin-bottom: clamp(3rem, 6vw, 5.5rem);
}

.procedure { border-top: 1px solid var(--line-strong); }

.pass-row { position: relative; border-bottom: 1px solid var(--line); }

.pass-summary {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1.25rem;
  width: 100%;
  padding: 1.5rem 0.25rem;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: background-color 160ms ease;
}

.js .pass-summary { cursor: pointer; }
.pass-summary:disabled { cursor: default; }
.pass-summary:disabled .pass-toggle { display: none; }

.pass-summary:hover { background: color-mix(in srgb, var(--ink) 3%, transparent); }

.pass-id { color: var(--ink-faint); transition: color 160ms ease; }

.pass-row[data-open="true"] .pass-id { color: var(--arc); }

.pass-name-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem 1.5rem;
}

.pass-title {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.6rem);
  font-weight: 650;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}

.pass-hook {
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.pass-toggle {
  position: relative;
  width: 1rem;
  height: 1rem;
  align-self: center;
}

.pass-toggle::before,
.pass-toggle::after {
  content: "";
  position: absolute;
  inset: 50% 0 auto;
  height: 2px;
  background: var(--ink-dim);
  translate: 0 -50%;
  transition: rotate 240ms ease, background-color 160ms ease;
}

.pass-toggle::after { rotate: 90deg; }
.pass-row[data-open="true"] .pass-toggle::after { rotate: 0deg; }
.pass-row[data-open="true"] .pass-toggle::before,
.pass-row[data-open="true"] .pass-toggle::after { background: var(--arc); }

.pass-detail {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 420ms cubic-bezier(0.3, 0.7, 0.3, 1);
}

.pass-row[data-open="true"] .pass-detail { grid-template-rows: 1fr; }
.js .pass-row[data-open="false"] .pass-detail { grid-template-rows: 0fr; }

.pass-detail-inner { overflow: hidden; min-height: 0; }

.pass-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 2rem 4rem;
  padding: 0.5rem 0.25rem 2.25rem 5.5rem;
}

.pass-copy { margin: 0; max-width: 36rem; color: var(--ink-dim); }
.pass-copy strong { color: var(--ink); font-weight: 500; }

.pass-facts {
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pass-facts li {
  position: relative;
  padding-left: 1.15rem;
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

.pass-facts li::before {
  content: "";
  position: absolute;
  top: 0.55em;
  left: 0;
  width: 0.45rem;
  height: 2px;
  background: var(--heat-run);
}

.pass-detail .text-link { margin-top: 1.25rem; }

/* ---------- cap pass: weld log ---------- */

.cap-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(3rem, 7vw, 8rem);
  align-items: start;
}

.weld-log {
  border: 1px solid var(--line-strong);
  background: var(--steel-1);
  box-shadow: 0 1.5rem 4rem color-mix(in srgb, var(--steel-0) 55%, transparent);
}

:root[data-theme="day"] .weld-log {
  box-shadow: 0 1.5rem 3.5rem rgba(15, 22, 33, 0.12);
}

.log-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0.85rem 0.8rem 1.25rem;
  border-bottom: 1px solid var(--line);
}

.log-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-dim);
}

.log-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--arc);
  box-shadow: 0 0 8px 1px var(--arc-glow);
}

@media (prefers-reduced-motion: no-preference) {
  .log-dot { animation: arc-breathe 2.6s ease-in-out infinite; }
}

.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.copy-button:hover {
  border-color: var(--arc);
  background: color-mix(in srgb, var(--arc) 10%, transparent);
}

.copy-button svg { width: 0.9rem; height: 0.9rem; }

.weld-log pre {
  margin: 0;
  padding: clamp(1.35rem, 3vw, 2.25rem);
  overflow-x: hidden;
  font-family: var(--mono);
  font-stretch: 82%;
  font-size: clamp(0.72rem, 1.1vw, 0.84rem);
  font-weight: 400;
  line-height: 2;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}

.weld-log code { color: var(--ink); font: inherit; }
.weld-log .prompt { color: var(--arc); user-select: none; }
.weld-log .comment { color: var(--ink-faint); }

.copy-status {
  min-height: 1.4rem;
  margin: 0.8rem 0 0;
  color: var(--arc);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

/* ---------- inspection ---------- */

.inspection {
  position: relative;
  border-top: 1px solid var(--line);
  padding-block: clamp(6.5rem, 12vw, 12rem);
  overflow: clip;
}

.inspection::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(46rem 26rem at 50% 118%, var(--arc-glow), transparent 68%);
  opacity: 0.22;
}

.inspection-inner {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
}

.inspection .tag { justify-content: center; }
.inspection .tag::after {
  content: "";
  width: 2.6rem;
  height: 2px;
  background: var(--heat-run);
}

.inspection .section-title { max-width: 18ch; }

.inspection p {
  max-width: 42rem;
  margin: 2rem 0 0;
  color: var(--ink-dim);
  font-size: 1.1rem;
  text-wrap: pretty;
}

.inspection .hero-actions { justify-content: center; margin-top: 2.5rem; }

/* ---------- footer ---------- */

.footer {
  padding-left: var(--rail-w);
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 3rem;
  min-height: 5.5rem;
  padding-block: 1.25rem;
}

.footer-meta { margin: 0; color: var(--ink-faint); }

.footer-maintainer { flex-basis: 100%; margin: 0; color: var(--ink-faint); font-size: 0.9em; }

.footer-maintainer a { color: var(--ink-dim); text-decoration: none; border-bottom: 1px solid var(--line-strong); transition: color 160ms ease; }

.footer-maintainer a:hover { color: var(--arc); }

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
}

.footer-links a {
  color: var(--ink-dim);
  font-family: var(--mono);
  font-stretch: 87.5%;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 160ms ease;
}

.footer-links a:hover { color: var(--arc); }

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 64rem) {
  .root-grid, .cap-grid, .fill-head { grid-template-columns: 1fr; gap: 2.5rem; }
  .pass-detail-grid { grid-template-columns: 1fr; padding-left: 0.25rem; }
  .spec-strip { grid-template-columns: 1fr 1fr; }
  .spec-cell:nth-child(n+3) { border-top: 1px solid var(--line); }
  .spec-cell:nth-child(3) { border-left: 0; padding-left: 0; }
}

@media (max-width: 44rem) {
  body { font-size: 1rem; }

  .hero h1 { font-size: clamp(3.6rem, 16.5vw, 5.4rem); }
  .hero-line2 { gap: 1rem; }
  .weld-run { height: 22px; }

  .joint { grid-template-columns: 1fr; }

  .joint-seam {
    width: auto;
    height: 4.25rem;
  }

  .joint-seam::before,
  .joint-seam::after {
    inset: 50% 0 auto 0;
    width: auto;
    height: 6px;
    translate: 0 -50%;
  }

  .joint-seam::before { background: var(--heat-run); }
  .joint-seam::after {
    background: repeating-linear-gradient(90deg,
      transparent 0 7px,
      color-mix(in srgb, var(--steel-0) 34%, transparent) 7px 9px);
  }

  .joint-seam-label { writing-mode: horizontal-tb; }

  .joint-plate--a { box-shadow: inset 0 -4rem 4rem -4rem color-mix(in srgb, var(--heat-2) 26%, transparent); }
  .joint-plate--b { box-shadow: inset 0 4rem 4rem -4rem color-mix(in srgb, var(--heat-2) 26%, transparent); }

  .joint-plate--a .plate-tag,
  .joint-plate--a .plate-name { text-align: left; }
  .joint-plate--a .plate-note { margin-left: 0; text-align: left; }

  .spec-strip { grid-template-columns: 1fr; }
  .spec-cell { padding-left: 0; border-left: 0 !important; }
  .spec-cell + .spec-cell { border-top: 1px solid var(--line); }

  .pass-summary { grid-template-columns: 3rem minmax(0, 1fr) auto; gap: 0.85rem; }
  .pass-name-wrap { flex-direction: column; gap: 0.3rem; }
  .ledger-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .hero-actions { width: 100%; }
  .hero-actions .button { flex: 1 1 100%; }
}

@media (prefers-contrast: more) {
  :root { --line: rgba(233, 238, 246, 0.35); --line-strong: rgba(233, 238, 246, 0.65); }
  :root[data-theme="day"] { --line: rgba(15, 22, 33, 0.4); --line-strong: rgba(15, 22, 33, 0.7); }
}

@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;
  }
}

/* ============================================================
   Scroll-driven motion (2026): native CSS timelines first,
   custom-property fallbacks for engines without support.
   Everything is gated behind prefers-reduced-motion: no-preference
   and only ever animates transform / opacity / custom properties.
   ============================================================ */

/* ---------- top scroll progress: the heat line ---------- */

.scroll-progress {
  position: fixed;
  z-index: 85;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  pointer-events: none;
  background: var(--heat-run);
  box-shadow: 0 0 10px var(--arc-glow);
  transform-origin: left;
  /* fallback path: JS keeps --weld updated when scroll() is unsupported */
  transform: scaleX(var(--weld));
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: scroll()) {
    .scroll-progress {
      animation: progress-grow linear both;
      animation-timeline: scroll(root);
    }

    /* the seam welds as you scroll — no JS involved */
    :root {
      animation: weld-advance linear both;
      animation-timeline: scroll(root);
    }
  }
}

@keyframes progress-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes weld-advance {
  from { --weld: 0; }
  to { --weld: 1; }
}

/* ---------- hero parallax: layers exit at different speeds ---------- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .hero .tag {
      will-change: transform, opacity;
      animation: hero-exit-fast linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    /* dolly zoom: the headline grows and tightens as it leaves */
    .hero h1 {
      transform-origin: 0 0;
      will-change: transform, opacity, letter-spacing;
      animation: hero-zoom linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    /* keep the strike-the-arc intro, add the parallax layer */
    .is-striking .hero h1 {
      animation: hot-cool 1300ms ease-out 250ms backwards, hero-zoom linear both;
      animation-timeline: auto, view();
      animation-range: normal, exit 0% exit 100%;
    }

    .hero-under {
      will-change: transform, opacity;
      animation: hero-exit-mid linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    /* the joint tips back into the shop floor */
    .joint {
      transform-origin: 50% 0;
      will-change: transform;
      animation: joint-tilt linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    .spec-strip {
      will-change: transform;
      animation: hero-exit-slower linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    /* spec cells scatter at their own speeds */
    .spec-cell:nth-child(odd) {
      will-change: transform;
      animation: cell-scatter-a linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }

    .spec-cell:nth-child(even) {
      will-change: transform;
      animation: cell-scatter-b linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }
  }

  /* fallback: JS writes --hero-p (0 → 1 as the hero leaves the viewport) */
  @supports not (animation-timeline: view()) {
    .js .hero .tag,
    .js .hero h1 {
      transform: translateY(calc(var(--hero-p, 0) * -4.5rem));
      opacity: 1;
    }
    .js .hero-under {
      transform: translateY(calc(var(--hero-p, 0) * -2.5rem));
      opacity: 1;
    }
    .js .joint { transform: translateY(calc(var(--hero-p, 0) * -1.25rem)); }
    .js .spec-strip { transform: translateY(calc(var(--hero-p, 0) * -0.6rem)); }
  }
}

@keyframes hero-exit-fast {
  to { transform: translateY(-4.5rem); }
}

@keyframes hero-zoom {
  to {
    transform: translateY(-6rem) scale(1.22);
    opacity: 1;
    letter-spacing: -0.035em;
  }
}

@keyframes hero-exit-mid {
  to { transform: translateY(-2.5rem); }
}

@keyframes joint-tilt {
  to { transform: perspective(70rem) rotateX(10deg) translateY(-2rem); opacity: 0.55; }
}

@keyframes hero-exit-slower {
  to { transform: translateY(-0.6rem); }
}

@keyframes cell-scatter-a {
  to { transform: translateY(-2.75rem); }
}

@keyframes cell-scatter-b {
  to { transform: translateY(-1.5rem); }
}

/* ---------- scrub reveals: tied to scroll, reversible ---------- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .js .reveal {
      animation: reveal-scrub linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 55%;
    }
  }
}

@keyframes reveal-scrub {
  from { opacity: 1; transform: translateY(1.75rem); }
  to { opacity: 1; transform: none; }
}

/* ---------- kinetic section titles ---------- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .section-title {
      will-change: transform, opacity;
      animation: title-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
  }
}

@keyframes title-rise {
  from {
    transform: translateY(2.5rem) scale(0.92);
    opacity: 1;
    letter-spacing: 0.05em;
  }
  to { transform: none; opacity: 1; letter-spacing: normal; }
}

/* ---------- fill passes: heat sweep + drifting pass numbers ---------- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .pass-row::before {
      content: "";
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      width: 3px;
      background: var(--heat-drop);
      box-shadow: 0 0 8px var(--arc-glow);
      transform-origin: top;
      animation: heat-sweep linear both;
      animation-timeline: view();
      animation-range: entry 15% entry 85%;
    }

    .pass-row .pass-id {
      display: inline-block;
      will-change: transform;
      animation: id-drift linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }
  }
}

@keyframes heat-sweep {
  from { transform: scaleY(0); opacity: 0; }
  to { transform: scaleY(1); opacity: 1; }
}

@keyframes id-drift {
  from { transform: translateY(0.35rem); }
  to { transform: translateY(-0.35rem); }
}

/* ---------- the weld log settles into position ---------- */

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .weld-log {
      will-change: transform;
      animation: log-unzip linear both;
      animation-timeline: view();
      animation-range: entry 10% entry 85%;
    }
  }
}

@keyframes log-unzip {
  from { transform: translateY(1rem); }
  to { transform: none; }
}

/* Procedure panels stay in document flow at every viewport size. */
.procedure-track { display: contents; }
