/* dtv.dev showcase demo — screenshare-first UI.
   Light-first "glass box" console, dark-mode aware, system fonts only. */

:root {
  --blue: #0045FF;
  --blue-ink: #0033bd;
  --bg: #f7f8fb;
  --surface: #ffffff;
  --fg: #131722;
  --muted: #5b6474;
  --border: #e2e6ee;
  --dot: #dce1ea;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 4px 16px rgba(16, 24, 40, 0.05);

  /* tier ramp */
  --t1: #0d8a4e;  --t1-bg: #e5f6ec;  --t1-border: #b5e3c8;
  --t2: #0045FF;  --t2-bg: #e9efff;  --t2-border: #bfd0ff;
  --t3: #9a6a06;  --t3-bg: #fcf3dc;  --t3-border: #ecd9a4;
  --t4: #c22b47;  --t4-bg: #fce9ed;  --t4-border: #f2c2cd;

  /* row states */
  --ok: #0d8a4e;   --ok-bg: #e5f6ec;
  --hold: #9a6a06; --hold-bg: #fcf3dc;
  --off: #8a93a3;  --off-bg: #f0f2f6;

  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --blue: #5c85ff;
    --blue-ink: #89a7ff;
    --bg: #0b0e14;
    --surface: #131824;
    --fg: #e8ebf2;
    --muted: #96a0b2;
    --border: #232b3b;
    --dot: #1a2130;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.35);

    --t1: #45d08a;  --t1-bg: #0f2519;  --t1-border: #1d4d33;
    --t2: #7aa0ff;  --t2-bg: #131e3d;  --t2-border: #29408a;
    --t3: #e0b054;  --t3-bg: #2a2210;  --t3-border: #574316;
    --t4: #f07f96;  --t4-bg: #2d131c;  --t4-border: #63263a;

    --ok: #45d08a;   --ok-bg: #0f2519;
    --hold: #e0b054; --hold-bg: #2a2210;
    --off: #77839a;  --off-bg: #171d2b;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.5;
  font-size: 16px;
}

/* graph-paper dot grid + faint brand wash up top */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    radial-gradient(ellipse 80% 40% at 50% -10%,
      color-mix(in srgb, var(--blue) 7%, transparent), transparent),
    radial-gradient(circle, var(--dot) 1px, transparent 1.5px);
  background-size: auto, 26px 26px;
}

main { max-width: 1220px; margin: 0 auto; padding: 0 1.5rem 4rem; }
a { color: var(--blue); }
button { font: inherit; cursor: pointer; }
kbd {
  font-family: var(--mono);
  font-size: 0.7em;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 0.05em 0.4em;
  background: var(--bg);
}

/* ---------- top bar ---------- */

