/* Central Station's site: the landing page and the two guides.
 *
 * It wears the app's own look (frontend/assets/theme.css, desktop/ui/shell.css):
 * Inter, a pure white or pure black page after the system, the foreground as
 * the only accent, and colour kept for what it means: up, attention, down.
 * Two things are the site's own, both taken from the product: the departure
 * board in the hero is `stack.sh status` as the menu bar shows it, and the
 * line map is the route a request really takes, from a screen to the drive.
 */

@font-face {
  font-family: "Inter";
  src: url("fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* Layout: one 72rem column that reads top to bottom like a line map, each
   section a stop; the guides add a sticky contents rail beside a 68ch
   reading column. */
:root {
  /* colour */
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b70;
  --surface: #f4f4f5;
  --surface-strong: #e9e9eb;
  --rule: #e6e6e8;
  --up: #15803d;
  --attention: #b45309;
  --down: #dc2626;
  /* The departure board is dark in both themes, as a real one is. */
  --board: #0a0a0a;
  --board-fg: #fafafa;
  --board-muted: #8e8e93;
  --board-rule: #2a2a2d;
  --board-up: #30d158;

  /* type */
  --font: "Inter", -apple-system, BlinkMacSystemFont, ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --t-label: 0.75rem;
  --t-sm: 0.875rem;
  --t-base: 1rem;
  --t-lead: 1.1875rem;
  --t-h3: 1.1875rem;
  --t-h2: clamp(1.625rem, 1.2rem + 1.6vw, 2.25rem);
  --t-h1: clamp(2.5rem, 1.4rem + 4.2vw, 4.25rem);
  --tracking-display: -0.035em;
  --tracking-tight: -0.02em;
  --tracking-label: 0.08em;

  /* space and shape: the app's scales */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --gutter: 1.25rem;
  --column: 72rem;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --fg: #fafafa;
    --muted: #8e8e93;
    --surface: #111113;
    --surface-strong: #1c1c1f;
    --rule: #222224;
    --up: #30d158;
    --attention: #ffb340;
    --down: #ff453a;
    --board: #0c0c0e;
    --board-rule: #26262a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --fg: #fafafa;
  --muted: #8e8e93;
  --surface: #111113;
  --surface-strong: #1c1c1f;
  --rule: #222224;
  --up: #30d158;
  --attention: #ffb340;
  --down: #ff453a;
  --board: #0c0c0e;
  --board-rule: #26262a;
  color-scheme: dark;
}

/* --- base ----------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: 1.6;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  line-height: 1.15;
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

p,
ul,
ol,
dl,
figure,
pre,
table {
  margin: 0;
}

img,
svg {
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection {
  background: var(--fg);
  color: var(--bg);
}

code,
kbd,
samp,
pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 0.1em 0.35em;
  border-radius: 6px;
  background: var(--surface);
  overflow-wrap: anywhere;
}

kbd {
  padding: 0.05em 0.4em;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--bg);
}

.wrap {
  width: 100%;
  max-width: var(--column);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.label {
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- header --------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--rule);
}

@supports not (background: color-mix(in srgb, red 50%, blue)) {
  .site-header {
    background: var(--bg);
  }
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-6);
  padding-block: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: var(--tracking-tight);
  text-decoration: none;
}

.brand svg {
  width: 26px;
  height: 26px;
  flex: none;
}

.site-nav {
  min-width: 0;
}

.site-nav ul {
  display: flex;
  gap: var(--space-1) var(--space-4);
  flex-wrap: wrap;
  padding: 0;
  list-style: none;
  font-size: var(--t-sm);
}

.site-nav a {
  display: inline-block;
  padding-block: var(--space-1);
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--fg);
}

.site-nav a[aria-current="page"] {
  font-weight: 600;
}

/* --- buttons -------------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0.6rem 1.15rem;
  border: 1px solid var(--fg);
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--t-sm);
  text-decoration: none;
  transition: transform 0.15s var(--ease-out), background-color 0.15s;
}

.button:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: var(--fg);
  color: var(--bg);
}

.button--secondary {
  border-color: var(--rule);
  background: var(--bg);
}

.button--secondary:hover {
  border-color: var(--fg);
}

/* --- hero ----------------------------------------------------------------- */

.hero {
  padding-block: var(--space-16) var(--space-16);
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--space-12);
  align-items: center;
}

.hero__copy {
  display: grid;
  gap: var(--space-6);
  min-width: 0;
}

.hero h1 {
  font-size: var(--t-h1);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1;
}

.hero__lead {
  max-width: 34rem;
  font-size: var(--t-lead);
  color: var(--muted);
  line-height: 1.55;
}

.hero__lead strong {
  color: var(--fg);
  font-weight: 600;
}

.runs-on {
  font-size: var(--t-sm);
  color: var(--muted);
}

/* The departure board: `stack.sh status`, as the menu bar reads it. */
.board {
  min-width: 0;
  padding: var(--space-6);
  border: 1px solid var(--board-rule);
  border-radius: var(--radius-lg);
  background: var(--board);
  color: var(--board-fg);
  font-family: var(--mono);
  font-size: 0.875rem;
  box-shadow: 0 18px 40px -24px rgb(0 0 0 / 0.5);
}

.board__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--board-rule);
  font-family: var(--font);
}

