/* Landing page. Depends on tokens.css for palette, type and primitives. */

html { scroll-behavior: smooth; }
.shell { width: min(1160px, calc(100% - 64px)); margin: auto; }

/* ---------- nav ---------- */
.nav { height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.nav nav { display: flex; gap: var(--s8); font-size: var(--text-base); color: var(--ink-soft); }
.nav nav a { padding-bottom: 2px; border-bottom: 1px solid transparent; }
.nav nav a:hover { border-bottom-color: var(--ink); color: var(--ink); }
.nav-cta { font-size: var(--text-base); }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 0.92fr 1.08fr; min-height: 600px; align-items: center; gap: var(--s12); padding: var(--s16) 0; }
.eyebrow { display: flex; align-items: center; gap: var(--s2); }
.eyebrow-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); display: inline-block; }
.hero h1 { font-family: var(--font-display); font-size: clamp(42px, 5.4vw, 68px); letter-spacing: -0.06em; line-height: 1.0; margin: var(--s6) 0; }
.hero h1 em, .explore h2 em, .build h2 em, .join h2 em { font-family: var(--font-serif); font-weight: 400; font-style: italic; color: var(--violet); }
.hero-lede { font-size: var(--text-lg); line-height: 1.55; color: var(--ink-soft); max-width: 460px; }
.hero-lede strong { color: var(--ink); font-weight: 600; }
.hero-actions { display: flex; align-items: center; gap: var(--s6); margin-top: var(--s8); flex-wrap: wrap; }
.text-link { font-size: var(--text-base); font-weight: 600; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.text-link:hover { border-bottom-color: var(--ink); }
.micro-note { font-size: var(--text-sm); color: var(--muted); margin-top: var(--s8); line-height: 1.6; }
.micro-note b { color: var(--ink); font-family: var(--font-mono); font-weight: 500; }

.hero-art { height: 460px; position: relative; display: grid; place-items: center; }
.orbit { border: 1px solid var(--line); border-radius: 50%; position: absolute; transform: rotate(-20deg); }
.orbit-one { width: 500px; height: 260px; }
.orbit-two { width: 410px; height: 240px; transform: rotate(31deg); }
/* A column: header, caption, the one persistent diagram, progress, footer. Nothing here is
   absolutely positioned against the card's own chrome any more, which is what used to let
   the stages overlap the progress bar. */
.evolution-card { position: relative; width: min(390px, 100%); display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); z-index: 2; overflow: hidden; }
.card-top, .card-footer { display: flex; justify-content: space-between; align-items: center; padding: var(--s4); border-bottom: 1px solid var(--line-soft); color: var(--muted); font-size: var(--text-xs); }
.evolution-controls { display: flex; align-items: center; gap: var(--s3); }
.live { font-size: var(--text-xs); color: var(--green); display: flex; align-items: center; gap: 4px; }
.live b { width: 5px; height: 5px; border-radius: 50%; background: var(--green); display: inline-block; }
.evolution-pause { display: flex; align-items: center; gap: 5px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-pill); padding: 3px 9px 3px 7px; font-size: var(--text-xs); color: var(--ink-soft); cursor: pointer; }
.evolution-pause:hover { border-color: var(--violet); color: var(--ink); }
.evolution-pause svg { width: 9px; height: 9px; fill: currentColor; flex: none; }
/* Same visible label either way: "Pause" while playing (says what the button does), "Play"
   once paused (says what pressing it again will do) — never a state name like "Paused". */
.card-footer { border-top: 1px solid var(--line-soft); border-bottom: 0; }
.spark { color: var(--green); }
/* States what the animation is before the animation gets a chance to leave the visitor
   guessing — the diagram alone never said "this one system, five snapshots" on its own. */
.evolution-kicker { margin: var(--s4) var(--s5) 0; font-size: var(--text-sm); color: var(--ink-soft); }

/* Only the caption swaps. The diagram underneath is one SVG that stays mounted for the whole
   cycle; its parts fade themselves in and out on a schedule home.js writes from the data. */