.topbar {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0.65rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand {
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 1rem;
}
.brand a { color: var(--fg); text-decoration: none; }
.brand .slash { color: var(--muted); font-weight: 400; margin: 0 0.15em; }
.brand .where { color: var(--blue); }
.topbar .spacer { flex: 1; }
.topbar button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.topbar button:hover { border-color: var(--blue); color: var(--blue); }
.topbar button[aria-pressed="true"] {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.topbar #btn-reset:hover { border-color: var(--t4); color: var(--t4); }

/* ---------- hero + tier badge ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 360px);
  gap: 1.5rem;
  align-items: start;
  margin: 0.3rem 0 1.1rem;
}
.hero h1 {
  font-size: clamp(1.4rem, 2.2vw, 1.8rem);
  line-height: 1.15;
  letter-spacing: -0.022em;
  font-weight: 800;
  margin: 0.25rem 0 0.4rem;
}
.hero h1 em { font-style: normal; color: var(--blue); }
.hero .lead {
  color: var(--muted);
  margin: 0;
  max-width: 62ch;
  font-size: 0.94rem;
}
.eyebrow {
  color: var(--blue);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}

.tier {
  border-radius: 16px;
  border: 1.5px solid var(--t3-border);
  background: var(--t3-bg);
  padding: 0.8rem 1rem 0.85rem;
  box-shadow: var(--shadow);
  transition: background 0.35s ease, border-color 0.35s ease;
}
.tier .tier-top { display: flex; align-items: center; gap: 0.6rem; }
.tier .tier-code {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.15rem 0.55rem;
  border-radius: 7px;
  color: #fff;
  background: var(--t3);
  letter-spacing: 0.02em;
}
.tier .tier-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-top: 0.35rem;
  color: var(--t3);
}
.tier .tier-desc {
  margin: 0.3rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--fg);
  opacity: 0.85;
}
.tier .gpc {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.18rem 0.5rem;
  border-radius: 99px;
  background: var(--t4-bg);
  color: var(--t4);
  border: 1px solid var(--t4-border);
}
.tier[data-tier="T1"] { background: var(--t1-bg); border-color: var(--t1-border); }
.tier[data-tier="T1"] .tier-code { background: var(--t1); }
.tier[data-tier="T1"] .tier-name { color: var(--t1); }
.tier[data-tier="T2"] { background: var(--t2-bg); border-color: var(--t2-border); }
.tier[data-tier="T2"] .tier-code { background: var(--t2); }
.tier[data-tier="T2"] .tier-name { color: var(--t2); }
.tier[data-tier="T4"] { background: var(--t4-bg); border-color: var(--t4-border); }
.tier[data-tier="T4"] .tier-code { background: var(--t4); }
.tier[data-tier="T4"] .tier-name { color: var(--t4); }

/* ---------- section chrome ---------- */

section { margin-bottom: 1.05rem; }
.sec-head {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.5rem;
}
.sec-head h2 {
  font-size: 1.02rem;
  font-weight: 750;
  letter-spacing: -0.01em;
  margin: 0;
}
.sec-head .hint { color: var(--muted); font-size: 0.85rem; }

/* ---------- scenario launcher ---------- */

.scenarios {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.6rem;
}
.scenario {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 0.5rem 0.55rem;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.scenario .s-txt { display: flex; flex-direction: column; min-width: 0; }
.scenario:hover {
  transform: translateY(-2px);
  border-color: var(--blue);
}
.scenario .glyph {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.8rem;
}
.g-google   { background: #4285F4; }
.g-meta     { background: #0866FF; }
.g-linkedin { background: #0A66C2; }
.g-microsoft{ background: #098287; }
.g-tiktok   { background: #161823; border: 1px solid #444; }
.g-email    { background: #b8860b; }
.g-direct   { background: var(--off); }
.scenario .s-name { font-weight: 700; font-size: 0.82rem; color: var(--fg); line-height: 1.2; }
.scenario .s-sub {
  font-family: var(--mono);
  font-size: 0.58rem;
  color: var(--muted);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.url-strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.5rem 0 0.1rem;
  font-size: 0.76rem;
}
.url-strip .url-label {
  flex: none;
  color: var(--muted);
  font-weight: 600;
}
.url-strip code {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.3rem 0.55rem;
  white-space: nowrap;
  overflow-x: auto;
  flex: 1;
  color: var(--fg);
}
.caption {
  margin: 0.3rem 0 0;
  font-size: 0.72rem;
  color: var(--muted);
  max-width: 90ch;
}

/* ---------- journey stepper ---------- */

.journey-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.7rem 1rem 0.65rem;
  box-shadow: var(--shadow);
}
.journey {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
}
.journey li {
  flex: 1;
  position: relative;
  text-align: center;
  padding-top: 0.1rem;
}
.journey li + li::before {
  content: "";
  position: absolute;
  top: 13px;
  left: calc(-50% + 20px);
  width: calc(100% - 40px);
  height: 2px;
  background: var(--border);
  border-radius: 2px;
}
.journey li.done + li.done::before,
.journey li.done + li.active::before { background: var(--blue); }
.journey .node {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.76rem;
  position: relative;
  z-index: 1;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}
.journey li.done .node {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.journey li.active .node {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
}
.journey li.done.active .node { color: #fff; }
.journey .lbl {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.74rem;
  font-weight: 650;
  color: var(--muted);
}
.journey li.done .lbl, .journey li.active .lbl { color: var(--fg); }
.narration {
  margin: 0.55rem 0 0;
  padding: 0.4rem 0.75rem;
  min-height: 2.2em;
  border-left: 3px solid var(--blue);
  background: color-mix(in srgb, var(--blue) 6%, transparent);
  border-radius: 0 8px 8px 0;
  font-size: 0.92rem;
}

/* ---------- consent moment ---------- */

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}
.cbtn {
  border-radius: 10px;
  padding: 0.5rem 1.1rem;
  font-weight: 700;
  font-size: 0.92rem;
  border: 1.5px solid transparent;
  color: #fff;
  box-shadow: var(--shadow);
  transition: transform 0.1s ease, filter 0.1s ease;
}
.cbtn:hover { transform: translateY(-1px); filter: brightness(1.07); }
.cbtn:active { transform: translateY(0); }
.cbtn.accept    { background: #0d8a4e; }
.cbtn.analytics { background: #0045FF; }
.cbtn.decline   { background: transparent; color: var(--t4); border-color: var(--t4); }
.cbtn.ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--border);
  font-weight: 600;
}
.cbtn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.cbtn .mini {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  opacity: 0.8;
  letter-spacing: 0.02em;
}

/* ---------- state cards ---------- */

.cards {
  display: grid;
  grid-template-columns: 1fr 1fr 1.15fr;
  gap: 1rem;
  align-items: start;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}
.card > header {
  padding: 0.8rem 1rem 0.55rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.card h3 { margin: 0; font-size: 0.98rem; letter-spacing: -0.01em; }
.card .card-sub { font-size: 0.72rem; color: var(--muted); }
.card.flash {
  animation: cardflash 1s ease-out;
}
@keyframes cardflash {
  0% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 60%, transparent), var(--shadow); }
  100% { box-shadow: var(--shadow); }
}

.rows { padding: 0.4rem 0.6rem 0.6rem; }
.srow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.42rem 0.4rem;
  border-radius: 9px;
}
.srow + .srow { margin-top: 0.1rem; }
.srow .sicon {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.srow .sicon svg { width: 12px; height: 12px; display: block; }
.srow.on   .sicon { background: var(--ok-bg);   color: var(--ok); }
.srow.hold .sicon { background: var(--hold-bg); color: var(--hold); }
.srow.off  .sicon { background: var(--off-bg);  color: var(--off); }
.srow .smain { flex: 1; min-width: 0; }
.srow .slabel { display: block; font-weight: 650; font-size: 0.83rem; line-height: 1.25; }
.srow .ssub { display: block; font-size: 0.7rem; color: var(--muted); line-height: 1.3; }
.srow .sval {
  flex: none;
  max-width: 46%;
  font-family: var(--mono);
  font-size: 0.7rem;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.srow.on   .sval { color: var(--ok); font-weight: 600; }
.srow.hold .sval { color: var(--hold); font-weight: 600; }
.srow.off  .sval { color: var(--off); }
.srow.off .slabel { color: var(--muted); }

/* ---------- server feed ---------- */

.feed {
  padding: 0.55rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 330px;
  overflow-y: auto;
}
.feed .empty { color: var(--muted); font-size: 0.82rem; margin: 0.3rem 0.4rem; }
.feed-entry {
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  font-size: 0.8rem;
}
.feed-entry summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.6rem;
  cursor: pointer;
  list-style: none;
}
.feed-entry summary::-webkit-details-marker { display: none; }
.feed-entry .dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--off);
}
.feed-entry.ok .dot   { background: var(--ok); }
.feed-entry.hold .dot { background: var(--hold); }
.feed-entry .txt { flex: 1; line-height: 1.35; }
.feed-entry time {
  flex: none;
  font-family: var(--mono);
  font-size: 0.64rem;
  color: var(--muted);
}
.feed-entry pre {
  margin: 0;
  padding: 0.5rem 0.6rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.66rem;
  white-space: pre-wrap;
  word-break: break-all;
  color: var(--muted);
  max-height: 180px;
  overflow-y: auto;
}
.card-actions {
  display: flex;
  gap: 0.5rem;
  padding: 0.6rem 0.8rem 0.8rem;
  border-top: 1px solid var(--border);
}
.card-actions button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 8px;
  padding: 0.42rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 650;
}
.card-actions button:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- nerd mode ---------- */

.nerd {
  border-top: 2px dashed var(--border);
  padding-top: 1.2rem;
}
.nerd .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-width: 0;
}
.panel h3 {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.7rem;
  font-weight: 700;
}
.kv { font-family: var(--mono); font-size: 0.76rem; margin: 0; }
.kv div { display: flex; gap: 0.5rem; padding: 0.18rem 0; }
.kv .k { color: var(--muted); flex: 0 0 9.5rem; }
.kv .v { word-break: break-all; }
.granted { color: var(--ok); font-weight: 600; }
.denied { color: var(--t4); font-weight: 600; }
.none { color: var(--muted); }
.panel pre {
  font-family: var(--mono);
  font-size: 0.72rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem;
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}
#dl-log { display: flex; flex-direction: column; gap: 0.5rem; max-height: 420px; overflow-y: auto; }
#dl-log .entry { border-left: 3px solid var(--blue); flex-shrink: 0; }
#dl-log .entry .ts { color: var(--muted); }
.span2 { grid-column: 1 / -1; }

/* ---------- info tooltips ---------- */

.tip {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
  font: italic 700 10px/1 Georgia, "Times New Roman", serif;
  padding: 0;
  display: inline-grid;
  place-items: center;
  vertical-align: 1px;
  margin-left: 0.35rem;
  cursor: help;
}
.tip:hover,
.tip:focus-visible,
.tip[aria-expanded="true"] {
  border-color: var(--blue);
  color: var(--blue);
  background: color-mix(in srgb, var(--blue) 10%, transparent);
}
.term {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  border-bottom: 1.5px dotted var(--blue);
  cursor: help;
}
.term:hover,
.term:focus-visible,
.term[aria-expanded="true"] { color: var(--blue); }
.gpc[data-tip] { cursor: help; }

.tipbox {
  position: fixed;
  z-index: 1000;
  max-width: 340px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 34px rgba(16, 24, 40, 0.18), var(--shadow);
  padding: 0.7rem 0.85rem 0.65rem;
  font-size: 0.8rem;
  line-height: 1.45;
}
.tipbox::before {
  content: "";
  position: absolute;
  top: -5.5px;
  left: var(--ax, 50%);
  margin-left: -5px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.tipbox.flip::before {
  top: auto;
  bottom: -5.5px;
  transform: rotate(225deg);
}
.tb-title { margin: 0 0 0.25rem; font-weight: 750; font-size: 0.82rem; color: var(--blue); }
.tb-body { margin: 0; color: var(--fg); }
.tb-nerd {
  margin: 0.5rem 0 0;
  padding: 0.4rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.66rem;
  color: var(--muted);
  word-break: break-word;
}
.tb-nlabel {
  display: inline-block;
  font-weight: 700;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--blue);
  margin-right: 0.35rem;
}
.srow .slabel .tip { vertical-align: 0; }

/* ---------- live pipeline diagram ---------- */

.pipe-wrap {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 0.55rem 0.8rem 0.25rem;
  overflow-x: auto;
}
#pipe-svg {
  display: block;
  width: 100%;
  min-width: 880px;
  height: auto;
}

.pedge { stroke: var(--border); stroke-width: 2; }
.parrow { fill: var(--border); }
.pedge-lbl {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  text-anchor: middle;
}

.pnode { cursor: help; outline: none; }
.pn-box {
  fill: var(--bg);
  stroke: var(--border);
  stroke-width: 1.5;
  transition: stroke 0.15s ease;
}
.pnode:hover .pn-box,
.pnode:focus-visible .pn-box,
.pnode[aria-expanded="true"] .pn-box { stroke: var(--blue); stroke-width: 2; }
.pn-ico {
  stroke: var(--blue);
  color: var(--blue);
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pn-title {
  fill: var(--fg);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-anchor: middle;
}
.pn-sub { fill: var(--muted); font-size: 9.5px; text-anchor: middle; }

/* travelling pulse: node centers are 206 user-units apart */
.pulse {
  animation: pulse-travel 6.4s cubic-bezier(0.45, 0.05, 0.55, 0.95) both;
  pointer-events: none;
}
@keyframes pulse-travel {
  0%   { transform: translateX(0);        opacity: 0; }
  4%   { transform: translateX(30px);     opacity: 1; }
  14%  { transform: translateX(206px); }
  18%  { transform: translateX(206px); }
  32%  { transform: translateX(412px); }
  36%  { transform: translateX(412px); }
  50%  { transform: translateX(618px); }
  55%  { transform: translateX(618px); }
  72%  { transform: translateX(824px); }
  77%  { transform: translateX(824px); }
  93%  { transform: translateX(1030px);   opacity: 1; }
  100% { transform: translateX(1030px);   opacity: 0; }
}
.pulse .p-halo { opacity: 0.22; }
.pulse .p-lbl {
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  text-anchor: middle;
  fill: var(--fg);
  paint-order: stroke;
  stroke: var(--surface);
  stroke-width: 3px;
}
.pulse.q-full .p-dot,     .pulse.q-full .p-halo     { fill: var(--ok); }
.pulse.q-stripped .p-dot, .pulse.q-stripped .p-halo { fill: var(--blue); }
.pulse.q-session .p-dot,  .pulse.q-session .p-halo  { fill: var(--hold); }

/* reduced-motion fallback: brief static highlight instead of travel */
#pipe-svg.lit.q-full .pedge,     #pipe-svg.lit.q-full .pn-box     { stroke: var(--ok); }
#pipe-svg.lit.q-full .parrow     { fill: var(--ok); }
#pipe-svg.lit.q-stripped .pedge, #pipe-svg.lit.q-stripped .pn-box { stroke: var(--blue); }
#pipe-svg.lit.q-stripped .parrow { fill: var(--blue); }
#pipe-svg.lit.q-session .pedge,  #pipe-svg.lit.q-session .pn-box  { stroke: var(--hold); }
#pipe-svg.lit.q-session .parrow  { fill: var(--hold); }

.caption .legend { font-weight: 650; }
.caption .legend.q-full { color: var(--ok); }
.caption .legend.q-stripped { color: var(--blue); }
.caption .legend.q-session { color: var(--hold); }

/* ---------- payload chips strip ---------- */

.payload-strip {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.7rem;
  margin-top: 0.6rem;
  padding: 0.5rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.pl-caret {
  position: absolute;
  top: -5.5px;
  left: 58px;
  width: 10px;
  height: 10px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.pl-label {
  font-size: 0.68rem;
  font-weight: 750;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.pl-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--fg);
  padding: 0.18rem 0.6rem 0.18rem 0.24rem;
  font-size: 0.74rem;
  font-weight: 650;
  cursor: help;
}
.chip .c-ico {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.chip .c-ico svg { width: 9px; height: 9px; display: block; }
.chip .c-note {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.62rem;
  color: var(--muted);
  max-width: 15ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip.c-on   { border-color: var(--t1-border); background: var(--t1-bg); }
.chip.c-on .c-ico   { background: var(--ok); color: #fff; }
.chip.c-hold { border-color: var(--t3-border); background: var(--t3-bg); }
.chip.c-hold .c-ico { background: var(--hold); color: #fff; }
.chip.c-off  { border-style: dashed; color: var(--muted); }
.chip.c-off .c-ico  { background: var(--off-bg); color: var(--off); }
.chip:hover,
.chip:focus-visible,
.chip[aria-expanded="true"] { border-color: var(--blue); border-style: solid; }

/* ---------- scenario storyboard ---------- */

.storyboard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--t3);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.6rem 0.95rem 0.7rem;
  margin-bottom: 0.7rem;
}
.storyboard[data-tier="T1"] { border-left-color: var(--t1); }
.storyboard[data-tier="T2"] { border-left-color: var(--t2); }
.storyboard[data-tier="T4"] { border-left-color: var(--t4); }
.sb-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}
.sb-tag {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.14rem 0.5rem;
  border-radius: 6px;
  background: var(--t3-bg);
  color: var(--t3);
}
.storyboard[data-tier="T1"] .sb-tag { background: var(--t1-bg); color: var(--t1); }
.storyboard[data-tier="T2"] .sb-tag { background: var(--t2-bg); color: var(--t2); }
.storyboard[data-tier="T4"] .sb-tag { background: var(--t4-bg); color: var(--t4); }
.sb-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.sb-beats {
  list-style: none;
  counter-reset: beat;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin: 0;
  padding: 0;
}
.sb-beats li {
  counter-increment: beat;
  position: relative;
  padding-left: 1.75rem;
  font-size: 0.8rem;
  line-height: 1.45;
}
.sb-beats li::before {
  content: counter(beat);
  position: absolute;
  left: 0;
  top: 0.08rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  background: var(--t3);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  font-weight: 750;
}
.storyboard[data-tier="T1"] .sb-beats li::before { background: var(--t1); }
.storyboard[data-tier="T2"] .sb-beats li::before { background: var(--t2); }
.storyboard[data-tier="T4"] .sb-beats li::before { background: var(--t4); }

/* ---------- how it works ---------- */

.howit { border-top: 2px dashed var(--border); padding-top: 1.2rem; }
.stages {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.8rem 1rem;
}
.stages li {
  display: flex;
  gap: 0.6rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.7rem 0.85rem;
  font-size: 0.8rem;
  line-height: 1.5;
}
.st-num {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: color-mix(in srgb, var(--blue) 12%, transparent);
  color: var(--blue);
  font-weight: 800;
  font-size: 0.78rem;
  display: grid;
  place-items: center;
  margin-top: 0.05rem;
}
.st-body { min-width: 0; }

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

footer.site {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
  font-size: 0.82rem;
  color: var(--muted);
}
footer.site button {
  background: none;
  border: none;
  padding: 0;
  color: var(--blue);
  font: inherit;
  text-decoration: underline;
}

/* ---------- guided tour (data-mode / data-step on <body>) ---------- */

/* Base: all tour chrome is invisible. With no data-mode at all (JS off)
   or data-mode="full", the page is the classic all-at-once dashboard. */
#tour-head, #tour-nav, .tour-skip, #btn-restart { display: none; }
body[data-mode="full"] #btn-restart { display: inline-block; }

/* guided: quiet chrome — skip link instead of nerd/reset buttons */
body[data-mode="guided"] #btn-nerd,
body[data-mode="guided"] #btn-reset { display: none; }
body[data-mode="guided"] .tour-skip {
  display: inline-block;
  background: none;
  border: none;
  padding: 0.4rem 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
body[data-mode="guided"] .tour-skip:hover { color: var(--blue); }

/* one focused stage per screen */
body[data-mode="guided"] main { max-width: 920px; }
body[data-mode="guided"] main > section { margin-bottom: 1.7rem; }
body[data-mode="guided"][data-step="0"] main > section:not([data-stage~="s0"]),
body[data-mode="guided"][data-step="1"] main > section:not([data-stage~="s1"]),
body[data-mode="guided"][data-step="2"] main > section:not([data-stage~="s2"]),
body[data-mode="guided"][data-step="3"] main > section:not([data-stage~="s3"]),
body[data-mode="guided"][data-step="4"] main > section:not([data-stage~="s4"]),
body[data-mode="guided"][data-step="5"] main > section:not([data-stage~="s5"]),
body[data-mode="guided"][data-step="6"] main > section:not([data-stage~="s6"]) {
  display: none;
}
/* the tour header owns each step's headline — drop in-section h2 dupes */
body[data-mode="guided"] main .sec-head h2 { display: none; }

/* tour header */
body[data-mode="guided"] #tour-head {
  display: block;
  margin: 2.6rem 0 2.2rem;
}
body[data-mode="guided"][data-step="0"] #tour-head { margin-top: 13vh; }
.t-kicker {
  color: var(--blue);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0 0 0.7rem;
}
.t-title {
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  margin: 0 0 0.85rem;
}
.t-sub {
  font-size: 1.06rem;
  line-height: 1.65;
  color: var(--muted);
  max-width: 62ch;
  margin: 0;
}
.t-note {
  margin: 1.2rem 0 0;
  max-width: 62ch;
  font-size: 0.9rem;
  line-height: 1.55;
  padding: 0.6rem 0.95rem;
  border-left: 3px solid var(--t3);
  background: var(--t3-bg);
  border-radius: 0 10px 10px 0;
}

/* tour nav: back · dots · (hint/conversion) · continue.
   Sticky, so the Continue affordance is always at hand — and it lifts
   above the real Klaro notice (fixed bottom-right) while that is open. */
body[data-mode="guided"] #tour-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: sticky;
  bottom: 0.8rem;
  z-index: 900; /* under the Klaro notice (999), above page content */
  margin-top: 2.6rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}
/* Real consent notice open (fixed bottom-right, ~420px wide): pull the
   docked nav left so Continue is never under it. 872px = the guided main
   content width; 434px = notice width + margins. */
@media (min-width: 761px) {
  body[data-mode="guided"]:has(#klaro .cookie-notice:not(.cookie-modal-notice)) #tour-nav {
    margin-right: clamp(0px, calc(434px - (100vw - 872px) / 2), 434px);
  }
}
@media (max-width: 760px) {
  /* mobile: the notice spans the bottom — undock the nav and let the page
     scroll past the banner instead */
  body[data-mode="guided"]:has(#klaro .cookie-notice:not(.cookie-modal-notice)) #tour-nav {
    position: static;
  }
  body[data-mode="guided"]:has(#klaro .cookie-notice:not(.cookie-modal-notice)) main {
    padding-bottom: 260px;
  }
}
body[data-mode="guided"] main { padding-bottom: 2.5rem; }

/* roomier stages: bigger scenario tiles; wide steps get a wider column */
body[data-mode="guided"][data-step="1"] .scenarios {
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}
body[data-mode="guided"][data-step="4"] main,
body[data-mode="guided"][data-step="5"] main,
body[data-mode="guided"][data-step="6"] main { max-width: 1140px; }
.tnav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 10px;
  padding: 0.55rem 1.15rem;
  font-size: 0.92rem;
  font-weight: 650;
}
.tnav-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.tnav-btn:disabled { opacity: 0.45; cursor: default; }
.tnav-btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: var(--shadow);
}
.tnav-btn.primary:hover:not(:disabled) {
  color: #fff;
  filter: brightness(1.08);
}
.tnav-btn.explore {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  font-size: 1.02rem;
  font-weight: 750;
  padding: 0.7rem 1.5rem;
  box-shadow: 0 6px 22px color-mix(in srgb, var(--blue) 35%, transparent);
}
.tnav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}
.tour-hint {
  font-size: 0.8rem;
  font-weight: 650;
  color: var(--t3);
  max-width: 34ch;
  text-align: right;
}
.tour-hint.nudge { animation: hintnudge 0.4s ease; }
@keyframes hintnudge {
  0%, 100% { transform: none; }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
#tour-conversion {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  border-radius: 10px;
  padding: 0.55rem 1.15rem;
  font-size: 0.92rem;
  font-weight: 650;
}
#tour-conversion:hover { border-color: var(--ok); color: var(--ok); }
.tour-dots { display: flex; gap: 0.55rem; list-style: none; margin: 0; padding: 0 0.3rem; }
.dot-btn {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: var(--dot);
  transition: transform 0.15s ease, background 0.15s ease;
}
.dot-btn.seen { background: color-mix(in srgb, var(--blue) 45%, var(--dot)); cursor: pointer; }
.dot-btn.active { background: var(--blue); transform: scale(1.4); }
.dot-btn:disabled { cursor: default; }
.dot-btn.seen:not(:disabled):hover { transform: scale(1.3); }

/* step transition — killed globally under prefers-reduced-motion */
body[data-mode="guided"] main.tour-in > * {
  animation: stepin 0.4s ease both;
}
body[data-mode="guided"] main.tour-in > *:nth-child(n+2) { animation-delay: 0.07s; }
body[data-mode="guided"] main.tour-in > #tour-nav { animation-delay: 0.14s; }
@keyframes stepin {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* step 2 — "This tab" card + payload chips, click-ID lock highlighted */
body[data-mode="guided"][data-step="2"] #sec-journey .journey,
body[data-mode="guided"][data-step="2"] #card-browser,
body[data-mode="guided"][data-step="2"] #card-server,
body[data-mode="guided"][data-step="2"] #pipeline .sec-head,
body[data-mode="guided"][data-step="2"] #pipeline .storyboard,
body[data-mode="guided"][data-step="2"] #pipeline .pipe-wrap,
body[data-mode="guided"][data-step="2"] #pipeline .caption { display: none; }
body[data-mode="guided"][data-step="2"] #sec-journey .journey-wrap {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}
body[data-mode="guided"][data-step="2"] #sec-journey .narration { font-size: 1rem; }
body[data-mode="guided"][data-step="2"] #sec-cards {
  grid-template-columns: 1fr;
  max-width: 680px;
}
body[data-mode="guided"][data-step="2"] #tab-rows .srow.hold,
body[data-mode="guided"][data-step="2"] #payload-chips .chip.c-hold {
  background: var(--hold-bg);
  animation: lockpulse 2.2s ease-in-out infinite;
}
@keyframes lockpulse {
  0%, 100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--hold) 55%, transparent); }
  50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--hold) 22%, transparent); }
}

