/* TeamShared Router — public landing page.
 * Loaded after dashboard.css, which owns the tokens, buttons, tables and the
 * brand lockup. Everything here is landing-only. CSP: first-party, no inline
 * styles, no external fonts; every dynamic state is a class or an attribute. */

/* ---------- Page ---------- */

.landing {
  --measure: 72rem;
  --glow: rgba(99, 102, 241, 0.16);
  background:
    radial-gradient(1400px 800px at 50% -25%, var(--glow), transparent 62%),
    var(--bg);
}
.landing main { max-width: var(--measure); margin: 0 auto; padding: 0 1.25rem; }

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 20;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  background: var(--accent-strong);
  color: #fff;
}
.skip:focus { top: 1rem; }

.btn-sm { padding: 0.45rem 0.85rem; font-size: 0.85rem; }

/* ---------- Header ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  background: rgba(7, 8, 13, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-soft);
}
.site-nav { display: flex; align-items: center; gap: 1.1rem; }
.site-nav > a:not(.btn) { color: var(--muted); font-size: 0.9rem; font-weight: 500; }
.site-nav > a:not(.btn):hover { color: var(--text); }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 5.5rem 0 4rem;
}
/* A dot grid under the title that fades out before the worked example. It is
 * a background, so it costs nothing and needs no markup. */
.hero::before {
  content: "";
  position: absolute;
  inset: 0 -1.25rem 40%;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 255, 255, 0.075) 1px, transparent 1.2px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(60% 70% at 50% 35%, #000 20%, transparent 100%);
  mask-image: radial-gradient(60% 70% at 50% 35%, #000 20%, transparent 100%);
  pointer-events: none;
}
.hero h1 {
  margin: 0;
  font-size: clamp(2.7rem, 8vw, 5.4rem);
  line-height: 1;
  letter-spacing: -0.045em;
  font-weight: 650;
  color: var(--text);
  background: linear-gradient(180deg, #ffffff 0%, #d9dcf2 55%, #b5b9dd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-note {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.4rem 0.6rem;
  max-width: 100%;
  margin: 1.6rem 0 0;
  overflow-wrap: anywhere;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(17, 19, 29, 0.7);
  color: var(--muted);
  font-size: 0.86rem;
}
.hero-note-k {
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; margin-top: 2rem; }
.hero-cta .btn { padding: 0.75rem 1.4rem; font-size: 0.95rem; }

/* ---------- Worked example ---------- */

.trace {
  width: 100%;
  margin: 3.75rem 0 0;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(23, 26, 41, 0.9), rgba(11, 13, 21, 0.95));
  box-shadow: var(--shadow), 0 0 0 1px rgba(99, 102, 241, 0.08), 0 40px 90px -50px rgba(99, 102, 241, 0.45);
  overflow: hidden;
}
.trace figcaption {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.9rem;
}
.trace figcaption .eyebrow { display: inline; margin: 0 0.6rem 0 0; }
.trace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  grid-template-areas:
    "req res"
    "steps res";
  gap: 0;
}
.trace-req { grid-area: req; }
.trace-res { grid-area: res; border-left: 1px solid var(--border-soft); }
.trace-steps { grid-area: steps; }
.trace-col { padding: 1.1rem 1.25rem; }
.trace-title {
  margin: 0 0 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--faint);
}
.trace .code { background: rgba(7, 8, 13, 0.6); }
.trace .code code { font-size: 0.8rem; }

.trace-steps {
  list-style: none;
  counter-reset: trace;
  margin: 0;
  padding: 0.4rem 1.25rem 1.25rem;
  border-top: 1px solid var(--border-soft);
  display: grid;
  gap: 0.35rem;
}
.trace-steps li {
  counter-increment: trace;
  display: grid;
  grid-template-columns: 1.6rem 6.2rem minmax(0, 1fr);
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.5rem 0;
  border-bottom: 1px dashed var(--border-soft);
  font-size: 0.86rem;
  color: var(--muted);
}
.trace-steps li:last-child { border-bottom: 0; }
.trace-steps li::before {
  content: counter(trace);
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 650;
  align-self: start;
}
.trace-k {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}
.trace-v { overflow-wrap: anywhere; }
.trace-v.mono { font-size: 0.78rem; color: var(--accent-bright); }

