/* ==================================================================
   Pipeline Operations Console showcase — layout & chrome.
   Tokens only, never raw hex. Depends on css/tokens.css.
   ================================================================== */

/* — Skip link — */
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; }
.skip:focus { left: 1rem; top: 1rem; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0.6rem 1rem;
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em; }
/* The skip target takes focus (see its tabindex) but must not draw a ring round the
   whole page — the next Tab shows where focus actually landed. */
main:focus-visible { outline: none; }

/* — Shell — */
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; }

/* — Header — */
.site-header { position: sticky; top: 0; z-index: 50; backdrop-filter: blur(16px);
  background: color-mix(in srgb, var(--canvas) 85%, transparent); border-bottom: 1px solid var(--line); }
.site-header-inner { max-width: 1080px; margin: 0 auto; padding: 0 1.5rem; height: 64px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand-lockup { display: flex; align-items: center; gap: 0.625rem; text-decoration: none; }
.logo-tile { display: grid; place-items: center; height: 32px; width: 32px; border-radius: var(--r-sm);
  background: var(--accent); font-family: var(--font-display); font-weight: 800; font-size: 14px;
  color: var(--canvas); transition: transform var(--dur-mid) ease; }
.brand-lockup:hover .logo-tile { transform: rotate(-10deg); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--ink-faint); margin-top: 1px; }

.site-nav { display: flex; align-items: center; gap: 0.125rem; }
.navlink { border-radius: var(--r-sm); padding: 0.5rem 0.75rem; text-decoration: none;
  font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--ink-muted); transition: color var(--dur-fast); }
.navlink:hover { color: var(--ink); }
.navlink.active { color: var(--accent); }
@media (max-width: 900px) { .site-nav { display: none; } }

.icon-btn { display: grid; place-items: center; height: 40px; width: 40px; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: transparent; color: var(--ink-muted); cursor: pointer;
  transition: border-color var(--dur-fast), color var(--dur-fast); }
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.theme-icon-moon { display: none; }
[data-theme="light"] .theme-icon-sun { display: none; }
[data-theme="light"] .theme-icon-moon { display: inline; }

/* — Section anatomy: eyebrow → display H2 → lede → content — */
section.block { padding: 5rem 0; border-top: 1px solid var(--line); scroll-margin-top: 84px; }
section.block:first-of-type { border-top: 0; }
@media (min-width: 768px) { section.block { padding: 8rem 0; } }

.eyebrow { display: flex; align-items: center; gap: 0.75rem; font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.2em; color: var(--ink-faint); margin: 0 0 1.5rem; }
.eyebrow .idx { color: var(--accent); }
.eyebrow .rule { height: 1px; width: 40px; background: var(--line-strong); }

h1.display { font-family: var(--font-display); font-weight: 800; letter-spacing: -0.02em; line-height: 1.04;
  font-size: clamp(2.5rem, 6vw, 3.75rem); margin: 0; }
h2.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; line-height: 1.08;
  font-size: clamp(1.875rem, 4vw, 3rem); margin: 0 0 0.75rem; }
.display .spark { color: var(--accent); }
.lede { color: var(--ink-muted); font-size: 1.0625rem; max-width: 44rem; margin: 0 0 1.5rem; }
.muted { color: var(--ink-muted); }
/* Loose section content keeps the lede's reading measure; copy inside cards/panels sets its own. */
section.block > p.muted,
section.block > .callout,
section.block > table.ref { max-width: 44rem; }
.faint { color: var(--ink-faint); }

.grid { display: grid; gap: 1rem; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 820px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

/* — Components: ported verbatim from design-language.html §6 — */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; border-radius: var(--r-pill);
  padding: 0.875rem 1.5rem; font-size: 0.875rem; font-weight: 500; text-decoration: none; cursor: pointer;
  border: 1px solid transparent; font-family: inherit;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast); }
