/* ============================================================
   Design system — grounded in the subject: US road signage.
   Display type: Barlow Condensed (highway-signage lineage).
   Body: Newsreader (the essay is the centerpiece).
   Data/code: JetBrains Mono.
   Accent: park-service sign brown; guide-sign green for passes.
   ============================================================ */
:root {
  --paper: #f2f1ec;
  --paper-raised: #faf9f6;
  --ink: #21201c;
  --ink-soft: #55524a;
  --rule: #d9d5ca;
  --sign: #5a4632;        /* recreation-area sign brown */
  --sign-deep: #3c2e1f;
  --guide: #2e5e43;       /* highway guide-sign green */
  --term-bg: #16191e;
  --term-ink: #d7ddd9;
  --term-dim: #8a949b;
  --shadow: 0 1px 2px rgba(33, 32, 28, 0.08), 0 4px 14px rgba(33, 32, 28, 0.06);
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: "Newsreader", Georgia, serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.06rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 62rem; margin: 0 auto; padding: 0 1.25rem; }

a { color: var(--sign); }

/* ---------- masthead ---------- */
.masthead {
  background: var(--paper-raised);
  border-bottom: 1px solid var(--rule);
  padding-top: 3.25rem;
}
.eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}
.masthead h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  max-width: 18ch;
}
.masthead h1 .sub {
  display: block;
  color: var(--sign);
  font-weight: 600;
  font-size: 0.52em;
  letter-spacing: 0.02em;
  margin-top: 0.35rem;
}
.masthead-tagline {
  max-width: 44rem;
  margin-top: 1.1rem;
  font-size: 1.12rem;
  color: var(--ink-soft);
}

/* ---------- the mile rail (signature) ---------- */
.rail-band {
  margin-top: 2.5rem;
  background: var(--sign-deep);
  color: #efe9df;
  padding: 1.6rem 0 1.3rem;
}
.rail {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 0;
  padding-bottom: 0.4rem;
}
.rail::before {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 1.85rem;
  height: 3px;
  background: repeating-linear-gradient(90deg,
    #cfc4b2 0 26px, transparent 26px 40px); /* dashed centerline */
  opacity: 0.65;
}
.rail-node {
  flex: 1 1 0;
  min-width: 0;
  text-align: center;
  position: relative;
  padding-bottom: 2.4rem;
}
.rail-node .post {
  position: absolute;
  bottom: 1.3rem; left: 50%;
  transform: translateX(-50%);
  width: 3px; height: 0.85rem;
  background: #cfc4b2;
}
.rail-node .mark {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(0.95rem, 2.2vw, 1.5rem);
  line-height: 1;
  color: #fff;
}
.rail-node .mark small {
  font-size: 0.55em;
  font-weight: 600;
  color: #cfc4b2;
  margin-left: 1px;
}
.rail-node .driven {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(0.7rem, 1.5vw, 0.98rem);
  line-height: 1.1;
  margin-top: 0.12rem;
  color: #9fbfa8;                 /* guide-sign green, the increasing axis */
  white-space: nowrap;
}
.rail-node .driven small {
  font-size: 0.62em;
  font-weight: 600;
  color: #7d9a86;
  margin-left: 1px;
}
.rail-node .park {
  display: block;
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  color: #cfc4b2;
  margin-top: 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rail-node.terminus .mark { color: #f0c98a; }
.rail-caption {
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.55;
  color: #b8ad9a;
  max-width: 56rem;
}
@media (max-width: 720px) {
  .rail-node .park { display: none; }
  /* no room for the unit labels — the caption carries them instead */
  .rail-node .mark small,
  .rail-node .driven small { display: none; }
}

/* ---------- tab bar: trailhead signs ---------- */
.tabbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper-raised);
  border-bottom: 2px solid var(--sign-deep);
}
.tabbar-inner {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  padding-top: 0.6rem;
  scrollbar-width: none;
}
.tabbar-inner::-webkit-scrollbar { display: none; }
.tab {
  appearance: none;
  border: 1px solid var(--rule);
  border-bottom: none;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 0.5rem 1.05rem 0.45rem;
  border-radius: 6px 6px 0 0;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--sign-deep);
  border-color: var(--sign-deep);
  color: #f4efe6;
}
.tab:focus-visible {
  outline: 3px solid var(--guide);
  outline-offset: 2px;
}