@media (prefers-reduced-motion: no-preference) {
  .trace-steps li, .trace-res .code {
    opacity: 0;
    transform: translateY(6px);
    animation: trace-in 0.5s var(--ease-out) forwards;
  }
  .trace-steps li:nth-child(1) { animation-delay: 0.35s; }
  .trace-steps li:nth-child(2) { animation-delay: 0.7s; }
  .trace-steps li:nth-child(3) { animation-delay: 1.05s; }
  .trace-steps li:nth-child(4) { animation-delay: 1.4s; }
  .trace-steps li:nth-child(5) { animation-delay: 1.75s; }
  .trace-res .code { animation-delay: 2.2s; }
  @keyframes trace-in {
    to { opacity: 1; transform: none; }
  }
}

/* ---------- Sections ---------- */

.section { padding: 4rem 0; border-top: 1px solid var(--border-soft); scroll-margin-top: 4.5rem; }
.section-head { max-width: 50rem; margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.025em; }
.section-lead { color: var(--muted); margin: 0; font-size: 1.02rem; }
.section-lead code, .stage p code, .callout code { color: var(--accent-bright); }

/* A fact that qualifies the section above it — including the ones that say
 * what the router deliberately does not do. */
.callout {
  margin: 1.5rem 0 0;
  padding: 0.9rem 1.1rem;
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--accent-soft);
  color: var(--muted);
  font-size: 0.93rem;
}

.landing .code { position: relative; }
.copy-btn {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(23, 26, 41, 0.85);
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.15s var(--ease-out), color 0.15s var(--ease-out);
}
.code:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.is-done { opacity: 1; }
.copy-btn.is-done { color: var(--success); border-color: var(--success); }

/* ---------- Request path: the spine ---------- */

.stages {
  --node: 2.6rem;
  list-style: none;
  counter-reset: stage;
  position: relative;
  margin: 0;
  padding: 0 0 0 calc(var(--node) + 1.4rem);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}
/* Grid items default to min-width: auto, which lets one long line inside a
 * <pre> set the width of its whole column; the code block is meant to scroll
 * inside its card, not push the card off the phone. */
.stage, .trace-col, .trace-steps, .rubric, .ladder-wrap, .roster-wrap, .sim-field, .fact, .tab-panel { min-width: 0; }
/* The vertical rail the stage nodes sit on. It runs from the first node to
 * the last, and glows the accent so the eye reads the order top to bottom. */
.stages::before {
  content: "";
  position: absolute;
  left: calc(var(--node) / 2 - 1px);
  top: var(--node);
  bottom: var(--node);
  width: 2px;
  background: linear-gradient(180deg, var(--accent), rgba(99, 102, 241, 0.15));
}
.stage {
  counter-increment: stage;
  position: relative;
  padding: 1.35rem 1.5rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
}
.stage::before {
  content: counter(stage);
  position: absolute;
  left: calc(-1 * (var(--node) + 1.4rem));
  top: 1.2rem;
  width: var(--node);
  height: var(--node);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(139, 144, 255, 0.35);
  background: radial-gradient(circle at 30% 30%, rgba(139, 144, 255, 0.35), var(--accent-soft) 70%);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 650;
  box-shadow: 0 0 0 6px var(--bg), 0 0 24px -4px rgba(99, 102, 241, 0.6);
}
.stage-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1rem; margin-bottom: 0.75rem; }
.stage-head h3 { margin: 0; font-size: 1.2rem; letter-spacing: -0.015em; }
.stage-cost {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--faint);
}
.stage p { color: var(--muted); font-size: 0.95rem; }
.stage p:last-child { margin-bottom: 0; }
.stage strong { color: var(--text); font-weight: 600; }
.stage .code { margin: 0 0 0.9rem; }
.stage .code code { font-size: 0.8rem; }
.stage .table-wrap { margin: 0.25rem 0 1rem; }
.stage .table-wrap:last-child { margin-bottom: 0; }