.evolution-captions { position: relative; height: 46px; margin: var(--s3) var(--s5) 0; }
.evolution-caption { position: absolute; inset: 0; opacity: 0; font-family: var(--font-display); font-size: var(--text-md); letter-spacing: -0.02em; color: var(--ink); animation: evolution-caption var(--evolution-cycle, 22s) infinite; }
.evolution-caption b { display: block; color: var(--violet); font: var(--text-xs) var(--font-mono); letter-spacing: .1em; margin-bottom: var(--s2); }
@keyframes evolution-caption { 0%, 1% { opacity: 0; transform: translateY(5px); } 3%, 18% { opacity: 1; transform: translateY(0); } 20%, 100% { opacity: 0; } }

.evolution-graph { height: 214px; margin: var(--s1) var(--s5) 0; display: grid; place-items: center; }
.evolution-graph .graph { width: 100%; height: 100%; }

.evolution-progress { display: flex; gap: 5px; padding: var(--s3) var(--s5); }
.evolution-progress i { height: 3px; flex: 1; border-radius: 5px; background: var(--line); overflow: hidden; }
.evolution-progress s { display: block; height: 100%; background: var(--violet); transform: scaleX(0); transform-origin: left; animation: evolution-progress var(--evolution-cycle, 22s) infinite; }
@keyframes evolution-progress { 0% { transform: scaleX(0); } 19% { transform: scaleX(1); } 20%, 100% { transform: scaleX(0); } }

@media (prefers-reduced-motion: reduce) {
  /* Hold the last caption, to match the finished system the graph shows. */
  .evolution-caption { animation: none; opacity: 0; }
  .evolution-caption:last-child { opacity: 1; }
  .evolution-progress s { animation: none; transform: scaleX(1); }
}

/* Hovering pauses as a quick, no-commitment way to stop and read one stage — but hover does
   not exist on touch and releases the instant the pointer leaves, which was the original
   complaint ("it switches on you, then a long wait"). .is-paused is the sticky version the
   button in the card header sets, and it has to win over both the mouse-out that ends
   :hover and the graph's own inline <style> (home.js's evolutionStyles()), which sets
   animation-duration on the same elements and is injected after this stylesheet in the
   document — !important is the only way this rule outranks that one reliably. */
.evolution-card:is(:hover, .is-paused) :is(.evolution-caption, .evolution-progress s, .node, .edge, .lane) {
  animation-play-state: paused !important;
}

/* ---------- payoffs ---------- */
.payoffs { padding: var(--s8) 0 0; }
.payoff-grid { list-style: none; margin: 0; padding: var(--s8) 0 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--s6); }
.payoff-grid > * { min-width: 0; }
.payoff h3 { font-family: var(--font-display); font-size: var(--text-md); letter-spacing: -0.02em; line-height: 1.25; margin: var(--s3) 0 var(--s2); }
.payoff p { margin: 0; font-size: var(--text-base); line-height: 1.55; color: var(--ink-soft); }
/* A bare arc with a node at each end — the brand mark's single stroke, drawn in CSS so four
   of them cost no markup. */
/* The nodes are centerd on the arc's endpoints, so they hang 4px outside the box on each
   side; the left margin keeps the first column's node off the shell's edge. */
.payoff-mark { display: block; position: relative; width: 30px; height: 12px; margin-left: 4px; border-top: 1.8px solid var(--accent); border-radius: 50% 50% 0 0 / 100% 100% 0 0; }
.payoff-mark::before, .payoff-mark::after { content: ''; position: absolute; top: -3.5px; width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; }
.payoff-mark::before { left: -4px; background: var(--accent); }
.payoff-mark::after { right: -4px; background: var(--paper); border: 1.8px solid var(--accent); }

/* ---------- section furniture ---------- */
/* The count/status note aligns to the kicker at the top, not to the bottom of a lede whose
   height varies with the copy. */
