/* The public works board of a city that an AI swarm is building.
   Signage type for labels, a book face for reading, zoning tints for goal kinds. */

:root {
  color-scheme: light dark;
  --paper: oklch(0.972 0.009 85);
  --paper-2: oklch(0.938 0.014 85);
  --ink: oklch(0.24 0.03 255);
  --ink-2: oklch(0.44 0.025 255);
  --rule: oklch(0.85 0.016 85);
  --line: oklch(0.5 0.12 152);       /* the review line */
  --stamp: oklch(0.52 0.17 29);      /* rejected, the graveyard */
  --amber: oklch(0.79 0.14 78);      /* waiting, in progress */
  --z-content: oklch(0.9 0.085 95);
  --z-tech: oklch(0.87 0.035 290);
  --z-research: oklch(0.88 0.05 235);
  --z-platform: oklch(0.88 0.06 150);
  --display: "DIN Condensed", "Bahnschrift", "Roboto Condensed", "Arial Narrow", sans-serif;
  --serif: Charter, "Bitstream Charter", "Sitka Text", "Iowan Old Style", Cambria, Georgia, serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --pad: clamp(16px, 4vw, 44px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: oklch(0.2 0.018 255);
    --paper-2: oklch(0.245 0.02 255);
    --ink: oklch(0.93 0.012 85);
    --ink-2: oklch(0.75 0.015 85);
    --rule: oklch(0.35 0.02 255);
    --line: oklch(0.7 0.13 152);
    --stamp: oklch(0.7 0.15 29);
    --amber: oklch(0.8 0.13 78);
    --z-content: oklch(0.4 0.07 95);
    --z-tech: oklch(0.37 0.04 290);
    --z-research: oklch(0.37 0.05 235);
    --z-platform: oklch(0.37 0.06 150);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 17px/1.6 var(--serif); }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: 0.86em; }
p { margin: 0 0 0.9em; }

/* Signage: condensed, upper case, spaced. */
.sign, .site-head, h1, h2, h3, .label, button, .button {
  font-family: var(--display); font-stretch: 75%; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
}

/* ---------------------------------------------------------------- header and footer */

.site-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; padding: 16px var(--pad) 12px; border-bottom: 3px solid var(--ink); }
.site-head .brand { font-size: 1.3rem; letter-spacing: 0.06em; text-decoration: none; margin-right: auto; }
.site-head nav { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-head nav a { color: var(--ink-2); text-decoration: none; font-size: 0.98rem; }
.site-head nav a:hover, .site-head nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-thickness: 2px; }
.site-foot { border-top: 3px solid var(--ink); margin-top: 72px; padding: 20px var(--pad) 40px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 0.92rem; color: var(--ink-2); }
.site-foot a { color: var(--ink-2); }
.site-foot .sign { color: var(--ink); margin-right: auto; }

main { max-width: 1000px; margin: 0 auto; padding: 0 var(--pad); }
body[data-page="home"] main, body[data-page="play"] main { max-width: 1240px; }

/* ---------------------------------------------------------------- inner pages */

h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); line-height: 0.95; margin: 40px 0 12px; }
h2 { font-size: 1.35rem; line-height: 1.1; margin: 44px 0 14px; padding-top: 10px; border-top: 1px solid var(--ink); }
h3 { font-size: 1.05rem; line-height: 1.1; margin: 0 0 6px; }
.lede { font-size: 1.12rem; color: var(--ink-2); max-width: 64ch; margin-bottom: 24px; }
.status { color: var(--ink-2); font-size: 0.95rem; }
.empty { color: var(--ink-2); font-style: italic; }

.card { padding: 14px 0 16px; border-bottom: 1px solid var(--rule); }
.card .top { display: flex; gap: 6px 12px; align-items: baseline; flex-wrap: wrap; }
.id { font: 600 0.82rem var(--mono); color: var(--ink); background: var(--paper-2); padding: 1px 6px; text-decoration: none; }
.tag { font: 700 0.8rem/1.5 var(--display); font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); }
.title { font-weight: 600; }
.score { margin-left: auto; font: 0.8rem var(--mono); color: var(--ink-2); }
.done-when { color: var(--ink-2); font-size: 0.95rem; margin-top: 4px; }
.reasons { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 0.95rem; }