/* Exit tables: condition → route → what the caller sees. */
.exits { font-size: 0.86rem; }
.exits th:first-child { width: 34%; }
.exits th:last-child { width: 30%; }
.exits td { color: var(--muted); }
.exits td:first-child { color: var(--text); }
.exits td code { font-size: 0.78rem; }
.exits td:last-child code { color: var(--muted); }
.exits td br { line-height: 1.9; }

/* ---------- Ladder ---------- */

.ladder-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 1.25rem;
  align-items: stretch;
}
.rubric {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.rubric li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 0.9rem;
}
.rubric li:last-child { border-bottom: 0; }
.rubric-n {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-weight: 650;
}
.ladder-wrap { border-color: var(--border); }
.ladder th:first-child, .ladder td:first-child {
  width: 6.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 650;
  color: var(--accent-bright);
}
.ladder td { padding: 0.95rem 0.85rem; }
.ladder td:first-child { font-size: 1.15rem; }
.ladder td code { color: var(--text); }
.ladder td:nth-child(n + 3) { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Specialists: beside the ladder, keyed by the rungs they claim. Full width, because
 * seven columns do not fit in the grid cell the ladder shares with the rubric. */
.roster-wrap { margin-top: 1.25rem; border-color: var(--border); }
.roster { font-size: 0.88rem; }
.roster th:first-child, .roster td:first-child {
  width: 6.5rem;
  text-align: center;
  font-family: var(--font-mono);
  font-weight: 650;
  color: var(--accent-bright);
  white-space: nowrap;
}
.roster td { padding: 0.85rem 0.85rem; color: var(--muted); }
.roster td code { color: var(--text); }
.roster td:nth-child(3) { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text); }
.roster td:nth-child(4) { min-width: 11rem; }
.roster td:nth-child(5) { font-family: var(--font-mono); font-size: 0.76rem; color: var(--warn); }
.roster td:nth-child(n + 6) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.roster-note { margin: 1.25rem 0 0; max-width: 60rem; color: var(--muted); font-size: 0.95rem; }
.roster-note code { color: var(--accent-bright); }

/* ---------- Response contract ---------- */

.fields { font-size: 0.86rem; }
.fields th:nth-child(1) { width: 17%; }
.fields th:nth-child(2) { width: 30%; }
.fields td { color: var(--muted); }
.fields td code { font-size: 0.78rem; }
.fields td:first-child code { color: var(--text); }
.fields td:nth-child(2) code { color: var(--accent-bright); }
.fields td:nth-child(3) code { color: var(--muted); }

/* ---------- Prefilter simulator ---------- */

