/* Helix Labs v2: one screen, dark-first. Palette from brand/BRAND.md. */
:root {
  --machine-green: #2F5D50;
  --signal-yellow: #F2B300;
  --nameplate-black: #1A1C1B;
  --concrete: #E6E7E3;

  --bg: var(--nameplate-black);
  --text: var(--concrete);
  --muted: #A2A9A7;
  --brand: #7FB09F;
  --accent: var(--signal-yellow);
  --accent-line: var(--signal-yellow); /* yellow hairlines on the canvas */
  --hot: #EAF7F1; /* what lines heat toward: packets, flashes */
  --accent-hover: #FFC41F;
  --on-accent: var(--nameplate-black);
  --guide: rgba(230, 231, 227, 0.1);

  --font-body: "Schibsted Grotesk", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --gutter: clamp(16px, 3.5vw, 40px);

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: var(--concrete);
  --text: var(--nameplate-black);
  --muted: #4C5351;
  --brand: var(--machine-green);
  --accent-line: #B98900; /* signal yellow is too faint as a hairline on concrete */
  --hot: #0F3A2E;
  --accent-hover: #DDA300;
  --guide: rgba(26, 28, 27, 0.12);

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  position: relative;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.55 var(--font-body);
  overflow-x: hidden;
}

h1, p { margin: 0; }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  border-radius: 2px;
}

/* The flow field and blueprint render on a canvas behind the first screen. */
.stage {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: 100svh;
  display: block;
}

/* One screen: header, hero, legal line. No visible frame; the canvas owns the full width. */
.frame {
  position: relative;
  max-width: 1120px;
  min-height: 100svh;
  margin: 0 auto;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 15px;
  height: 22px;
  color: var(--brand);
}

.bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.lang { display: flex; }

.lang button,
.theme {
  font: 500 0.8125rem/1 var(--font-mono);
  color: var(--muted);
  background: none;
  border: 0;
  padding: 10px 7px;
  cursor: pointer;
}

.lang button[aria-pressed="true"],
.lang button:hover,
.theme:hover { color: var(--text); }

.theme {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
}

.theme svg { width: 17px; height: 17px; }

/* Hero: the copy stacks centered under the drawing. */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 var(--gutter) clamp(40px, 8vh, 88px);
  text-align: center;
}

.headline {
  font-weight: 600;
  font-size: clamp(2.5rem, 5.6vw, 4.75rem);
  line-height: 1;
  letter-spacing: -0.045em;
  text-wrap: balance;
  margin-bottom: 6px;
}

.js .headline .mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.js .headline .mask > span {
  display: inline-block;
  transform: translateY(105%);
}

.services {
  color: var(--muted);
  font: 400 0.875rem/1.6 var(--font-mono);
  white-space: nowrap;
}

/* Story: a tab per machine, with a progress bar on the running one, and the caption. */
.story {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-top: 6px;
}

.steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.steps button {
  position: relative;
  padding: 6px 8px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 400 0.75rem/1 var(--font-mono);
  cursor: pointer;
}

.steps button:hover,
.steps button[aria-current="true"] { color: var(--text); }

.step-bar {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 0;
  height: 1px;
  background: var(--guide);
}

.step-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--brand);
  transform-origin: left;
  transform: scaleX(var(--p, 0));
}

/* Always one line, so the layout never shifts as chapters change. */
.caption {
  height: 1.6em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  font: 400 0.8125rem/1.6 var(--font-mono);
  white-space: nowrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px 24px;
  margin-top: 14px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  font: 600 0.9375rem/1 var(--font-body);
  text-decoration: none;
  transition: background-color 120ms;
}

.button:hover { background: var(--accent-hover); }

.link {
  font: 400 0.875rem/1 var(--font-mono);
  color: var(--muted);
  text-underline-offset: 5px;
}

.link:hover { color: var(--text); }

/* The legal line: on the page, out of the way. */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 14px;
  padding: 8px var(--gutter) 10px;
  color: var(--muted);
  font: 400 0.625rem/1.5 var(--font-mono);
  text-align: center;
}

@media (max-width: 640px) {
  .services { white-space: normal; text-wrap: balance; }
  .caption { font-size: 0.75rem; }
  .steps { flex-wrap: nowrap; gap: 0; }
  .steps button { padding-inline: 5px; font-size: 0.6875rem; }
  .step-bar { left: 5px; right: 5px; }
  .foot { font-size: 0.5625rem; }
}
