:root {
  --bg:        #F6F8F9;
  --surface:   #FFFFFF;
  --ink:       #12181C;
  --muted:     #576C74;
  --rule:      #DBE3E6;
  --rule-soft: #EAF0F2;
  --accent:    #0C6E88;
  --accent-soft:#E2F1F5;
  --signal:    #A9530B;
  --signal-soft:#FBEEDF;
  --shadow:    0 1px 2px rgba(18,24,28,.05), 0 8px 24px rgba(18,24,28,.05);

  --display: "Concourse T4", "Helvetica Neue", Arial, sans-serif;
  --body: "Equity Text A", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --caps: "Concourse C2 Caps", "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:        #0D1316;
    --surface:   #141D21;
    --ink:       #E3EDF0;
    --muted:     #8DA2AA;
    --rule:      #243137;
    --rule-soft: #1A252A;
    --accent:    #56C2DA;
    --accent-soft:#102B33;
    --signal:    #E5A344;
    --signal-soft:#2A2013;
    --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
:root[data-theme="dark"] {
  --bg:        #0D1316;
  --surface:   #141D21;
  --ink:       #E3EDF0;
  --muted:     #8DA2AA;
  --rule:      #243137;
  --rule-soft: #1A252A;
  --accent:    #56C2DA;
  --accent-soft:#102B33;
  --signal:    #E5A344;
  --signal-soft:#2A2013;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.56;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 28px 120px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0 56px;
}

@media (min-width: 1080px) {
  .shell { grid-template-columns: 210px minmax(0, 1fr); }
}

/* ---------- masthead ---------- */

.masthead {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 56px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 18px;
}

h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(38px, 6vw, 62px);
  line-height: 1.02;
  letter-spacing: -.028em;
  text-wrap: balance;
  margin: 0 0 22px;
}

.standfirst {
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 60ch;
  margin: 0 0 36px;
}

#fontrom {
  display: block;
  width: 100%;
  max-width: 480px;
  height: auto;
  image-rendering: pixelated;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
  padding: 14px 0;
}

.caption {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
  margin: 12px 0 0;
  max-width: 62ch;
}

/* Concourse C2 Caps carries the uppercase micro-labels. Every selector
   here already sets text-transform: uppercase. */
.eyebrow, .links dt code, thead th, blockquote > p:first-child,
nav.toc, h2::before, .milestones dt::before {
  font-family: var(--caps);
  letter-spacing: .06em;
}

/* ---------- toc ---------- */

nav.toc {
  display: none;
  position: sticky;
  top: 32px;
  align-self: start;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}
