@font-face {
  font-family: "Overpass";
  src: url("/static/fonts/overpass.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Tokens: survey-map paper and ink, motorway-sign blue for actions, road-marking yellow. */
:root {
  --paper: #eef1ea;
  --surface: #f7f9f4;
  --ink: #18221e;
  --ink-soft: #4a5751;
  --rule: #c9d2c3;
  --sign: #2456a6;
  --sign-hover: #1b4486;
  --on-sign: #ffffff;
  --marking: #f2b705;
  --asphalt: #3b4341;
  --asphalt-edge: #e9ece5;
  --danger: #a8261d;

  --font: "Overpass", "Highway Gothic", "Segoe UI", system-ui, sans-serif;
  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.3125rem;
  --step-2: 1.75rem;
  --step-4: clamp(2.6rem, 6.2vw, 4.75rem);
  --measure: 34rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  --radius: 6px;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151d18;
    --surface: #1c2620;
    --ink: #e3e9e1;
    --ink-soft: #a7b4ac;
    --rule: #2c3a32;
    --sign: #4f7fd6;
    --sign-hover: #6a95e3;
    --on-sign: #0b1426;
    --asphalt: #59625f;
    --asphalt-edge: #2b3530;
    --danger: #f08a80;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--step-0) / 1.55 var(--font);
  font-kerning: normal;
}

a {
  color: var(--sign);
  text-underline-offset: 0.18em;
}

:focus-visible {
  outline: 3px solid var(--marking);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.1;
  margin: 0;
  text-wrap: balance;
}

h2 {
  font-size: var(--step-2);
  font-weight: 800;
  letter-spacing: -0.01em;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.9rem;
  padding: 0.55rem 1.15rem 0.45rem;
  border: 2px solid var(--sign);
  border-radius: var(--radius);
  color: var(--sign);
  background: transparent;
  font: 700 var(--step-0) / 1 var(--font);
  text-decoration: none;
  cursor: pointer;
}

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

.button.primary {
  background: var(--sign);
  color: var(--on-sign);
}

.button.primary:hover {
  background: var(--sign-hover);
  color: var(--on-sign);
}

/* ---------- Hero: the contour map with the route drawn over it ---------- */

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--rule);
}

.hero .terrain {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: var(--gutter);
  max-width: 76rem;
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem) var(--gutter) clamp(3rem, 8vw, 6rem);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 clamp(2.5rem, 8vw, 5.5rem);
  font-size: var(--step-1);
  font-weight: 800;
}

.hero h1 {
  font-size: var(--step-4);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 0.98;
  max-width: 11ch;
}