.sim {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 1.35rem 1.4rem 1.5rem;
}
.sim-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1rem 1.25rem;
  align-items: start;
}
.sim-field label { margin-bottom: 0.45rem; }
.sim textarea {
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--text);
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 5.6rem;
  transition: border-color 0.15s var(--ease-out), box-shadow 0.15s var(--ease-out);
}
.sim textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sim textarea:focus:not(:focus-visible) { outline: none; }
.sim input[type="number"] { margin: 0; font-family: var(--font-mono); }
.sim-hint { margin: 0.45rem 0 0; color: var(--faint); font-size: 0.8rem; }
.sim-examples { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.chip {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 500;
}
.chip:hover { color: var(--text); }
.sim-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 1.1rem 0 0.6rem;
  min-height: 1.2rem;
  color: var(--faint);
  font-size: 0.78rem;
}
.sim-result {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  padding: 1rem 1.1rem;
}
.sim-result > p { margin: 0; font-size: 0.9rem; }
.sim-verdict {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin: 0 0 0.85rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}
.sim-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  background: var(--accent-soft);
  color: var(--accent-bright);
}
.sim-badge.is-short { background: rgba(52, 211, 153, 0.14); color: var(--success); }
.sim-badge.is-scored { background: rgba(167, 139, 250, 0.16); color: var(--pending); }
.sim-badge.is-floor { background: rgba(251, 191, 36, 0.14); color: var(--warn); }
.sim-lines {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.3rem 1.25rem;
  margin: 0;
  font-size: 0.86rem;
}
.sim-lines dt { margin: 0; color: var(--faint); font-family: var(--font-mono); font-size: 0.78rem; }
.sim-lines dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }
.sim-lines dd .mono { color: var(--accent-bright); }
.sim-headers {
  margin: 0.9rem 0 0;
  padding: 0.75rem 0.9rem;
  border-top: 1px dashed var(--border);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- Coverage ---------- */

.ids { font-size: 0.88rem; }
.ids th:first-child { width: 44%; }
.ids td { color: var(--muted); }
.ids td code { color: var(--text); font-size: 0.8rem; overflow-wrap: anywhere; }
.ids tbody tr:first-child td code { color: var(--accent-bright); }

/* ---------- Quickstart ---------- */

.tabs { border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.tab-list { display: flex; gap: 0.25rem; padding: 0.5rem 0.6rem 0; border-bottom: 1px solid var(--border-soft); }
.tab-list label {
  margin: 0;
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 550;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  transition: color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.tab-list label:hover { color: var(--text); background: var(--panel-2); }
.tab-panel { display: none; }
.tab-panel .code { border: 0; border-radius: 0; }
#qs-curl:checked ~ #panel-curl, #qs-py:checked ~ #panel-py, #qs-node:checked ~ #panel-node { display: block; }
#qs-curl:checked ~ .tab-list label[for="qs-curl"],
#qs-py:checked ~ .tab-list label[for="qs-py"],
#qs-node:checked ~ .tab-list label[for="qs-node"] {
  color: var(--text);
  background: var(--bg-soft);
  box-shadow: inset 0 -2px 0 var(--accent);
}
#qs-curl:focus-visible ~ .tab-list label[for="qs-curl"],
#qs-py:focus-visible ~ .tab-list label[for="qs-py"],
#qs-node:focus-visible ~ .tab-list label[for="qs-node"] { outline: 2px solid var(--accent-ring); outline-offset: -2px; }

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0 2rem;
}
.fact {
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
}
.fact h3 { margin-bottom: 0.45rem; }
.fact p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.fact code { color: var(--accent-bright); }
#quickstart .hero-cta { margin-top: 0; justify-content: flex-start; }

/* ---------- Footer ---------- */

.site-foot {
  max-width: var(--measure);
  margin: 2rem auto 0;
  padding: 2rem 1.25rem 3rem;
  border-top: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
}
.site-foot .muted { margin: 0; flex: 1 1 18rem; font-size: 0.9rem; }
.foot-nav { display: flex; gap: 1.1rem; }
.foot-nav a { color: var(--muted); font-size: 0.9rem; }
.foot-nav a:hover { color: var(--text); }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .trace-grid { grid-template-columns: 1fr; grid-template-areas: "req" "steps" "res"; }
  .trace-res { border-left: 0; border-top: 1px solid var(--border-soft); }
  .ladder-grid { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .sim-inputs { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .site-nav { gap: 0.85rem; }
  .site-nav > a:not(.btn) { display: none; }
  .hero { padding: 3.5rem 0 3rem; }
  .hero-note { font-size: 0.78rem; border-radius: var(--radius); }
  .section { padding: 3rem 0; }
  .stages { --node: 2.1rem; padding-left: calc(var(--node) + 0.9rem); }
  .stage { padding: 1.1rem 1rem 1.2rem; }
  .stage::before { left: calc(-1 * (var(--node) + 0.9rem)); font-size: 0.82rem; }
  .trace-steps li { grid-template-columns: 1.4rem minmax(0, 1fr); }
  .trace-steps .trace-v { grid-column: 2; }
  /* Prose tables read better stacked than scrolled at phone width. */
  .exits thead, .fields thead, .ids thead { display: none; }
  .exits tr, .fields tr, .ids tr { display: block; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border-soft); }
  .exits td, .fields td, .ids td { display: block; padding: 0.15rem 0; border: 0; }
  .exits td:nth-child(2), .fields td:nth-child(2) { color: var(--text); }
  .fields td:first-child { margin-bottom: 0.1rem; }
  .fields td:first-child code { font-size: 0.86rem; }
  .copy-btn { opacity: 1; }
}