nav.toc ol { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
nav.toc a { color: var(--muted); text-decoration: none; display: flex; gap: 10px; }
nav.toc a:hover, nav.toc a:focus-visible { color: var(--accent); }
nav.toc .n { color: var(--rule); font-weight: 700; }

/* ---------- sections ---------- */

/* The markdown source carries no <section> wrappers -- content is a flat
   stream of headings and blocks -- so section spacing lives on h2 margins
   and the 00..07 rail is a CSS counter rather than hand-written markup. */
main { min-width: 0; counter-reset: sec -1; }

main > *:first-child { margin-top: 0; }

h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(25px, 3.2vw, 32px);
  letter-spacing: -.02em;
  line-height: 1.15;
  text-wrap: balance;
  margin: 68px 0 8px;
  scroll-margin-top: 24px;
  position: relative;
  padding-left: 40px;
}
h2::before {
  counter-increment: sec;
  content: counter(sec, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: .42em;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -.008em;
  margin: 34px 0 10px;
}

p { margin: 0 0 16px; max-width: 68ch; }

a { color: var(--accent); text-underline-offset: 2px; text-decoration-thickness: 1px; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

strong { font-weight: 600; }

code {
  font-family: var(--mono);
  font-size: .855em;
  background: var(--rule-soft);
  padding: .14em .36em;
  border-radius: 3px;
}

pre {
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 18px 20px;
  margin: 20px 0;
  overflow-x: auto;
}
pre code { background: none; padding: 0; font-size: inherit; }
pre .c { color: var(--muted); }

main ul { list-style: none; margin: 0 0 16px; padding: 0; display: flex; flex-direction: column; gap: 12px; max-width: 68ch; }
main ul > li { padding-left: 20px; position: relative; }
main ul > li::before {
  content: "";
  position: absolute;
  left: 2px; top: .62em;
  width: 7px; height: 7px;
  background: var(--accent);
}

/* ---------- link list ---------- */

/* Each entry is one definition-list term plus exactly two definitions:
   the description, then the source line. "dd + dd" is what distinguishes
   them -- CSS cannot look ahead to the next dt, but it can tell a second
   dd from a first. Adding a third dd to an entry would break that. */
.links { margin: 22px 0; }
.links dl { margin: 0; border-bottom: 1px solid var(--rule-soft); }
.links dt {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
  padding: 15px 0 3px;
  border-top: 1px solid var(--rule-soft);
}
.links dt a { text-decoration: none; }
.links dt a:hover { text-decoration: underline; }
.links dd {
  margin: 0 0 3px;
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  max-width: 62ch;
}
.links dd + dd {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent);
  word-break: break-all;
  opacity: .85;
  max-width: none;
  padding-bottom: 12px;
}

/* A tag is inline code in the term line; bolding it marks the warning
   variant, so `start here` and **`has errors`** stay plain markdown. */
.links dt code {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 7px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: 2px;
  white-space: nowrap;
}
.links dt strong code { color: var(--signal); background: var(--signal-soft); }

/* ---------- tables ---------- */

.scroller { overflow-x: auto; margin: 22px 0; border: 1px solid var(--rule); border-radius: 4px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: 14.5px; min-width: 620px; }
th, td { text-align: left; padding: 11px 16px; border-bottom: 1px solid var(--rule-soft); vertical-align: top; }
thead th {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
tbody tr:last-child td { border-bottom: none; }
td code { background: none; padding: 0; color: var(--accent); font-weight: 500; }

/* ---------- callout ---------- */

/* A callout is a blockquote whose first line is a bold label:
     > **Automated test suite**
     >
     > body...  */
blockquote {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-left: 3px solid var(--signal);
  border-radius: 4px;
  padding: 18px 22px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}
blockquote > p:first-child {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--signal);
  margin-bottom: 7px;
}
blockquote > p:first-child strong { font-weight: 700; }
blockquote > p:last-child { margin-bottom: 0; }

/* ---------- milestones ---------- */

/* Same definition-list shape as .links: term, body dd, then the "Done when"
   dd. M1..M6 are counted rather than written out, so reordering or inserting
   a milestone in the markdown renumbers the rail automatically. */
.milestones { margin: 24px 0; }
.milestones dl { margin: 0; counter-reset: ms; border-bottom: 1px solid var(--rule-soft); }
.milestones dt {
  font-family: var(--display);
  font-weight: 600;
  font-size: 16.5px;
  margin: 0 0 6px;
  padding: 20px 0 0 78px;
  border-top: 1px solid var(--rule-soft);
  position: relative;
}
.milestones dt::before {
  counter-increment: ms;
  content: "M" counter(ms);
  position: absolute;
  left: 0;
  top: 23px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}
.milestones dd { font-size: 15px; margin: 0 0 8px 78px; }
.milestones dd + dd {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  border-left: 2px solid var(--rule);
  padding-left: 12px;
  margin-bottom: 0;
  padding-bottom: 20px;
  line-height: 1.55;
}
.milestones dd + dd strong { color: var(--ink); font-weight: 700; }

footer {
  grid-column: 1 / -1;
  margin-top: 80px;
  padding-top: 26px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}
/* ---------- responsive placement (must stay last) ---------- */

@media (min-width: 1080px) {
  .masthead { grid-column: 1 / -1; grid-row: 1; }
  nav.toc   { display: block; grid-column: 1; grid-row: 2; }
  main      { grid-column: 2; grid-row: 2; }
  footer    { grid-column: 1 / -1; grid-row: 3; }
}