.lede {
  max-width: var(--measure);
  margin: 1.4rem 0 2rem;
  font-size: var(--step-1);
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero .fine {
  margin: 1.25rem 0 0;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.route {
  width: 100%;
  height: auto;
  overflow: visible;
}

.route .road-edge,
.route .road,
.route .centre {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.route .road-edge {
  stroke: var(--asphalt-edge);
  stroke-width: 26;
}

.route .road {
  stroke: var(--asphalt);
  stroke-width: 20;
}

.route .centre {
  stroke: var(--marking);
  stroke-width: 2.5;
  stroke-dasharray: 12 12;
  stroke-linecap: butt;
}

.gantry > rect {
  fill: var(--ink);
}

.gantry .sign {
  fill: var(--sign);
}

.gantry text {
  fill: #fff;
  font: 800 13px var(--font);
  letter-spacing: 0.06em;
  text-anchor: middle;
}

/* The one orchestrated moment: the route draws itself, then its gantries appear. */
@media (prefers-reduced-motion: no-preference) {
  .route .reveal {
    stroke-dasharray: 1 1;
    stroke-dashoffset: 1;
    animation: draw 1.8s cubic-bezier(0.55, 0.1, 0.3, 1) 0.25s forwards;
  }

  .gantry-start {
    opacity: 0;
    animation: appear 0.35s ease-out 0.2s forwards;
  }

  .gantry-finish {
    opacity: 0;
    animation: appear 0.35s ease-out 2s forwards;
  }
}

@keyframes draw {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes appear {
  to {
    opacity: 1;
  }
}

/* ---------- Content ---------- */

main {
  max-width: 76rem;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

main > section {
  padding: clamp(3rem, 8vw, 5.5rem) 0;
}

main > section + section {
  border-top: 1px solid var(--rule);
}

.steps ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 3rem);
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
}

/* Step numbers as route shields: the content is a real sequence. */
.shield {
  display: inline-grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding-top: 0.15em;
  border: 2px solid var(--on-sign);
  border-radius: 9px;
  outline: 2px solid var(--sign);
  background: var(--sign);
  color: var(--on-sign);
  font-size: var(--step-1);
  font-weight: 900;
}

.steps h3 {
  margin: 1rem 0 0.5rem;
  font-size: var(--step-1);
  font-weight: 800;
}

.steps p,
.built dd {
  max-width: var(--measure);
  margin: 0;
  color: var(--ink-soft);
}

.steps .note {
  margin-top: 2.5rem;
  color: var(--ink);
}

.built dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(1.5rem, 5vw, 4rem);
  margin: 2rem 0 0;
}

.built dl > div {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--rule);
}

.built dt {
  font-weight: 800;
}

.needs ul {
  margin: 1.5rem 0 2rem;
  padding-left: 1.2rem;
  max-width: var(--measure);
}

.needs li + li {
  margin-top: 0.35rem;
}

/* As wide as main's content, so its rule lines up with the section rules above. */
.site-footer {
  width: calc(min(76rem, 100%) - 2 * var(--gutter));
  margin: 0 auto;
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.site-footer p {
  margin: 0;
}

.site-footer p + p a + a {
  margin-left: 1.25rem;
}

@media (max-width: 52rem) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .route {
    max-width: 28rem;
    justify-self: end;
  }

  .steps ol,
  .built dl {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 30rem) {
  .built dl > div {
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }
}

/* ---------- Admin ---------- */

.admin {
  max-width: 56rem;
  padding: 2rem var(--gutter) 4rem;
}

.admin button {
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem 0.25rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: 600 var(--step--1) / 1 var(--font);
  cursor: pointer;
}

.admin button:hover:not(:disabled) {
  border-color: var(--ink-soft);
}

.admin button[aria-pressed="true"] {
  background: var(--sign);
  border-color: var(--sign);
  color: var(--on-sign);
  cursor: default;
}

.admin button.danger {
  color: var(--danger);
}

.admin button.button.primary {
  min-height: 2.9rem;
  padding: 0.55rem 1.15rem 0.45rem;
  background: var(--sign);
  border-color: var(--sign);
  color: var(--on-sign);
  font-size: var(--step-0);
}

.login {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

.login form {
  display: grid;
  gap: 1rem;
  width: min(22rem, 100%);
}

.login h1 {
  font-size: var(--step-2);
  font-weight: 800;
}

.login label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}

.login input {
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--ink-soft);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.error {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-left: 4px solid var(--danger);
  background: var(--surface);
}

.admin-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.admin-head h1 {
  font-size: var(--step-2);
  font-weight: 800;
}

.admin-head p {
  margin: 0;
  color: var(--ink-soft);
}

.admin-head form {
  margin-left: auto;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 1.5rem 0;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.filters span {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.filters a {
  color: var(--ink-soft);
  text-decoration: none;
}

.filters a[aria-current="page"] {
  color: var(--ink);
  font-weight: 800;
  text-decoration: underline;
  text-decoration-color: var(--marking);
  text-decoration-thickness: 3px;
}

.entry {
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--rule);
}

.entry.status-done {
  opacity: 0.6;
}

.entry header {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.kind {
  font-weight: 800;
}

.kind-bug {
  color: var(--danger);
}

.kind-idea {
  color: var(--sign);
}

.entry.status-new .kind::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--marking);
}

.message {
  margin: 0.6rem 0;
  max-width: 44rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.shot img {
  display: block;
  max-width: min(100%, 32rem);
  max-height: 18rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.entry footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.85rem;
}

.status-form {
  display: flex;
  gap: 0.35rem;
}

.empty {
  color: var(--ink-soft);
}