.section-head { display: flex; justify-content: space-between; align-items: start; gap: var(--s8); margin-bottom: var(--s8); }
.arcs h2, .explore h2, .build h2, .join h2 { font-family: var(--font-display); letter-spacing: -0.05em; font-size: clamp(34px, 4.4vw, 54px); line-height: 1.04; margin: var(--s4) 0 0; }
.arcs h2 em { font-family: var(--font-serif); font-weight: 400; font-style: italic; color: var(--violet); }
.section-lede { color: var(--ink-soft); line-height: 1.6; max-width: 560px; margin: var(--s5) 0 0; font-size: var(--text-md); }
.section-lede strong { color: var(--ink); font-weight: 600; }
.section-note { font: var(--text-sm) var(--font-mono); color: var(--violet); white-space: nowrap; }
.panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }

/* ---------- the three meanings ---------- */
.arcs { padding: var(--s16) 0 0; }
.meaning-grid { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin: 0; padding: 0; }
.meaning-grid > * { min-width: 0; }
.meaning { position: relative; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.meaning-index { position: absolute; top: var(--s5); right: var(--s5); font: var(--text-xs) var(--font-mono); color: var(--muted); letter-spacing: 0.13em; }
.meaning-art { height: 168px; background: var(--surface-sunk); border-radius: var(--radius); padding: var(--s3); display: grid; place-items: center; }
.meaning-art .graph { width: 100%; height: 100%; max-width: 100%; }
/* The connection panel's label is the sentence the panel is about, so it is set a step up
   from the edge labels inside a dense diagram. */
.edge-label-plain { font-size: 11px; }
.meaning h3 { font-family: var(--font-display); font-size: var(--text-lg); letter-spacing: -0.03em; margin: var(--s2) 0 0; }
.meaning p { margin: 0; font-size: var(--text-base); line-height: 1.6; color: var(--ink-soft); }
.meaning p strong { color: var(--ink); font-weight: 600; }
/* Colour only — the span sits mid-word, so anything that changes metrics (italic, tracking)
   would open a visible seam in "architecture". */
.arc-in-word { color: var(--accent); }

/* The evolution panel is the one illustration that is not a graph — a system's path over
   time is a sequence of snapshots, so it is drawn as the curve those snapshots trace. */
.track-line { fill: none; stroke: var(--violet); stroke-width: 2; stroke-linecap: round; }
.track-dot { fill: var(--violet); }
.track-count { font: 500 10px var(--font-mono); fill: var(--ink-soft); text-anchor: middle; }
.track-tick { font: var(--text-xs) var(--font-mono); fill: var(--muted); letter-spacing: 0.1em; }
.track-tick-end { text-anchor: end; }

/* ---------- gallery ---------- */
.explore { padding: var(--s16) 0; }
.filter-row { display: flex; flex-wrap: wrap; gap: var(--s2); margin-bottom: var(--s5); }
.filter-chip { display: inline-flex; align-items: center; gap: var(--s2); border: 1px solid var(--line); background: transparent; border-radius: var(--radius-pill); padding: var(--s2) var(--s4); font-size: var(--text-sm); cursor: pointer; transition: background var(--speed), color var(--speed), border-color var(--speed); }
.filter-chip i { font-style: normal; font-family: var(--font-mono); font-size: var(--text-xs); color: var(--muted); }
.filter-chip:hover { border-color: var(--violet); }
.filter-chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.filter-chip[aria-pressed="true"] i { color: color-mix(in srgb, var(--paper) 60%, var(--ink)); }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); }
.gallery-more { display: block; margin: var(--s5) auto 0; }
.loading-note, .empty-note { color: var(--muted); font-size: var(--text-base); grid-column: 1 / -1; text-align: center; padding: var(--s8); line-height: 1.6; margin: 0; }

