/*
 * The home page's sections (also used by the product page): hero and run trace, facts strip, pipeline rail,
 * Workers and their lanes, the "where it runs" band with its topology, and what to expect with the question card.
 */

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero::before { /* the 12-column grid, drawn faintly behind the hero */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px);
  background-size: calc((min(100vw, var(--wrap)) - 2 * var(--gutter)) / 12) 100%;
  background-position: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))) 0;
  -webkit-mask-image: linear-gradient(to bottom, #000 30%, transparent);
  mask-image: linear-gradient(to bottom, #000 30%, transparent);
}
.hero-in { position: relative; display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: var(--s7) var(--s8); align-items: center; padding-block: var(--s8) var(--s8); }
.eyebrow { font: 500 var(--fs-12)/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); margin-bottom: var(--s5); }
.hero h1 { font-size: var(--fs-hero); line-height: 1.02; font-weight: 600; letter-spacing: -0.035em; text-wrap: balance; }
.hero h1 .dim { color: var(--text-3); font-weight: 500; }
.hero .lede { margin-top: var(--s5); font-size: var(--fs-18); line-height: 1.55; color: var(--text-2); max-width: 34em; text-wrap: pretty; }
.ctas { display: flex; flex-wrap: wrap; gap: var(--s3); }
.hero .ctas { margin-top: var(--s6); }
.hero .fine { margin-top: var(--s4); font: 400 var(--fs-12)/1.5 var(--mono); color: var(--text-3); }

/* The run trace */
.trace { min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r3); box-shadow: var(--shadow); font: 400 var(--fs-13)/1.5 var(--mono); }
.trace-head { display: flex; align-items: center; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); color: var(--text-3); font-size: var(--fs-12); }
.trace-head .repo { min-width: 0; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trace-head .right { margin-left: auto; display: flex; align-items: center; gap: var(--s3); white-space: nowrap; }
.trace-issue { padding: var(--s4); border-bottom: 1px solid var(--rule); }
.trace-issue .num { color: var(--text-3); font-size: var(--fs-12); }
.trace-issue .t { margin-top: 2px; font: 500 var(--fs-16)/1.4 var(--sans); color: var(--text); }
.trace-steps { padding: var(--s2) 0; }
.step { position: relative; display: grid; grid-template-columns: 22px 76px minmax(0, 1fr) auto; gap: 0 var(--s3); align-items: baseline; padding: 7px var(--s4); }
.step .n { color: var(--text-3); font-size: var(--fs-11); }
.step .k { color: var(--text); font-weight: 500; white-space: nowrap; }
.step .d { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step .s { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-3); white-space: nowrap; }
.step.ok .s { color: var(--done); }
.step.ok .s::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--done-dot); }
.step.now { background: var(--run-subtle); }
.step.now::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--run-dot); }
.step.now .s { color: var(--run); }
.step.todo .k, .step.todo .d { color: var(--text-3); }
.trace-log { padding: var(--s3) var(--s4) var(--s4); border-top: 1px dashed var(--rule); color: var(--text-3); font-size: var(--fs-12); line-height: 1.75; }
.trace-log .ok { color: var(--done); }
.trace-log .run { color: var(--run); }
.caret { display: inline-block; width: 7px; height: 1em; vertical-align: -2px; background: var(--text-3); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.trace-foot { display: flex; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s4); border-top: 1px solid var(--rule); font-size: var(--fs-11); color: var(--text-3); }