.btn-primary { background: var(--accent); color: var(--canvas); }
.btn-primary:hover { background: var(--accent-soft); }
.btn-ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn-ghost:hover { border-color: var(--ink); }
.btn .arw, .sharepill .arw { transition: transform var(--dur-mid) var(--ease-out-expo); }
.btn:hover .arw { transform: translateX(3px); }
.sharepill:hover .arw { transform: translate(2px, -2px); }
.btn-sm { padding: 0.5rem 1rem; font-family: var(--font-mono); font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.14em; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.tag { display: inline-flex; align-items: center; gap: 0.5rem; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); padding: 0.25rem 0.75rem;
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--ink-faint); }
.tag-strong { border-color: var(--line-strong); color: var(--accent); }
.dot { height: 6px; width: 6px; border-radius: var(--r-pill); background: var(--accent); flex: none; }

.card-lg { position: relative; display: flex; flex-direction: column; border-radius: var(--r-xl);
  border: 1px solid var(--line); background: var(--surface); padding: 1.5rem;
  transition: border-color var(--dur-fast); }
.card-lg:hover { border-color: var(--line-strong); }
.well { display: grid; place-items: center; aspect-ratio: 16/10; width: 100%; overflow: hidden;
  border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink-faint); transition: border-color var(--dur-fast); }
.card-lg:hover .well { border-color: var(--line-strong); }
.card-lg .name { margin: 1.25rem 0 0; font-family: var(--font-display); font-weight: 600;
  font-size: 1.125rem; color: var(--ink); transition: color var(--dur-fast); }
.card-lg:hover .name { color: var(--accent); }
.card-lg .cat { margin-top: 0.25rem; font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint); }
.card-body { margin-top: 0.75rem; font-size: 0.875rem; color: var(--ink-muted); }

.meta-key { font-family: var(--font-mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--accent); }
.meta-val { margin: 0.5rem 0 0; font-size: 0.875rem; color: var(--ink-muted); }

/* Compact card. `margin:0` on the title is the one deviation — the design language uses a
   <div> there; we use an <h3> so the heading hierarchy stays real. */
.card { position: relative; display: flex; flex-direction: column; border-radius: var(--r-lg);
  border: 1px solid var(--line); background: var(--surface); padding: 1.25rem;
  transition: border-color var(--dur-fast); }
.card:hover { border-color: var(--line-strong); }
.card-title { margin: 0; display: flex; align-items: center; gap: 0.5rem; font-family: var(--font-display);
  font-weight: 600; font-size: 1rem; color: var(--ink); transition: color var(--dur-fast); }
.card:hover .card-title { color: var(--accent); }
.card .sq { height: 8px; width: 8px; border-radius: 2px; background: var(--accent); flex: none; }

.panel { border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--surface);
  padding: 1.5rem; transition: border-color var(--dur-fast); }

table.ref { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.875rem; }
table.ref th, table.ref td { text-align: left; padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line); vertical-align: top; }
table.ref th { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--ink-faint); font-weight: 400; }
table.ref td { color: var(--ink-muted); }
table.ref td:first-child { font-family: var(--font-mono); font-size: 12px; color: var(--accent);
  white-space: nowrap; }

.note { font-size: 0.8125rem; color: var(--ink-faint); margin-top: 0.5rem; }
.callout { border-left: 2px solid var(--accent); padding: 0.25rem 0 0.25rem 1rem; margin: 1.25rem 0;
  color: var(--ink-muted); font-size: 0.9375rem; }
/* Lead-ins inside muted blocks step back up to full ink so the row scans. */
.callout b, table.ref td b { color: var(--ink); }

/* .prose — the scoped reading layer. Only the rules §03's conversation uses; the rest of the
   layer ports when a section needs it. */
.prose { max-width: 44rem; }
.prose p { color: var(--ink-muted); font-size: 1.0625rem; line-height: 1.75; margin: 1.25rem 0 0; }
.prose blockquote { margin: 2rem 0; border-left: 2px solid var(--accent); padding-left: 1.25rem;
  font-family: var(--font-display); font-style: italic; font-size: 1.25rem; line-height: 1.5; color: var(--ink); }