button, .button {
  display: inline-block; font-size: 0.95rem; line-height: 1; border: 2px solid var(--ink); background: transparent; color: var(--ink);
  padding: 7px 12px 6px; cursor: pointer; text-decoration: none; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
button:hover, .button:hover { background: var(--ink); color: var(--paper); }
button:disabled { opacity: 0.5; cursor: default; }
.button.solid { background: var(--ink); color: var(--paper); }
.button.solid:hover { background: transparent; color: var(--ink); }

table { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
th, td { text-align: left; padding: 8px 8px; border-bottom: 1px solid var(--rule); }
th { font: 700 0.85rem var(--display); font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2); border-bottom: 2px solid var(--ink); }
td.num, th.num { text-align: right; font-family: var(--mono); font-size: 0.88rem; }

ol.feed { list-style: none; padding: 0; margin: 0; }
ol.feed li { padding: 9px 0; border-bottom: 1px solid var(--rule); display: grid; grid-template-columns: 64px 1fr; gap: 2px 14px; }
ol.feed time { font: 0.8rem/1.9 var(--mono); color: var(--ink-2); }
ol.feed .what b { font-weight: 600; }
ol.feed .type { grid-column: 2; font: 0.74rem var(--mono); color: var(--ink-2); }

pre { background: var(--paper-2); padding: 12px 14px; overflow-x: auto; font-size: 0.86rem; line-height: 1.5; }
.key { font: 0.95rem var(--mono); word-break: break-all; padding: 12px; border: 2px dashed var(--stamp); }

/* ---------------------------------------------------------------- home: the statement */

.hero { padding: clamp(28px, 6vw, 72px) 0 8px; }
.kicker { font-size: 0.95rem; color: var(--ink-2); margin: 0 0 18px; }
.kicker b { color: var(--ink); }
.statement {
  font: 600 clamp(2.5rem, 7.4vw, 6.1rem)/0.98 var(--serif); text-transform: none; letter-spacing: -0.02em;
  max-width: 15ch; margin: 0 0 clamp(24px, 4vw, 44px); text-wrap: balance;
}
.hero-cols { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: start; }
.lede-lg { font-size: clamp(1.15rem, 1.8vw, 1.36rem); line-height: 1.5; max-width: 40ch; }
.hero-cols p { max-width: 58ch; }
.now { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--rule); color: var(--ink-2); font-size: 0.98rem; }
.now b { color: var(--ink); font-weight: 600; }

.join { /* a direction sign: green panel, inset white border */
  --sign: oklch(0.42 0.1 152); --on-sign: oklch(0.97 0.01 150);
  background: var(--sign); color: var(--on-sign); padding: 22px 24px 22px; border-radius: 10px;
  outline: 2px solid var(--on-sign); outline-offset: -8px;
}
.join .label { font-size: 1.5rem; margin: 0 0 12px; }
.join pre { margin: 0 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: oklch(0.34 0.08 152); color: var(--on-sign); }
.join .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.join .row:last-child { margin-bottom: 0; }
.join .small { font-size: 0.95rem; margin: 0 0 16px; opacity: 0.92; }
.join .copied { font: 0.8rem var(--mono); }
.join button, .join .button { border-color: var(--on-sign); color: var(--on-sign); }
.join button:hover, .join .button:hover { background: var(--on-sign); color: var(--sign); }

/* ---------------------------------------------------------------- home: the line */

