/* base.css — tokens, reset, typography, layout primitives */

/* ---------------------------------------------------------------- tokens */

:root {
  color-scheme: light dark;

  /* Surfaces. Cool grey-blue, the colour of galvanised sheet in shade —
     deliberately not cream. */
  --ground: #edf1f3;
  --surface: #ffffff;
  --rule: #c9d6dc;
  --rule-strong: #9aaeb7;

  /* Text */
  --ink: #16262e;
  --ink-soft: #4c616c;
  /* Measured, not eyeballed: this clears 4.5:1 against --ground (4.65) as well
     as against --surface (5.28), so small print passes AA on both. */
  --ink-faint: #5a6f77;

  /* Semantic temperature colours. These carry meaning and are never
     decoration: warm = outdoor air coming in, cool = conditioned air
     going out. Nothing else may use them. */
  --warm: #8c5e10;
  --warm-bright: #c9902a;
  --warm-wash: #f6ebd6;
  --cool: #06697f;
  --cool-bright: #10a0c0;
  --cool-wash: #ddeef3;

  /* Verdict states. --ok deliberately aliases --cool: a working cooler
     is one that is delivering cold air. */
  --ok: var(--cool);
  --warn: #b4551c;
  --bad: #a32e27;
  --info: #3c5a6b;

  /* Type. Bahnschrift ships on Windows 10+, DIN Alternate on macOS/iOS —
     both are engineering faces, and neither costs a network request. */
  --face-data: Bahnschrift, "DIN Alternate", "DIN Condensed", "Roboto Condensed",
               "Helvetica Neue Condensed", "Arial Narrow", system-ui, sans-serif;
  --face-body: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto,
               "Helvetica Neue", Arial, sans-serif;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.125rem;
  --step-2: 1.375rem;
  --step-3: 1.75rem;
  --step-4: 2.25rem;
  --step-5: clamp(2.5rem, 1.6rem + 4vw, 3.5rem);

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;

  --measure: 68ch;
  --shell: 72rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101d24;
    --surface: #17272f;
    --rule: #2e434d;
    --rule-strong: #46606c;

    --ink: #e3ecef;
    --ink-soft: #a8bcc4;
    --ink-faint: #8aa0a9;

    --warm: #e0ab4e;
    --warm-bright: #e0ab4e;
    --warm-wash: #33280f;
    --cool: #4fc3e0;
    --cool-bright: #4fc3e0;
    --cool-wash: #10333c;

    --warn: #e0975c;
    --bad: #e8837a;
    --info: #9bb6c4;
  }
}

/* ----------------------------------------------------------------- reset */

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

body,
h1, h2, h3, h4,
p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

ul[class],
ol[class] {
  padding: 0;
  list-style: none;
}

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

/* The hidden attribute has to beat the display rules further down, or
   toggling it from script silently does nothing. */
[hidden] {
  display: none !important;
}

input,
button,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* ------------------------------------------------------------ typography */

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

body {
  background: var(--ground);
  color: var(--ink);
  font-family: var(--face-body);
  font-size: var(--step-0);
  line-height: 1.6;
  /* Every numeral on this site is a measurement; none of them may shift
     width between readings. */
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, h4,
.data {
  font-family: var(--face-data);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.005em;
}

h1 {
  font-size: var(--step-5);
  letter-spacing: -0.015em;
}

h2 {
  font-size: var(--step-3);
}

h3 {
  font-size: var(--step-2);
}

h4 {
  font-size: var(--step-1);
}

p,
li {
  max-width: var(--measure);
}

a {
  color: var(--cool);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

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

strong {
  font-weight: 650;
}

code,
.mono {
  font-family: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* Equipment-label small caps, used for field names and units. */
.label {
  font-family: var(--face-data);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.lede {
  font-size: var(--step-1);
  color: var(--ink-soft);
  max-width: 60ch;
}

/* ---------------------------------------------------------------- layout */

.shell {
  width: 100%;
  max-width: var(--shell);
  margin-inline: auto;
  padding-inline: var(--space-4);
}

@media (min-width: 40rem) {
  .shell {
    padding-inline: var(--space-6);
  }
}

.prose > * + * {
  margin-top: var(--space-4);
}

.prose > h2 {
  margin-top: var(--space-7);
}

.prose > h3 {
  margin-top: var(--space-6);
}

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: var(--space-2);
}

.stack > * + * {
  margin-top: var(--space-4);
}

section + section {
  margin-top: var(--space-8);
}

/* --------------------------------------------------------- skip + focus */

:focus-visible {
  outline: 3px solid var(--cool-bright);
  outline-offset: 2px;
  border-radius: 1px;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ------------------------------------------------------- site furniture */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}

.masthead__inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  align-items: baseline;
  justify-content: space-between;
  padding-block: var(--space-4);
}

.wordmark {
  font-family: var(--face-data);
  font-size: var(--step-1);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.wordmark:hover {
  color: var(--cool);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav a {
  font-family: var(--face-data);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-decoration: none;
}

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

.nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.4em;
  text-decoration-thickness: 2px;
}

main {
  padding-block: var(--space-7) var(--space-8);
}

.colophon {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  padding-block: var(--space-6);
  color: var(--ink-soft);
  font-size: var(--step--1);
}

.colophon p {
  max-width: var(--measure);
}

.colophon p + p {
  margin-top: var(--space-3);
}

/* ------------------------------------------------------------- utilities */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