.mono-lbl { font-family: var(--font-mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--ink-faint); }

svg .accent { color: var(--accent); }

/* — Hero — */
.hero { position: relative; }
.glow { position: absolute; z-index: -1; pointer-events: none; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--accent) 14%, transparent); filter: blur(80px); }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 2rem 0 1.5rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.hero-art { display: block; width: 100%; height: auto; margin-top: 3.5rem; color: var(--ink-faint); }
.hero-art .lbl { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.14em;
  fill: currentColor; stroke: none; }
/* Below ~640px the art scales past legibility for the micro-labels — drop them, keep the network. */
@media (max-width: 640px) { .hero-art { margin-top: 2.5rem; } .hero-art .lbl { display: none; } }

/* Risk ramp — data encoding, not decoration; the one place beyond the accent that carries colour.
   Set as `color` so the same class serves a fill (hero nodes), a stroke (§04 segments) and a
   background (§04 legend) via currentColor. */
:root { --risk-min: #22c55e; --risk-low: #27ae60; --risk-med: #f1c40f; --risk-high: #f39c12; --risk-crit: #e74c3c; }
/* The dark ramp on cream is unreadable — yellow measured 1.38:1 on --surface-2, i.e. a
   segment you cannot see. Same five bands, darkened until each clears 4:1 (the bar for a
   graphical object is 3:1). Hue order still carries the meaning; only the value changes. */
[data-theme="light"] { --risk-min: #158043; --risk-low: #116b38; --risk-med: #8a6b08;
  --risk-high: #a85a0a; --risk-crit: #c62a1b; }
.r-min { color: var(--risk-min); } .r-low { color: var(--risk-low); } .r-med { color: var(--risk-med); }
.r-high { color: var(--risk-high); } .r-crit { color: var(--risk-crit); }

@keyframes flow { to { stroke-dashoffset: -64; } }
.flow { stroke-dasharray: 10 22; animation: flow 3.2s linear infinite; }
@media (prefers-reduced-motion: reduce) { .flow { animation: none; } }

/* — §03 conversation panel: answer left, the sources it read in a rail on the right.
     The rail is what goes live in Phase 4, so it earns its column now. — */
.convo { display: grid; gap: 1.5rem; }
.convo blockquote { margin-top: 0; }
.convo-src { display: flex; flex-wrap: wrap; gap: 0.5rem; align-content: start; }
.convo-src .mono-lbl { width: 100%; margin: 0 0 0.25rem; }
@media (min-width: 900px) {
  .convo { grid-template-columns: minmax(0, 1fr) 15rem; gap: 2.5rem; }
  .convo-src { border-left: 1px solid var(--line); padding-left: 2rem; }
}

/* — §04 vignettes ————————————————————————————————————————————————
     Shared chrome first, then A (network) / B (ask) / C (report), then the stats band.
     Every timed thing here also has a reduced-motion off switch. — */
.vig { margin-top: 1.5rem; }
.vig-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; margin-bottom: 1rem; }
.vig-head .mono-lbl { margin: 0; }
.vig-lede { margin: 0 0 1.25rem; max-width: 44rem; font-size: 0.875rem; color: var(--ink-muted); }
.vig-status { margin: 1rem 0 0; min-height: 1.2em; }
/* JS adds .vig-live once the data is in; until then the fallback line carries the section. */
.vig-live .vig-fallback { display: none; }

/* Typing caret — added to whichever element is streaming, removed when it settles. */
@keyframes caret-blink { 50% { opacity: 0; } }
.caret::after { content: "▍"; margin-left: 0.08em; color: var(--accent);
  animation: caret-blink 1s steps(1) infinite; }

/* A — the segments are the data: stroke colour is the risk band, pulse is "look at this today". */
.net-wrap { position: relative; }
.net { border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); padding: 0.5rem; }
.net svg { display: block; width: 100%; height: auto; color: var(--ink-faint); }
.net-frame { opacity: 0.45; }
.net .lbl { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.14em;
  fill: currentColor; stroke: none; }