/* ---------- Facts strip ---------- */
.facts { background: var(--surface); border-bottom: 1px solid var(--rule); }
.facts ul { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.facts li { display: grid; gap: var(--s1); align-content: start; padding: var(--s5) var(--s5) var(--s5) 0; }
.facts li + li { padding-left: var(--s5); border-left: 1px solid var(--rule); }
.facts strong { font-size: var(--fs-14); font-weight: 600; }
.facts span { font-size: var(--fs-13); color: var(--text-2); line-height: 1.5; }

/* ---------- Pipeline rail ---------- */
/* Each step's four lines share rows with its neighbours' (subgrid), so every "out:" starts on one line. */
.rail { margin-top: var(--s8); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-auto-rows: auto; border-top: 1px solid var(--text); }
.rail li { position: relative; display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; align-content: start; padding: var(--s5) var(--s4) 0 0; }
.rail li + li { padding-left: var(--s4); border-left: 1px solid var(--rule); }
.rail li::before { content: ""; position: absolute; top: -5px; left: 0; width: 9px; height: 9px; background: var(--bg); border: 1px solid var(--text); border-radius: 50%; }
.sec-alt .rail li::before { background: var(--surface); }
.rail li + li::before { left: -5px; }
.rail .n { font: 500 var(--fs-12)/1 var(--mono); color: var(--text-3); }
.rail h3 { margin-top: var(--s3); font-size: var(--fs-18); font-weight: 600; letter-spacing: -0.01em; }
.rail p { margin-top: var(--s2); font-size: var(--fs-14); color: var(--text-2); line-height: 1.55; }
.rail .out { padding-top: var(--s4); font: 400 var(--fs-12)/1.5 var(--mono); color: var(--text-3); }
.rail .out b { color: var(--text); font-weight: 500; }

/* ---------- Workers ---------- */
.workers { margin-top: var(--s8); display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 8fr); gap: var(--s7); align-items: start; }
.lanes { min-width: 0; background: var(--bg); border: 1px solid var(--rule); border-radius: var(--r3); overflow: hidden; }
.lanes-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); font: 400 var(--fs-12)/1.4 var(--mono); color: var(--text-3); }
.lanes-head b { color: var(--text); font-weight: 500; }
.lanes-grid { padding: var(--s3) var(--s4) var(--s4); }
.days, .lane { display: grid; grid-template-columns: 76px repeat(5, minmax(0, 1fr)); }
.days span { padding: var(--s2) 0 var(--s2) 6px; border-left: 1px solid var(--rule-soft); font: 400 var(--fs-11)/1 var(--mono); color: var(--text-3); }
.days span:first-child { border-left: 0; padding-left: 0; }
.lane { position: relative; align-items: center; height: 38px; border-top: 1px solid var(--rule-soft); }
.lane .who { font: 500 var(--fs-12)/1 var(--mono); color: var(--text-2); white-space: nowrap; }
.lane.human .who { color: var(--text-3); }
.track { grid-column: 2 / -1; position: relative; height: 24px; background-image: linear-gradient(to right, var(--rule-soft) 1px, transparent 1px); background-size: 20% 100%; }
.bar { position: absolute; top: 0; height: 24px; padding: 0 6px; border-radius: 3px; border: 1px solid var(--rule); background: var(--elevated); color: var(--text-2); font: 400 var(--fs-11)/22px var(--mono); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar.pr, .key i.pr { background: color-mix(in srgb, var(--done-dot) 10%, var(--surface)); border-color: color-mix(in srgb, var(--done-dot) 45%, var(--rule)); color: var(--done); }
.bar.live, .key i.live { background: var(--run-subtle); border-color: color-mix(in srgb, var(--run-dot) 50%, var(--rule)); color: var(--run); }
.lanes-note { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); padding: var(--s3) var(--s4); border-top: 1px solid var(--rule); font-size: var(--fs-12); color: var(--text-3); }
.key { display: inline-flex; align-items: center; gap: 6px; }
.key i { width: 14px; height: 10px; border-radius: 2px; border: 1px solid var(--rule); }