.board__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
}

.board__title svg {
  width: 20px;
  height: 20px;
}

.board__time {
  font-size: var(--t-label);
  color: var(--board-muted);
  font-variant-numeric: tabular-nums;
}

.board__rows {
  display: grid;
  padding: var(--space-3) 0;
  list-style: none;
}

.board__rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  padding-block: 0.45rem;
  border-bottom: 1px dashed var(--board-rule);
}

.board__rows li:last-child {
  border-bottom: 0;
}

.board__state {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--board-muted);
}

.board__state::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--board-up);
  box-shadow: 0 0 0 3px rgb(48 209 88 / 0.18);
}

.board__summary {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-sm);
  background: rgb(255 255 255 / 0.06);
  font-family: var(--font);
  font-weight: 600;
}

.board__summary::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--board-up);
  animation: pulse 2.4s ease-in-out infinite;
}

.board__note {
  margin-top: var(--space-3);
  font-family: var(--font);
  font-size: var(--t-label);
  color: var(--board-muted);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgb(48 209 88 / 0.45);
  }
  50% {
    box-shadow: 0 0 0 6px rgb(48 209 88 / 0);
  }
}

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

.section {
  padding-block: var(--space-16);
  border-top: 1px solid var(--rule);
}

.section__head {
  display: grid;
  gap: var(--space-3);
  max-width: 44rem;
  margin-bottom: var(--space-12);
}

.section__head h2 {
  font-size: var(--t-h2);
  font-weight: 750;
}

.section__head p:not(.label) {
  color: var(--muted);
  font-size: var(--t-lead);
  line-height: 1.55;
}

/* What it does */
.features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-12) var(--space-8);
  padding: 0;
  list-style: none;
}

.feature {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-width: 0;
  padding-top: var(--space-4);
  border-top: 2px solid var(--fg);
}

.feature h3 {
  font-size: var(--t-h3);
  font-weight: 700;
}

.feature p {
  color: var(--muted);
}

.feature .detail {
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--fg);
}

/* How it works: the line map. A thick line, a station per stop, and the edge
   of the public internet drawn across it. */
.route {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-12);
  align-items: start;
}

.line {
  display: grid;
  padding: 0;
  list-style: none;
}

.line > li {
  position: relative;
  min-width: 0;
  padding: 0 0 var(--space-8) 3.25rem;
}

.line > li:last-child {
  padding-bottom: 0;
}

/* Each stop draws its own stretch of line, from the bottom of its station to
   the top of the next, so the line ends at the last station. */
.line > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 30px;
  bottom: -2px;
  left: 11px;
  width: 6px;
  background: var(--fg);
}

