/*
  Approved visual design — see docs/workflow.md "Design Direction."
  Survey-sheet aesthetic: six-color palette, three-typeface system,
  hairline neatline frame, marginalia section labels. No gradients,
  no shadows, no rounded corners, no icon set.
*/

:root {
  --paper: #F2F3EF;
  --ink: #1B1F1D;
  --slate: #48545C;
  --survey: #2C4B63;
  --neatline: #C7CCC3;
  --paper-deep: #E7E9E2;

  --font-serif: "Source Serif 4", Georgia, serif;
  --font-condensed: "IBM Plex Sans Condensed", "Arial Narrow", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;

  --rail-width: 9rem;
  --rail-gap: 2.5rem;
  --text-measure: 68ch;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: clamp(0.75rem, 3.5vw, 2.5rem);
  border: 1px solid var(--neatline);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.65;
}

h1, h2 {
  font-family: var(--font-condensed);
  font-weight: 600;
  color: var(--ink);
}

h1 {
  font-size: clamp(1.5rem, 4.5vw, 2rem);
  line-height: 1.3;
  letter-spacing: 0.01em;
  margin: 0 0 1.5rem;
}

h1::before {
  content: "";
  display: inline-block;
  width: 0.42em;
  height: 0.42em;
  margin-right: 0.4em;
  background: var(--survey);
  vertical-align: 0.08em;
}

h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--slate);
  margin: 0 0 0.75rem;
}

h2::before {
  content: "";
  display: inline-block;
  width: 0.9em;
  height: 2px;
  margin-right: 0.4em;
  background: var(--survey);
  vertical-align: middle;
}

p {
  margin: 0 0 1.25rem;
}

a {
  color: var(--survey);
  text-decoration-color: var(--neatline);
  text-underline-offset: 0.15em;
}

a:hover {
  text-decoration-color: var(--survey);
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--survey);
  outline-offset: 3px;
}

/* ---------- Header / nav ---------- */

header {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 2px solid var(--survey);
}

.site-name {
  font-family: var(--font-condensed);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: clamp(0.95rem, 3.5vw, 1.1rem);
  color: var(--ink);
  text-decoration: none;
}

.site-name::before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  margin-right: 0.55em;
  background: var(--survey);
  vertical-align: 0.02em;
}

nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.35rem;
}

nav a {
  font-family: var(--font-condensed);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: clamp(0.7rem, 2.4vw, 0.78rem);
  color: var(--slate);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

nav a:hover {
  color: var(--ink);
}

nav a[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--survey);
}

@media (min-width: 600px) {
  header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.75rem;
  }
}

/* ---------- Main content ---------- */

main {
  max-width: var(--text-measure);
  margin-inline: auto;
  padding: 2.5rem 1.25rem 3.5rem;
}

section {
  margin: 2.75rem 0;
}

section:first-of-type {
  margin-top: 2.75rem;
}

/* ---------- Footer ---------- */

footer {
  border-top: 1px solid var(--survey);
  padding: 1.5rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--slate);
}

footer p {
  margin: 0 0 0.35rem;
}

footer p:last-child {
  margin-bottom: 0;
}

/* ---------- Marginalia layout (desktop) ---------- */

@media (min-width: 800px) {
  main {
    max-width: calc(var(--rail-width) + var(--rail-gap) + var(--text-measure));
    padding: 3.5rem 2rem 4.5rem;
    display: grid;
    grid-template-columns: var(--rail-width) minmax(0, var(--text-measure));
    column-gap: var(--rail-gap);
  }

  main > * {
    grid-column: 2;
  }

  main > section {
    display: contents;
  }

  main > section > h2 {
    grid-column: 1;
    margin: 0;
    padding-top: 0.2rem;
  }

  main > section > *:not(h2) {
    grid-column: 2;
  }

  header {
    padding: 1.5rem 2rem;
  }

  footer {
    padding: 1.75rem 2rem;
  }
}

/* ---------- Phase I ESA scope-of-work labels ---------- */

main section p em {
  display: block;
  font-family: var(--font-condensed);
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.8rem;
  color: var(--survey);
  margin-bottom: 0.3rem;
}

.figure {
  font-family: var(--font-mono);
  font-size: 0.92em;
  letter-spacing: 0.01em;
}

/* ---------- Search-radius diagram ---------- */

.radius-diagram {
  margin: 2.5rem 0 3rem;
  padding: 2rem 1.5rem 1.75rem;
  background: var(--paper-deep);
  border: 1px solid var(--neatline);
}

.radius-svg {
  display: block;
  width: 100%;
  max-width: 22rem;
  margin: 0 auto;
}

.radius-svg .ring {
  fill: none;
  stroke: var(--survey);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
}

.radius-svg .property {
  fill: var(--survey);
}

.radius-svg .ring-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.03em;
  fill: var(--slate);
}

.radius-diagram figcaption ul {
  list-style: none;
  margin: 1.5rem auto 0;
  padding: 0;
  max-width: 22rem;
  display: grid;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--slate);
}

.radius-diagram figcaption strong {
  color: var(--ink);
  font-weight: 500;
}

@media (prefers-reduced-motion: no-preference) {
  .radius-svg .ring {
    opacity: 0;
    transform: scale(0.001);
    transition: transform 0.9s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
  }

  .radius-svg .ring:nth-of-type(2) {
    transition-delay: 0.18s;
  }

  .radius-diagram.draw-in .radius-svg .ring {
    opacity: 1;
    transform: scale(1);
  }
}