.seg { outline: none; }
/* Invisible fat stroke: a 2.6px line is not a hit target. */
.seg .hit { stroke: transparent; stroke-width: 22; }
.seg .line { stroke: currentColor; stroke-width: 2.6; transition: stroke-width var(--dur-fast); }
.seg:hover .line, .seg:focus-visible .line { stroke-width: 5.5; }
.seg:focus-visible .hit { stroke: currentColor; stroke-opacity: 0.16; }
/* The pulse rides the fat hit path as a halo, not the line itself — fading the line would make
   the highest-risk segments the hardest to see, which is exactly backwards. */
.seg.hot .hit { stroke: currentColor; stroke-opacity: 0.2;
  animation: skeleton-pulse 2.6s ease-in-out infinite; }

.tip { position: absolute; z-index: 2; transform: translateX(-50%); pointer-events: none;
  width: max-content; max-width: 17rem; border-radius: var(--r-md);
  border: 1px solid var(--line-strong); background: var(--surface); padding: 0.625rem 0.75rem; }
/* Two class levels so this beats the `.tip span { display: block }` below it. */
.tip .tip-top { display: flex; align-items: baseline; justify-content: space-between; gap: 1.25rem;
  margin-bottom: 0.25rem; }
.tip b, .tip em { font-family: var(--font-mono); font-size: 12px; letter-spacing: 0.1em;
  font-style: normal; }
.tip b { color: var(--accent); }
.tip em { color: var(--ink); }
.tip span { display: block; font-size: 0.75rem; color: var(--ink-muted); }
.tip .tip-note { margin-top: 0.375rem; color: var(--ink-faint); white-space: normal; }

/* Below 640px a 1200×380 viewBox squeezes five lines into ~90px — unreadable. Let the well
   pan instead, and dock the readout under it (there is no hover on touch anyway). */
@media (max-width: 640px) {
  .net { overflow-x: auto; }
  .net svg { min-width: 560px; }
  .tip { position: static; transform: none; width: auto; max-width: none; margin-top: 0.5rem; }
}

.legend { display: flex; flex-wrap: wrap; gap: 0.875rem; margin-top: 0.75rem; }
.legend span { display: inline-flex; align-items: center; gap: 0.4rem; color: var(--ink-faint);
  font-family: var(--font-mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.16em; }
.legend i { height: 8px; width: 8px; border-radius: 2px; background: currentColor; }

/* C — ticker on the left, the thing it produced on the right. */
.rep-grid { display: grid; gap: 1.5rem; }
@media (min-width: 760px) { .rep-grid { grid-template-columns: 17rem minmax(0, 1fr); gap: 2rem; } }
.ticker { list-style: none; margin: 0; padding: 0; min-height: 5.5rem;
  display: flex; flex-direction: column; gap: 0.75rem; }
.tick { display: flex; align-items: center; gap: 0.625rem; font-size: 0.875rem; color: var(--ink); }
.tick-dot { height: 7px; width: 7px; border-radius: var(--r-pill); background: var(--accent); flex: none; }
.tick.run .tick-dot { animation: skeleton-pulse 1.2s ease-in-out infinite; }
.tick.done { color: var(--ink-faint); }

.rep { border-radius: var(--r-md); border: 1px solid var(--line); background: var(--canvas);
  padding: 1.125rem 1.25rem; }
.rep-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--line); }
.rep-head b { font-family: var(--font-display); font-weight: 600; font-size: 1rem; }
.rep-row { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0;
  border-bottom: 1px solid var(--line); font-size: 0.8125rem; color: var(--ink-muted); }
.rep-row span:last-child { font-family: var(--font-mono); color: var(--ink); }
.rep-payoff { margin: 0.875rem 0 0; font-family: var(--font-mono); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.14em; color: var(--accent); }