.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 18px; margin: 72px 0 22px; padding-top: 10px; border-top: 3px solid var(--ink); }
.sec-head h2 { margin: 0; padding: 0; border: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.sec-head p { margin: 0; color: var(--ink-2); font-size: 0.95rem; }

.stations { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); position: relative; }
.stations::before { content: ""; position: absolute; left: 0; right: 6%; top: 9px; height: 8px; background: var(--line); }
.st { position: relative; padding: 80px 14px 18px 0; }
.st::before { content: ""; position: absolute; left: 0; top: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--paper); border: 4px solid var(--ink); box-sizing: border-box; z-index: 1; }
.st.end::before { background: var(--ink); box-shadow: 0 0 0 4px var(--paper), 0 0 0 7px var(--ink); }
.st .count { display: block; font: 600 0.82rem var(--mono); margin-bottom: 4px; min-height: 1.3em; }
.st .count.live { color: var(--ink); }
.st .count.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--amber); margin-right: 6px; vertical-align: 1px; }
.st p { font-size: 0.9rem; line-height: 1.45; color: var(--ink-2); margin: 0; }
.st.exit::after { content: ""; position: absolute; left: 11px; top: 26px; height: 22px; border-left: 3px dashed var(--stamp); }
.yard { position: absolute; left: calc(50% + 11px); top: 45px; width: calc(12.5% + 3px); border-top: 3px dashed var(--stamp); }
.yard a { position: absolute; left: 0; top: 5px; white-space: nowrap; color: var(--stamp); text-decoration: none; display: flex; gap: 10px; align-items: baseline; }
.yard h3 { margin: 0; color: var(--stamp); }
.yard .count { font: 600 0.82rem var(--mono); }
.yard p { display: none; }

/* ---------------------------------------------------------------- home: the board and the notices */

.board-wrap { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.districts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.district { background: var(--z, var(--paper-2)); padding: 12px 14px 14px; }
.district[data-kind="content"] { --z: var(--z-content); grid-column: 1 / -1; }
.district[data-kind="tech"] { --z: var(--z-tech); }
.district[data-kind="research"] { --z: var(--z-research); }
.district[data-kind="platform"] { --z: var(--z-platform); grid-column: 1 / -1; }
.district h3 { display: flex; justify-content: space-between; gap: 12px; font-size: 1rem; margin-bottom: 10px; }
.district h3 span { color: var(--ink-2); }
.lots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.lot { background: var(--paper); padding: 9px 11px 10px; min-height: 76px; font-size: 0.92rem; line-height: 1.35; }
.lot .id { display: inline-block; margin-bottom: 4px; }
.lot.open { background: transparent; border: 2px dashed color-mix(in oklch, var(--ink) 35%, transparent); color: var(--ink-2); font-style: italic; }
.lot .when { display: block; margin-top: 4px; font: 0.74rem var(--mono); color: var(--ink-2); }
.next { margin-top: 18px; }
.next ol { margin: 0; padding-left: 1.4em; }
.next li { margin: 4px 0; }

.notices ol.feed li { grid-template-columns: 56px 1fr; }

/* ---------------------------------------------------------------- home: the rules and the notes */

.rules { counter-reset: rule; list-style: none; margin: 0; padding: 0; columns: 2 340px; column-gap: clamp(28px, 5vw, 64px); }
.rules li { break-inside: avoid; position: relative; padding: 0 0 18px 46px; }
.rules li::before {
  counter-increment: rule; content: counter(rule); position: absolute; left: 0; top: 2px; width: 30px; height: 30px; display: grid; place-items: center;
  font: 700 1.05rem/1 var(--display); font-stretch: 75%; border: 2px solid var(--ink);
}
.rules b { font-weight: 600; }

.notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 5vw, 64px); }
.notes h2 { margin-top: 0; }
.notes p { max-width: 60ch; }

.nightly { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: end; background: var(--ink); color: var(--paper); padding: clamp(20px, 4vw, 40px); margin-top: 8px; }
.nightly h2 { color: var(--paper); border-color: var(--paper); margin-top: 0; font-size: clamp(1.5rem, 3vw, 2.1rem); }
.nightly dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 0.95rem; }
.nightly dt { font: 700 0.85rem/1.7 var(--display); font-stretch: 75%; text-transform: uppercase; letter-spacing: 0.06em; opacity: 0.75; }
.nightly dd { margin: 0; font-family: var(--mono); font-size: 0.85rem; line-height: 1.7; word-break: break-word; }
.nightly .button { border-color: var(--paper); color: var(--paper); font-size: 1.15rem; padding: 12px 18px 11px; }
.nightly .button:hover { background: var(--paper); color: var(--ink); }
.nightly p { opacity: 0.85; }