/* steps 3 & 4 — tier badge takes the hero row alone */
body[data-mode="guided"][data-step="3"] .hero,
body[data-mode="guided"][data-step="4"] .hero {
  grid-template-columns: 1fr;
  margin-bottom: 1.4rem;
}
body[data-mode="guided"][data-step="3"] .hero > div,
body[data-mode="guided"][data-step="4"] .hero > div { display: none; }
body[data-mode="guided"][data-step="3"] .hero .tier,
body[data-mode="guided"][data-step="4"] .hero .tier { max-width: 560px; }
body[data-mode="guided"][data-step="3"] .cbtn {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* step 4 — the three cards + storyboard narration */
body[data-mode="guided"][data-step="4"] #pipeline .sec-head,
body[data-mode="guided"][data-step="4"] #pipeline .pipe-wrap,
body[data-mode="guided"][data-step="4"] #pipeline .payload-strip,
body[data-mode="guided"][data-step="4"] #pipeline .caption { display: none; }
body[data-mode="guided"][data-step="4"] #sec-cards { grid-template-columns: 1fr 1fr 1.15fr; }

/* step 5 — pipeline + payload chips (story panel rests) */
body[data-mode="guided"][data-step="5"] #pipeline .storyboard { display: none; }

/* ---------- responsive degrade ---------- */

@media (max-width: 1080px) {
  .scenarios { grid-template-columns: repeat(4, 1fr); }
  .cards { grid-template-columns: 1fr 1fr; }
  #card-server { grid-column: 1 / -1; }
  .stages { grid-template-columns: 1fr 1fr; }
  body[data-mode="guided"][data-step="4"] #sec-cards { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  body[data-mode="guided"][data-step="4"] #sec-cards { grid-template-columns: 1fr; }
  body[data-mode="guided"][data-step="1"] .scenarios { grid-template-columns: repeat(2, 1fr); }
  body[data-mode="guided"] #tour-nav { gap: 0.7rem; }
  body[data-mode="guided"][data-step="0"] #tour-head { margin-top: 6vh; }
  .hero { grid-template-columns: 1fr; }
  .scenarios { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: 1fr; }
  .journey .lbl { font-size: 0.62rem; }
  .srow .sval { max-width: 38%; }
  .sb-beats { grid-template-columns: 1fr; }
  .stages { grid-template-columns: 1fr; }
  .tipbox { max-width: calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