/* Stats band — 2×2 then 1×4 on the same 820px step the .cols-* grids use. auto-fit was
   leaving a 3+1 orphan in the middle range. */
.stats { display: grid; gap: 1.5rem; margin-top: 3rem; grid-template-columns: repeat(2, 1fr); }
@media (min-width: 821px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat-num { margin-top: 0.375rem; font-family: var(--font-display); font-weight: 700;
  font-size: 2.25rem; line-height: 1; letter-spacing: -0.02em; color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
  .caret::after { content: none; }
  .seg.hot .hit, .tick.run .tick-dot { animation: none; }
}

/* — §06 architecture panels ————————————————————————————————————————
     Two inline SVGs in the icon grammar. What they draw is a *generalized* system:
     responsibilities and boundaries, never the build. Nothing in here is named after
     a vendor, library or language, and nothing should ever be.
     Narrow widths reuse §04's answer — the well pans, the page never does. — */
#architecture h3 { margin: 0 0 0.5rem; font-weight: 400; }
/* Container query, not a viewport one: what decides whether the mono labels are still
   legible is the panel's own width, not the window's. */
.arch { margin-top: 2.5rem; container-type: inline-size; }
.arch-well { border-radius: var(--r-md); border: 1px solid var(--line);
  background: var(--surface-2); padding: 0.875rem; }
.arch-well svg { display: block; width: 100%; height: auto; color: var(--ink-faint); }
@container (max-width: 700px) {
  .arch-well { overflow-x: auto; }
  .arch-well svg { min-width: 660px; }
}

/* The whole node grammar. Boxes are hairlines; dashed = "not ours / your choice". */
.arch svg .node { fill: none; stroke: var(--line-strong); }
.arch svg .node-open { stroke-dasharray: 5 5; }
.arch svg .conn { stroke: currentColor; opacity: 0.6; }
.arch svg .bound { stroke: currentColor; stroke-dasharray: 7 6; opacity: 0.85; }
.arch svg text { stroke: none; }
.arch svg .band, .arch svg .cap { font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 0.16em; fill: currentColor; }
.arch svg .tl { font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.08em;
  fill: var(--ink-muted); }
.arch svg .nm { font-family: var(--font-display); font-weight: 600; font-size: 15px; fill: var(--ink); }
.arch svg .bd { font-family: var(--font-sans); font-size: 11.5px; fill: var(--ink-muted); }

/* Connectors draw themselves in on reveal. pathLength="1" makes the dash maths trivial.
   Resting state is *drawn*, so if JS never runs (no .js-reveal) the diagram is complete. */
@keyframes draw-in { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
.arch svg .conn, .arch svg .flow-path { stroke-dasharray: 1; stroke-dashoffset: 0; }
.js-reveal .arch:not(.in) svg .conn,
.js-reveal .arch:not(.in) svg .flow-path { stroke-dashoffset: 1; }
.arch.in svg .conn, .arch.in svg .flow-path { animation: draw-in 1s var(--ease-out-expo) both; }
@media (prefers-reduced-motion: reduce) {
  .arch svg .conn, .arch svg .flow-path { animation: none; stroke-dashoffset: 0; }
}

/* — §07 open invitation — ported from the design language's Connect pattern. */
.card-lg.dashed { border-style: dashed; border-color: var(--line-strong); text-decoration: none; }
.card-lg.dashed:hover { border-color: var(--accent); }
.sharepill { display: inline-flex; align-items: center; gap: 0.4rem; border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); padding: 0.4rem 0.9rem;
  font-size: 0.75rem; font-weight: 500; color: var(--ink); text-decoration: none;
  transition: border-color var(--dur-fast), color var(--dur-fast); }
.sharepill:hover { border-color: var(--accent); color: var(--accent); }

/* — Footer — */
.site-footer { border-top: 1px solid var(--line); padding: 2.5rem 0; font-family: var(--font-mono);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--ink-faint);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; }
.site-footer a { text-decoration: none; transition: color var(--dur-fast); }
.site-footer a:hover { color: var(--accent); }