/* ---------- main ---------- */
#main { padding: 2.6rem 1.25rem 4rem; }
.panel { animation: rise 240ms ease-out; }
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.9rem;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 2.4rem 0 0.9rem;
}
h2:first-child { margin-top: 0; }
h2 .rule {
  display: block;
  width: 3.2rem;
  height: 4px;
  background: var(--sign);
  margin-top: 0.35rem;
}

/* essay
   One centred column. --measure is the reading width; figures and tables
   break out to the full .essay width but stay centred on the same axis,
   so nothing hangs off to one side of the page. */
.essay {
  --measure: 47rem;
  max-width: 56rem;
  margin-inline: auto;
}
.essay > h2 {
  max-width: var(--measure);
  margin-left: auto;
  margin-right: auto;
}
.essay p {
  margin: 0 auto 1.05rem;
  max-width: var(--measure);
}
.essay .lede {
  font-size: 1.28rem;
  line-height: 1.55;
  font-weight: 500;
}
.essay blockquote {
  border-left: 4px solid var(--sign);
  background: var(--paper-raised);
  padding: 0.9rem 1.2rem;
  margin: 1.2rem auto 1.3rem;
  max-width: var(--measure);
  font-style: italic;
}
.essay blockquote.prompt-block {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.6;
}
.essay .aside {
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.essay pre.before-after {
  background: var(--term-bg);
  color: var(--term-ink);
  font-family: var(--mono);
  font-size: 0.85rem;
  padding: 1rem 1.2rem;
  border-radius: 8px;
  overflow-x: auto;
  margin: 1.2rem auto 1.4rem;
  max-width: var(--measure);
}

/* screenshots — the AI transcripts and program outputs from the paper */
.shot {
  margin: 1.5rem auto 1.8rem;
  max-width: 100%;
}
.shot-frame {
  /* hug the screenshot so narrower captures are never upscaled and blurred */
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.shot-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.42rem 0.8rem;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.shot-bar::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--sign);
  flex: none;
}
.shot img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}
.shot img + img { border-top: 1px solid var(--rule); }
.shot figcaption {
  margin: 0.55rem auto 0;
  max-width: var(--measure, 47rem);
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink-soft);
}

/* click-to-zoom overlay for the screenshots */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  background: rgba(24, 22, 18, 0.88);
  cursor: zoom-out;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.lightbox-hint {
  position: absolute;
  bottom: 0.9rem;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #b8ad9a;
}

/* tables */
.table-scroll { overflow-x: auto; margin: 1.2rem 0 0.5rem; }
table {
  border-collapse: collapse;
  width: 100%;
  min-width: 34rem;
  font-size: 0.9rem;
  background: var(--paper-raised);
  box-shadow: var(--shadow);
}
thead th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: left;
  background: var(--sign-deep);
  color: #f0ebe1;
  padding: 0.55rem 0.85rem;
}
tbody td {
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
tbody tr td:first-child {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--sign-deep);
  white-space: nowrap;
}
.table-caption {
  font-size: 0.85rem;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0.5rem 0 1.4rem;
  max-width: 46rem;
}
.essay p.table-caption {
  margin: 0.5rem auto 1.4rem;
  max-width: var(--measure);
}

/* ---------- implementation pages ---------- */
.impl-head { margin-bottom: 1.6rem; }
.impl-attr {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--sign);
  color: #f4efe6;
  padding: 0.28rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.7rem;
}
.impl-summary { max-width: 46rem; font-size: 1.12rem; }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14.5rem, 1fr));
  gap: 0.7rem;
  margin: 1.5rem 0;
}
.fact {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
}
.fact .k {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.25rem;
}
.fact .v {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.25;
}

