/* Reg from Planning: one stylesheet for the whole site.
   House colours from docs/kanal.md: blueprint blue, red pencil, paper white.
   No web fonts: Bahnschrift is referenced only if the visitor already has it (Windows).
   Red is decoration only. It is too light for text on paper (2.8:1). */

:root {
  --blue: #16427E;
  --blue-deep: #0E2D5A;
  --paper: #F4F0E6;
  --red: #FF5340;

  --bg: var(--paper);
  --surface: #FBF9F3;
  --text: #14233B;
  --muted: #45536A;
  --heading: var(--blue);
  --link: var(--blue);
  --rule: rgba(22, 66, 126, 0.22);

  --font-display: Bahnschrift, "DIN Alternate", "DIN Condensed", "Roboto Condensed", "Arial Narrow", sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B2147;
    --surface: #10295A;
    --text: #F4F0E6;
    --muted: #C9CFDB;
    --heading: #F4F0E6;
    --link: #F4F0E6;
    --rule: rgba(244, 240, 230, 0.22);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

a { color: var(--link); text-decoration-thickness: 0.08em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.16em; }
a:focus-visible, .button:focus-visible { outline: 3px solid currentColor; outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; left: 16px; top: -100px;
  background: var(--paper); color: var(--blue);
  padding: 8px 12px; font-weight: 600; z-index: 10;
}
.skip:focus { top: 12px; }

.wrap { max-width: 46rem; margin: 0 auto; padding: 0 16px; }

/* Masthead: blueprint sheet with a drawing grid. */
.masthead {
  background-color: var(--blue);
  background-image:
    linear-gradient(rgba(244, 240, 230, 0.10) 2px, transparent 2px),
    linear-gradient(90deg, rgba(244, 240, 230, 0.10) 2px, transparent 2px),
    linear-gradient(rgba(244, 240, 230, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 240, 230, 0.05) 1px, transparent 1px),
    radial-gradient(ellipse at 50% 40%, #1A4A8A 0%, #16427E 55%, #0E2D5A 100%);
  background-size: 100px 100px, 100px 100px, 20px 20px, 20px 20px, 100% 100%;
  color: var(--paper);
}
.masthead a { color: var(--paper); }

.topbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px 24px; padding-top: 16px; padding-bottom: 16px;
}
.wordmark {
  font-family: var(--font-display); font-stretch: condensed; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none; font-size: 1.05rem;
}
.topbar nav ul { display: flex; gap: 20px; margin: 0; padding: 0; list-style: none; }
.topbar nav a { text-decoration: none; font-weight: 600; }
.topbar nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 3px; text-underline-offset: 6px; }

.hero { padding-top: 40px; padding-bottom: 56px; }
.hero h1 {
  margin: 0;
  font-family: var(--font-display); font-stretch: condensed; font-weight: 700;
  text-transform: uppercase; line-height: 0.92; letter-spacing: 0.01em;
  font-size: clamp(3rem, 14vw, 6.25rem);
}
.hero .motto {
  margin: 18px 0 0;
  font-family: var(--font-display); font-stretch: condensed;
  font-size: clamp(1.25rem, 4.6vw, 1.75rem);
}
.pencil {
  text-decoration: underline; text-decoration-color: var(--red);
  text-decoration-thickness: 0.14em; text-underline-offset: 0.2em; text-decoration-skip-ink: none;
}
.hero .lede { max-width: 34rem; margin: 18px 0 0; font-size: 1.125rem; }
.hero.small { padding-top: 28px; padding-bottom: 40px; }
.hero.small h1 { font-size: clamp(2.5rem, 11vw, 4.5rem); }
.hero.small p { margin: 14px 0 0; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  display: inline-block; padding: 12px 20px; border-radius: 4px;
  font-weight: 700; text-decoration: none; border: 2px solid var(--paper);
}
.masthead .button.primary { background: var(--paper); color: var(--blue); }
.masthead .button.secondary { background: transparent; color: var(--paper); }

/* Content */
main { padding: 20px 0 48px; }
main h2 {
  font-family: var(--font-display); font-stretch: condensed; font-weight: 700;
  color: var(--heading); font-size: 1.75rem; line-height: 1.15;
  margin: 44px 0 12px;
}
main h2::before {
  content: ""; display: block; width: 44px; height: 5px; margin-bottom: 12px;
  background: var(--red); border-radius: 3px; transform: rotate(-2deg);
}
main h3 { color: var(--heading); font-size: 1.15rem; margin: 28px 0 8px; }
main p, main ul, main ol { margin: 0 0 14px; overflow-wrap: break-word; }
main li + li { margin-top: 6px; }
code { font-family: var(--font-mono); font-size: 0.9em; overflow-wrap: break-word; }
td code { white-space: nowrap; }

.box {
  background: var(--surface); border: 1px solid var(--rule); border-left: 5px solid var(--red);
  border-radius: 4px; padding: 16px 20px; margin: 28px 0 0;
}
.box h2 { margin-top: 0; font-size: 1.35rem; }
.box h2::before { display: none; }
.box ul { margin-bottom: 0; }

.updated { color: var(--muted); font-size: 0.95rem; }

/* Tables turn into stacked cards on narrow screens. */
table { width: 100%; border-collapse: collapse; margin: 8px 0 18px; font-size: 0.97rem; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--rule); }
th { color: var(--heading); font-weight: 700; }
thead th { border-bottom: 2px solid var(--heading); }
@media (max-width: 640px) {
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  tr { border: 1px solid var(--rule); border-radius: 4px; padding: 6px 12px; margin-bottom: 12px; background: var(--surface); }
  td { border: 0; padding: 6px 0; }
  td::before { content: attr(data-label); display: block; font-weight: 700; color: var(--heading); font-size: 0.9rem; }
}

/* Footer */
.footer { border-top: 1px solid var(--rule); padding: 24px 0 40px; color: var(--muted); font-size: 0.95rem; }
.footer a { color: var(--link); }
.footer ul { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 0 0 12px; padding: 0; list-style: none; }
.footer p { margin: 0 0 8px; }

@media (prefers-reduced-motion: no-preference) {
  .button { transition: transform 120ms ease; }
  .button:hover { transform: translateY(-1px); }
}

@media print {
  .masthead { background: none; color: #000; }
  .masthead a, a { color: #000; }
  .skip, .actions { display: none; }
}