.stop {
  display: grid;
  gap: var(--space-1);
}

.stop::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 0;
  width: 28px;
  height: 28px;
  border: 6px solid var(--fg);
  border-radius: 50%;
  background: var(--bg);
}

.stop--end::before {
  background: var(--fg);
  box-shadow: inset 0 0 0 4px var(--bg);
}

.stop h3 {
  font-size: var(--t-h3);
  font-weight: 700;
}

.stop p {
  color: var(--muted);
}

/* Where the public internet ends: drawn across the line itself. */
.line > li.zone {
  margin-bottom: var(--space-8);
  padding-block: var(--space-2);
  border-block: 2px dashed var(--muted);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
}

.line > li.zone::after {
  top: -2px;
  bottom: calc(-2px - var(--space-8));
}

.route__aside {
  position: sticky;
  top: 6rem;
  display: grid;
  gap: var(--space-6);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  background: var(--surface);
  min-width: 0;
}

.route__aside h3 {
  font-size: var(--t-h3);
}

.ticks {
  display: grid;
  gap: var(--space-3);
  padding: 0;
  list-style: none;
}

.ticks li {
  position: relative;
  padding-left: 1.75rem;
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 0.95rem;
  height: 0.55rem;
  border-left: 2px solid var(--up);
  border-bottom: 2px solid var(--up);
  transform: rotate(-45deg);
}

/* What you need */
.need {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: var(--space-12);
  align-items: start;
}

.need__hardware {
  display: grid;
  gap: var(--space-4);
}

.need__hardware ul {
  display: grid;
  gap: var(--space-3);
  padding-left: 1.1rem;
}

/* Setup, in four stops */
.stops {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-8);
  padding: 0;
  list-style: none;
  counter-reset: stop;
}

.stops > li {
  display: grid;
  align-content: start;
  gap: var(--space-3);
  min-width: 0;
  counter-increment: stop;
}

.stops > li::before {
  content: counter(stop);
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 2px solid var(--fg);
  border-radius: 50%;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stops h3 {
  font-size: var(--t-h3);
}

.stops p {
  color: var(--muted);
}

.byo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-4) var(--space-6);
  align-items: center;
  margin-top: var(--space-12);
  padding: var(--space-6) var(--space-8);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
}

.byo svg {
  width: 44px;
  height: 44px;
}

.byo p {
  color: var(--muted);
}

.byo strong {
  color: var(--fg);
}

.setup-actions {
  margin-top: var(--space-8);
}

.footer-note {
  margin-top: var(--space-4);
}

/* --- tables, code, notes -------------------------------------------------- */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--t-sm);
}

th,
td {
  padding: 0.7rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--rule);
}

tr:last-child td {
  border-bottom: 0;
}

th {
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
}

td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

.code {
  position: relative;
  min-width: 0;
}

.code pre {
  overflow-x: auto;
  padding: var(--space-4) var(--space-6);
  padding-right: 5rem;
  border-radius: var(--radius-md);
  background: var(--surface);
  line-height: 1.6;
  tab-size: 2;
}

.code pre .c {
  color: var(--muted);
}

.copy {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  font: 600 var(--t-label) / 1.4 var(--font);
  cursor: pointer;
}

.copy:hover {
  border-color: var(--fg);
}

.note {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.note > .label {
  color: var(--fg);
}

.note--warn > .label {
  color: var(--attention);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: var(--t-sm);
  font-weight: 600;
  white-space: nowrap;
}

.pill::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.pill--up::before {
  background: var(--up);
}

.pill--attention::before {
  background: var(--attention);
}

.pill--down::before {
  background: var(--down);
}

/* --- the guides ----------------------------------------------------------- */

.doc-hero {
  padding-block: var(--space-12) var(--space-8);
  border-bottom: 1px solid var(--rule);
}

.doc-hero .wrap {
  display: grid;
  gap: var(--space-4);
}

.doc-hero h1 {
  font-size: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);
  font-weight: 800;
  letter-spacing: var(--tracking-display);
  line-height: 1.02;
}