.impl-story p { max-width: 46rem; margin-bottom: 1rem; }

/* terminal panels */
.terminal {
  background: var(--term-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  margin: 1.1rem 0 1.6rem;
  overflow: hidden;
}
.terminal-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.9rem;
  background: #1e232a;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--term-dim);
}
.terminal-bar .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #3a4249;
}
.terminal pre {
  padding: 0.9rem 1.1rem 1.1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--term-ink);
}
.build-cmd {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--paper-raised);
  border: 1px dashed var(--sign);
  border-radius: 8px;
  padding: 0.7rem 0.95rem;
  margin: 0.9rem 0 1.4rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--sign-deep);
}
.output-note {
  font-size: 0.92rem;
  font-style: italic;
  color: var(--ink-soft);
  max-width: 46rem;
  margin-bottom: 1rem;
}

/* code browser */
.codebar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.9rem 0;
}
.filechip {
  appearance: none;
  border: 1px solid var(--rule);
  background: var(--paper-raised);
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.32rem 0.65rem;
  border-radius: 999px;
  cursor: pointer;
  color: var(--ink-soft);
}
.filechip:hover { border-color: var(--sign); color: var(--ink); }
.filechip[aria-selected="true"] {
  background: var(--sign);
  border-color: var(--sign);
  color: #f4efe6;
}
.filechip .ln { opacity: 0.65; margin-left: 0.3rem; }
.codeview {
  background: var(--term-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.codeview .terminal-bar { justify-content: space-between; }
.codeview pre {
  max-height: 34rem;
  overflow: auto;
  padding: 0.9rem 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--term-ink);
}
.codeview code { display: block; min-width: max-content; }
.codeview .line {
  display: block;
  padding: 0 1.1rem 0 0;
  white-space: pre;
}
.codeview .line::before {
  content: attr(data-n);
  display: inline-block;
  width: 3.2rem;
  padding-right: 1rem;
  text-align: right;
  color: #4a545c;
  user-select: none;
}

/* comparison */
.compare-note {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
  margin: 0.5rem 0 1.6rem;
  max-width: 48rem;
}
.win { color: var(--guide); font-weight: 600; }

/* footer */
.site-footer {
  border-top: 1px solid var(--rule);
  background: var(--paper-raised);
  padding: 1.6rem 0 2rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}


/* ---- dataset sidebar ---- */
.layout { display: flex; gap: 28px; align-items: flex-start; }
.layout > main { flex: 1 1 auto; min-width: 0; }
.data-rail { flex: 0 0 290px; position: sticky; top: 14px; }
.data-rail details {
  border: 1px solid var(--rule, #d8d2c6); border-radius: 6px;
  background: var(--card, #fffdf8); padding: 10px 12px;
}
.data-rail summary {
  cursor: pointer; font-family: "Barlow Condensed", sans-serif;
  font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  font-size: 14px;
}
.data-rail .data-note {
  font-size: 12.5px; font-style: italic; opacity: .75; margin: 8px 0;
  line-height: 1.45;
}
.data-rail pre {
  max-height: 60vh; overflow: auto; font-size: 11px; line-height: 1.5;
  margin: 0; padding: 8px; background: rgba(0,0,0,.04); border-radius: 4px;
  white-space: pre;
}
@media (max-width: 1080px) {
  .layout { flex-direction: column; }
  .data-rail { position: static; flex: none; width: 100%; }
}
.route-html { padding: 10px 14px; overflow-x: auto; }
.route-html table { border-collapse: collapse; width: 100%; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.route-html th { text-align: left; font-family: "Barlow Condensed", sans-serif; letter-spacing: .05em; text-transform: uppercase; font-size: 12.5px; padding: 5px 10px; border-bottom: 2px solid var(--rule, #d8d2c6); }
.route-html td { padding: 5px 10px; border-bottom: 1px solid var(--rule, #e4ded2); }
.essay h3 { font-family: "Barlow Condensed", sans-serif; font-size: 21px; letter-spacing: .03em; margin: 1.6em 0 .5em; }