.arch-card { display: flex; flex-direction: column; text-align: left; text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); padding: 0; cursor: pointer; overflow: hidden; transition: transform var(--speed), box-shadow var(--speed), border-color var(--speed); }
.arch-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--violet); }
.arch-thumb { height: 132px; background: var(--surface-sunk); border-bottom: 1px solid var(--line-soft); padding: var(--s2); display: grid; place-items: center; overflow: hidden; }
.arch-thumb .graph { width: 100%; height: 100%; }
.arch-body { padding: var(--s4); display: flex; flex-direction: column; gap: var(--s2); flex: 1; }
.arch-card h3 { font-family: var(--font-display); font-size: var(--text-md); letter-spacing: -0.02em; line-height: 1.25; margin: 0; }
.arch-card p { margin: 0; font-size: var(--text-base); color: var(--ink-soft); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.arch-meta { display: flex; align-items: center; gap: var(--s2); margin-top: auto; padding-top: var(--s3); border-top: 1px solid var(--line-soft); font: var(--text-xs) var(--font-mono); color: var(--muted); }
.type-mix { display: flex; gap: 3px; margin-left: auto; }
.type-mix i { width: 7px; height: 7px; border-radius: 2px; display: block; }
/* Named parts of the system, one line, clipped rather than wrapped so card heights stay
   even across a row. */
.part-row { display: flex; gap: 4px; overflow: hidden; height: 19px; }
.part-chip { font: var(--text-xs) var(--font-mono); border: 1px solid var(--line); color: var(--ink-soft); border-radius: 4px; padding: 2px 5px; white-space: nowrap; }
.thumb-arc { fill: none; stroke: color-mix(in srgb, var(--violet) 42%, transparent); stroke-width: 1.3; }
.arch-card:hover .thumb-arc { stroke: color-mix(in srgb, var(--violet) 70%, transparent); }

/* ---------- builder ---------- */
.build { padding: 0 0 var(--s16); }
.build-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); align-items: stretch; }
/* A 1fr track floors at its content's min-content width, and the preview SVG reports a wide
   one — enough to push the whole document past the viewport on a phone. */
.build-grid > *, .gallery > * { min-width: 0; }
.preview-canvas .graph, .arch-thumb .graph { max-width: 100%; }
.picker { padding: var(--s5); display: flex; flex-direction: column; }
.picker-tabs { display: flex; gap: var(--s1); overflow-x: auto; margin-bottom: var(--s4); padding-bottom: 2px; }
.picker-tab { border: 1px solid var(--line); background: transparent; border-radius: var(--radius-pill); padding: var(--s2) var(--s3); font-size: var(--text-sm); white-space: nowrap; cursor: pointer; transition: background var(--speed), color var(--speed); }
.picker-tab[aria-selected="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.picker-items { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); align-content: start; }
.picker-custom { margin-top: auto; padding-top: var(--s5); }
.pick-custom { width: 100%; border-style: dashed; }
.custom-form label { display: block; margin-bottom: var(--s2); color: var(--ink-soft); font-size: var(--text-sm); }
.custom-form > div { display: flex; gap: var(--s2); }
.custom-form .field { min-width: 0; flex: 1; }
.pick { display: flex; align-items: center; gap: var(--s2); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--s3); cursor: pointer; background: transparent; text-align: left; transition: border-color var(--speed), background var(--speed); }
.pick:hover { border-color: var(--violet); }
.pick[aria-pressed="true"] { border-color: var(--violet); background: var(--violet-soft); }
.pick-icon { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; flex: none; background: color-mix(in srgb, var(--c) 18%, var(--surface)); color: var(--c); }
.pick b { font-size: var(--text-base); display: block; font-weight: 600; }
.pick small { font-size: var(--text-xs); color: var(--muted); display: block; margin-top: 2px; }

.preview { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.preview-top { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); }
.preview-canvas { flex: 1; min-height: 300px; background: var(--surface-sunk); border-radius: var(--radius); padding: var(--s3); display: grid; place-items: center; }
.preview-canvas .graph { width: 100%; height: 100%; max-height: 340px; }
.preview .button { align-self: flex-start; }

.value-row { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s4); margin: var(--s8) 0 0; padding: var(--s6) 0 0; border-top: 1px solid var(--line); }
.value-row li { font-size: var(--text-base); color: var(--ink-soft); line-height: 1.55; }
.value-row b { color: var(--ink); display: block; margin-bottom: 3px; font-weight: 600; }