.doc-hero p:not(.label) {
  max-width: 44rem;
  font-size: var(--t-lead);
  color: var(--muted);
}

.doc {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--space-12);
  padding-block: var(--space-12) var(--space-24);
}

.toc {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  font-size: var(--t-sm);
}

.toc ol {
  display: grid;
  gap: 0.15rem;
  margin-top: var(--space-3);
  padding: 0;
  list-style: none;
  border-left: 2px solid var(--rule);
}

.toc a {
  display: block;
  margin-left: -2px;
  padding: 0.3rem 0 0.3rem var(--space-4);
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}

.toc a:hover {
  color: var(--fg);
}

.toc a.is-current {
  border-left-color: var(--fg);
  color: var(--fg);
  font-weight: 600;
}

.prose {
  display: grid;
  gap: var(--space-4);
  max-width: 68ch;
  min-width: 0;
}

.prose > section {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.prose > section + section {
  margin-top: var(--space-12);
  padding-top: var(--space-12);
  border-top: 1px solid var(--rule);
}

.prose h2 {
  font-size: var(--t-h2);
  font-weight: 750;
}

.prose h3 {
  margin-top: var(--space-4);
  font-size: var(--t-h3);
  font-weight: 700;
}

.prose ul,
.prose ol {
  display: grid;
  gap: var(--space-2);
  padding-left: 1.4rem;
}

.prose li > ul,
.prose li > ol {
  margin-top: var(--space-2);
}

/* The lists are grids, and a grid item is as wide as its widest line by
   default: a long command would widen the page instead of scrolling inside
   its own block. */
.prose li,
.prose dt,
.prose dd {
  min-width: 0;
}

.prose ol.steps {
  gap: var(--space-4);
}

.prose ol.steps > li::marker {
  font-weight: 700;
}

.prose dl {
  display: grid;
  gap: var(--space-3);
}

.prose dt {
  font-weight: 600;
}

.prose dd {
  margin: 0;
  color: var(--muted);
}

.next {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--rule);
}

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

.site-footer {
  padding-block: var(--space-12) var(--space-16);
  border-top: 1px solid var(--rule);
  font-size: var(--t-sm);
  color: var(--muted);
}

.site-footer .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-6) var(--space-12);
}

.site-footer .brand {
  color: var(--fg);
}

.site-footer p {
  max-width: 40rem;
}

.site-footer ul {
  display: grid;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

/* --- narrow screens ------------------------------------------------------- */

@media (max-width: 960px) {
  .hero .wrap,
  .route,
  .need {
    grid-template-columns: minmax(0, 1fr);
  }

  .route__aside {
    position: static;
  }

  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stops {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc {
    grid-template-columns: minmax(0, 1fr);
  }

  .toc {
    position: static;
    max-height: none;
    padding: var(--space-4) var(--space-6);
    border-radius: var(--radius-md);
    background: var(--surface);
  }

  .toc ol {
    grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
    border-left: 0;
  }

  .toc a {
    margin-left: 0;
    padding-left: 0;
    border-left: 0;
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 1rem;
  }

  /* On a phone the header scrolls away, and its links sit on one line that
     scrolls sideways, rather than holding a third of the screen. */
  .site-header {
    position: static;
  }

  .site-nav {
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .site-nav::-webkit-scrollbar {
    display: none;
  }

  .site-nav ul {
    flex-wrap: nowrap;
    white-space: nowrap;
  }

  .hero {
    padding-block: var(--space-12);
  }

  .section {
    padding-block: var(--space-12);
  }

  .features,
  .stops {
    grid-template-columns: minmax(0, 1fr);
  }

  .byo {
    grid-template-columns: minmax(0, 1fr);
    padding: var(--space-6);
  }

  .site-footer .wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .board {
    padding: var(--space-4);
  }

  td:first-child {
    white-space: normal;
  }
}

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