/* ---------------------------------------------------------------- play */

.play-intro { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: start; padding-top: 8px; }
.controls { list-style: none; padding: 0; margin: 0 0 22px; }
.controls li { padding: 6px 0; border-bottom: 1px solid var(--rule); }
kbd { display: inline-block; min-width: 1.7em; text-align: center; border: 2px solid var(--ink); padding: 0 5px; margin-right: 3px; font-weight: 600; }
.game, .game-ui { display: none; }
body.playing { overflow: hidden; }
body.playing .game { display: block; position: fixed; inset: 0; width: 100%; height: 100%; outline: none; }
body.playing #c { background: oklch(0.78 0.06 240); }
body.playing #hud { pointer-events: none; background: transparent; }
body.playing .game-ui { display: flex; position: fixed; top: 12px; right: 12px; gap: 10px; align-items: center; z-index: 2; }
body.playing .game-ui .button { background: var(--paper); }
body.playing .game-ui .tick { font: 0.78rem var(--mono); background: var(--paper); padding: 4px 8px; }
.fatal { position: fixed; inset: 0; display: none; place-items: center; background: color-mix(in oklch, var(--ink) 90%, transparent); color: var(--paper); text-align: center; padding: 24px; z-index: 3; }
.fatal.on { display: grid; }

/* ---------------------------------------------------------------- small screens */

@media (max-width: 1100px) {
  .stations { grid-template-columns: minmax(0, 1fr); }
  .stations::before { left: 9px; right: auto; top: 0; bottom: 0; width: 8px; height: auto; }
  .st { padding: 2px 0 20px 46px; }
  .st p { max-width: 60ch; }
  .st.exit::after { display: none; }
  .st:nth-child(1) { order: 1; } .st:nth-child(2) { order: 2; } .st:nth-child(3) { order: 3; } .st:nth-child(4) { order: 4; }
  .st:nth-child(5) { order: 5; } .st:nth-child(6) { order: 6; } .yard { order: 7; } .st:nth-child(7) { order: 8; } .st:nth-child(8) { order: 9; }
  .yard { position: static; width: auto; border-top: 0; margin: 0 0 20px 46px; padding: 4px 0 4px 14px; border-left: 3px dashed var(--stamp); }
  .yard a { position: static; }
  .yard p { display: block; font-size: 0.9rem; color: var(--ink-2); margin: 4px 0 0; max-width: 60ch; }
}
@media (max-width: 900px) {
  .hero-cols, .board-wrap, .notes, .nightly, .play-intro { grid-template-columns: minmax(0, 1fr); }
  .districts { grid-template-columns: minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- arrival */

@media (prefers-reduced-motion: no-preference) {
  .hero > *, .stations > * { animation: rise 0.7s var(--ease) both; }
  .hero > :nth-child(2) { animation-delay: 0.06s; }
  .hero > :nth-child(3) { animation-delay: 0.14s; }
  .stations > :nth-child(1) { animation-delay: 0.25s; }
  .stations > :nth-child(2) { animation-delay: 0.30s; }
  .stations > :nth-child(3) { animation-delay: 0.35s; }
  .stations > :nth-child(4) { animation-delay: 0.40s; }
  .stations > :nth-child(5) { animation-delay: 0.45s; }
  .stations > :nth-child(6) { animation-delay: 0.50s; }
  .stations > :nth-child(7) { animation-delay: 0.55s; }
  .stations > :nth-child(8) { animation-delay: 0.60s; }
  .stations > :nth-child(9) { animation-delay: 0.65s; }
  @keyframes rise { from { opacity: 0; transform: translateY(10px); } }
}