/* ---------- shared graph styling ---------- */
.graph { display: block; }
.lane-band { fill: color-mix(in srgb, var(--ink) 4%, transparent); stroke: none; }
.lane-label { font: var(--text-xs) var(--font-mono); fill: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.edge-line { fill: none; stroke: color-mix(in srgb, var(--violet) 55%, transparent); stroke-width: 1.4; }
.edge-head { fill: color-mix(in srgb, var(--violet) 55%, transparent); }
.edge-label { font: var(--text-xs) var(--font-mono); fill: var(--muted); text-anchor: middle; paint-order: stroke; stroke: var(--surface-sunk); stroke-width: 4px; stroke-linejoin: round; }
.node-box { fill: var(--surface); stroke: var(--node-color, var(--n-default)); stroke-width: 1.3; }
.node-label { font: 600 11px var(--font-body); fill: var(--ink); text-anchor: middle; }
.node { cursor: pointer; }
.node:hover .node-box, .node.is-selected .node-box { fill: color-mix(in srgb, var(--node-color) 12%, var(--surface)); stroke-width: 2; }
/* Reading one path through a dense graph means muting everything else. */
.edge { transition: opacity var(--speed); }
.edge.is-dim { opacity: 0.15; }

/* ---------- join ---------- */
.join { background: var(--ink); color: var(--paper); border-radius: var(--radius-lg); display: grid; grid-template-columns: 1fr 1fr; gap: var(--s12); padding: var(--s12); margin-bottom: var(--s16); }
.join .section-kicker { color: color-mix(in srgb, var(--paper) 60%, var(--ink)); }
.join h2 em { color: var(--accent); }
.join p { color: color-mix(in srgb, var(--paper) 72%, var(--ink)); line-height: 1.55; max-width: 380px; }
.join-form { align-self: center; }
.join-form label { font: var(--text-xs) var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; color: color-mix(in srgb, var(--paper) 62%, var(--ink)); }
.input-row { display: flex; border-bottom: 1px solid color-mix(in srgb, var(--paper) 40%, var(--ink)); margin-top: var(--s6); }
.input-row input { flex: 1; background: transparent; border: 0; outline: 0; color: var(--paper); font: var(--text-md) var(--font-body); padding: var(--s3) 0; }
.input-row input::placeholder { color: color-mix(in srgb, var(--paper) 45%, var(--ink)); }
.input-row button { border: 0; background: var(--accent); border-radius: var(--radius-pill); padding: var(--s3) var(--s4); font-weight: 700; font-size: var(--text-base); cursor: pointer; color: #33241a; display: inline-flex; gap: var(--s3); }
.join-form small { color: color-mix(in srgb, var(--paper) 55%, var(--ink)); display: block; font-size: var(--text-sm); margin-top: var(--s4); }

.footer { display: flex; align-items: center; justify-content: space-between; padding: 0 0 var(--s8); color: var(--muted); font-size: var(--text-sm); }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .meaning-grid { grid-template-columns: 1fr; }
  .payoff-grid { grid-template-columns: repeat(2, 1fr); gap: var(--s6) var(--s5); }
}
@media (max-width: 760px) {
  .shell { width: min(100% - 36px, 560px); }
  .nav { height: 68px; }
  .nav nav { display: none; }
  .hero { display: block; padding: var(--s12) 0 var(--s8); min-height: 0; }
  /* The orbit rings are 500px of pure decoration and pushed the document wider than the
     viewport. Sized to the column here, with overflow clipped as a backstop. The card now
     sizes to the column itself, so it no longer needs the scale-down that used to hide the
     overflow of its fixed 390px width. */
  .hero-art { height: 400px; margin-top: var(--s6); overflow: hidden; }
  .orbit-one { width: 330px; height: 200px; }
  .orbit-two { width: 270px; height: 180px; }
  /* A pull quote hanging off a card that is now as wide as the screen has nowhere to hang. */
    .section-head { display: block; }
  .section-note { display: block; margin-top: var(--s4); }
  .gallery, .build-grid, .value-row, .join, .meaning-grid, .payoff-grid { grid-template-columns: 1fr; }
  .arcs { padding: var(--s12) 0 0; }
  .join { padding: var(--s8) var(--s6); gap: var(--s8); }
  .picker-items { grid-template-columns: 1fr; }
  .explore, .build { padding: var(--s12) 0; }
  .footer { flex-wrap: wrap; gap: var(--s4); }
}