/* ---------- The band: brand ink in both themes, its own tokens ---------- */
.band {
  color-scheme: dark;
  --bg: #101218; --surface: #171a22; --elevated: #1f232d;
  --rule: #2a2f3b; --rule-soft: #222631; --rule-strong: #6b7180;
  --text: #eceef2; --text-2: #a9aeba; --text-3: #8d93a0;
  --primary: #f2f2f2; --primary-hover: #ffffff; --on-primary: #101218; --focus: #8fb3ff;
  background: var(--bg); color: var(--text); border-bottom-color: var(--bg);
}
:root[data-theme="dark"] .band { --bg: #12141b; border-block: 1px solid var(--rule); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .band { --bg: #12141b; border-block: 1px solid var(--rule); } }
.topo { margin-top: var(--s8); display: grid; grid-template-columns: minmax(0, 1fr) 96px minmax(0, 1fr) 96px minmax(0, 1fr); align-items: stretch; }
.box { padding: var(--s5); border: 1px solid var(--rule); border-radius: var(--r3); background: var(--surface); }
.box .k { display: block; margin-bottom: var(--s2); font: 500 var(--fs-11)/1.2 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.box h3 { font-size: var(--fs-16); font-weight: 600; }
.box p { margin-top: 6px; font-size: var(--fs-14); color: var(--text-2); line-height: 1.5; }
.topo .link { position: relative; display: flex; align-items: center; justify-content: center; }
.topo .link::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid var(--rule-strong); }
.topo .link span { position: relative; white-space: nowrap; padding: 2px 6px; background: var(--bg); font: 400 var(--fs-11)/1.35 var(--mono); color: var(--text-2); text-align: center; }
.commit { margin-top: var(--s8); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.commit li { padding: var(--s5) var(--s5) 0 0; }
.commit li + li { padding-left: var(--s5); border-left: 1px solid var(--rule); }
.commit h3 { font-size: var(--fs-16); font-weight: 600; }
.commit p { margin-top: var(--s2); font-size: var(--fs-14); color: var(--text-2); line-height: 1.55; }

/* ---------- What to expect ---------- */
.expect { margin-top: var(--s8); display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); gap: var(--s7); align-items: start; }
.limits { border-top: 1px solid var(--rule); }
.limits li { padding: var(--s5) 0; border-bottom: 1px solid var(--rule); }
.limits h3 { font-size: var(--fs-16); font-weight: 600; }
.limits p { margin-top: var(--s2); font-size: var(--fs-14); color: var(--text-2); }
.qcard { min-width: 0; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r3); box-shadow: var(--shadow); }
.qcard-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--rule); font: 400 var(--fs-12)/1.4 var(--mono); color: var(--text-2); }
.qcard-body { padding: var(--s4); display: grid; gap: var(--s4); }
.qmsg { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: var(--s3); }
.qreply { padding-top: var(--s4); border-top: 1px dashed var(--rule); }
.avatar { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--elevated); border: 1px solid var(--rule); font: 500 9px/1 var(--mono); color: var(--text-2); }
.qwho { font-size: var(--fs-13); font-weight: 600; }
.qwho span { font-weight: 400; color: var(--text-3); }
.qtext { margin-top: 2px; font-size: var(--fs-14); color: var(--text-2); }
.qopts { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: var(--s2); }
.qopts li { padding: 6px 10px; border: 1px solid var(--rule-strong); border-radius: var(--r2); font-size: var(--fs-13); color: var(--text-2); }
.qopts li.picked { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 500; }
.qcard-foot { padding: var(--s2) var(--s4); border-top: 1px solid var(--rule); font: 400 var(--fs-11)/1.5 var(--mono); color: var(--text-3); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .rail { grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 0; }
  .rail li, .rail li + li { border-top: 1px solid var(--text); border-left: 0; padding: var(--s5) var(--s5) var(--s6); }
  .rail li:nth-child(3n + 2), .rail li:nth-child(3n + 3) { border-left: 1px solid var(--rule); }
  .rail li::before, .rail li + li::before { left: var(--s5); }
  .rail li:nth-child(3n + 1) { padding-left: 0; }
  .rail li:nth-child(3n + 1)::before { left: 0; }
}
@media (max-width: 1080px) {
  .commit { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .commit li:nth-child(3) { padding-left: 0; border-left: 0; }
  .commit li { padding-bottom: var(--s5); }
  .facts ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .facts li:nth-child(3) { padding-left: 0; border-left: 0; }
  .facts li:nth-child(n + 3) { border-top: 1px solid var(--rule); }
}
@media (max-width: 900px) {
  .hero-in { grid-template-columns: minmax(0, 1fr); padding-block: var(--s7) var(--s8); }
  .workers, .expect { grid-template-columns: minmax(0, 1fr); }
  .expect .qcard { order: 2; }
  .topo { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 56px auto 56px auto; }
  .topo .link::before { left: 50%; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 1px solid var(--rule-strong); }
}
@media (max-width: 640px) {
  .rail { grid-template-columns: minmax(0, 1fr); margin-top: var(--s6); margin-left: 4px; border-left: 1px solid var(--text); }
  .rail li, .rail li + li, .rail li:nth-child(3n + 1), .rail li:nth-child(3n + 2), .rail li:nth-child(3n + 3) { border: 0; padding: 0 0 var(--s6) var(--s5); }
  .rail li::before, .rail li + li::before, .rail li:nth-child(3n + 1)::before { top: 3px; left: -5px; }
  .rail h3 { margin-top: var(--s2); }
  .rail .out { padding-top: var(--s2); }
  .step { grid-template-columns: 18px 72px minmax(0, 1fr) auto; gap: 0 var(--s2); padding-inline: var(--s3); }
  .step .d { white-space: normal; font-size: var(--fs-12); line-height: 1.5; }
  .trace-head .w { display: none; }
  .hero::before { display: none; }
  .hero .ctas .btn { flex: 1 1 auto; }
  .commit { grid-template-columns: minmax(0, 1fr); }
  .commit li, .commit li + li { padding: var(--s4) 0; border-left: 0; border-bottom: 1px solid var(--rule); }
  /* The lanes become a list per lane: the issues wrap, nothing is cut off. */
  .days { display: none; }
  .lane { grid-template-columns: minmax(0, 1fr); height: auto; gap: var(--s2); padding: var(--s3) 0; }
  .lane:first-of-type { border-top: 0; }
  .track { grid-column: 1; height: auto; display: flex; flex-wrap: wrap; gap: 4px; background: none; }
  .bar { position: static; width: auto !important; max-width: 100%; }
}
@media (max-width: 520px) {
  .facts ul { grid-template-columns: minmax(0, 1fr); }
  .facts li, .facts li + li { padding: var(--s4) 0; border-left: 0; border-top: 1px solid var(--rule); }
  .facts li:first-child { border-top: 0; }
}
