/* Site styles (ADR 0002). Values come from tokens.css. Mobile first; must work at 360px with no sideways scroll.
   Calm, data-dense race-briefing look: few colours, thin rules, tabular figures, no decoration for its own sake. */

/* Barlow and Barlow Condensed (SIL OFL 1.1), self-hosted (licences: OFL.txt in each static/vendor/fonts folder). Never a font CDN. */
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/fonts/barlow-5.3.0/barlow-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("../vendor/fonts/barlow-5.3.0/barlow-latin-400-italic.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../vendor/fonts/barlow-5.3.0/barlow-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../vendor/fonts/barlow-condensed-5.3.0/barlow-condensed-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../vendor/fonts/barlow-condensed-5.3.0/barlow-condensed-latin-700-normal.woff2") format("woff2");
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  color: var(--color-fg);
  font-family: var(--font-body);
  font-weight: var(--weight-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  overflow-wrap: break-word;
}

img, svg { max-width: 100%; height: auto; }

a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;

  &:hover { color: var(--color-accent-hover); }
}

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-brand);
  font-weight: var(--weight-heading);
  line-height: var(--leading-tight);
  margin: var(--space-6) 0 var(--space-3);
}
h1 { font-size: var(--step-4); margin-top: 0; }
h2 { font-size: var(--step-2); }
h3 { font-size: var(--step-1); }
h4 { font-size: var(--step-0); font-weight: var(--weight-bold); }

p, ul, ol, table, blockquote { margin: 0 0 var(--space-4); }

strong, b { font-weight: var(--weight-bold); }

hr {
  border: 0;
  border-top: var(--rule-width) solid var(--color-rule);
  margin: var(--space-6) 0;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Skip link: off-screen until focused (NFR-UX-03) */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100%;
  z-index: 10;
  padding: var(--space-2) var(--space-4);
  background: var(--color-fg);
  color: var(--color-bg);

  &:focus { top: var(--space-2); }
}

/* ---- Header: Dusk navy chrome in both themes (B-0116) -------------------------------------------- */
.site-header {
  background: var(--color-deep);
  color: var(--color-on-deep);   /* no bottom edge: the navy runs straight into the hero or band (B-0118 AC1) */
}

.site-header__inner,
.site-footer__inner,
.page-body {
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-on-deep);    /* the logo's lines are currentColor: light lines on navy */
  text-decoration: none;

  &:hover { color: var(--color-on-deep); }
}

.brand-logo {
  width: var(--logo-size);
  height: var(--logo-size);
  flex: none;
}

.brand__wordmark {
  font-family: var(--font-brand);
  font-size: var(--step-2);
  font-weight: var(--weight-wordmark);
  line-height: 1;
  letter-spacing: var(--tracking-wordmark);
  text-transform: uppercase;
  white-space: nowrap;
}

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

.site-nav a {
  display: inline-block;
  padding-block: var(--space-1);
  color: var(--color-on-deep);
  font-family: var(--font-brand);
  font-size: var(--step-0);
  font-weight: var(--weight-heading);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 2px solid transparent;

  &:hover { color: var(--color-on-deep); border-bottom-color: var(--color-on-deep); }

  &[aria-current="page"] { border-bottom-color: var(--color-brand); }
}

/* ---- Main ------------------------------------------------------------------------------------ */
main {
  flex: 1;

  &:focus { outline: none; }
}
.page-body { padding-block: var(--space-6) var(--space-7); }

/* The signature (B-0116): the home hero, and a thin band under the header on content pages. Full width, Dusk in
   both themes; text sits only in the dark top 60%, the violet-to-orange end carries none. */
.band {
  height: 2.75rem;
  background: var(--sig);
}

.prose {
  max-width: var(--width-prose);

  & ul, & ol { padding-left: var(--space-5); }
  & li + li { margin-top: var(--space-1); }

  & blockquote {
    margin-inline: 0;
    padding-left: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-left: var(--bar-width) solid var(--color-brand);
    border-radius: var(--radius);
    background: var(--color-surface);

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

/* Data tables: dense, ruled, tabular figures; scroll inside their own box on a phone, never the page */
table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: var(--step--1);
  font-variant-numeric: tabular-nums;
}
th, td {
  padding: var(--space-1) var(--space-3);
  border-bottom: var(--rule-width) solid var(--color-rule);
  text-align: left;
  vertical-align: top;
}
th {
  font-weight: var(--weight-bold);
  border-bottom-color: var(--color-rule);
}
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Home hero: always light on the signature, in both themes. Over it, the altitude digits (B-0118): a transparent
   SVG drawn at build time (bin/build_hero_digits.py), narrow on a phone and wide from 40em, anchored to the bottom
   and cropped by `cover`, never stretched. Decorative: a CSS background, so screen readers never meet it. */
.hero {
  display: flex;
  min-height: 28rem;   /* phone: text ends ~60% down, no half-empty hero (critic F5) */
  background: url("../img/hero-digits-narrow.svg") 50% 100% / cover no-repeat, var(--sig);
  color: var(--color-on-deep);
}
.hero__inner {
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding: 2.5rem var(--gutter) 8rem;   /* B-0119: keeps the button and its line above the ember and the skyline */
}
.hero__title {
  max-width: 13ch;
  margin: 0 0 var(--space-4);
  font-size: clamp(2.4rem, 12vw, 4.5rem);
  font-weight: var(--weight-wordmark);
  line-height: 0.96;
}
.hero__lead {
  max-width: 30rem;
  margin: 0;
  font-size: var(--step-1);
}
@media (min-width: 40em) {
  .hero { min-height: 35rem; background-image: url("../img/hero-digits-wide.svg"), var(--sig); }
  .hero__inner { padding-top: 4.5rem; }
}

/* Error pages */
.error-page {
  max-width: var(--width-prose);
  padding-block: var(--space-6);
}
.error-page__code {
  margin: 0 0 var(--space-2);
  color: var(--color-fg-muted);
  font-family: var(--font-brand);
  font-size: var(--step--1);
  font-weight: var(--weight-heading);
  letter-spacing: var(--tracking-caps);
  font-variant-numeric: tabular-nums;
}

.button {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  border: var(--rule-width) solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-fg);
  font-weight: var(--weight-bold);
  text-decoration: none;

  &:hover {
    border-color: var(--color-fg);
    color: var(--color-fg);
  }
}

/* "Register interest" (B-0119): the mockup's orange button (gradient_digits.html `.cta`), in the home hero and at
   the end of About and Approach. 48px tall: an easy thumb target. */
.register {
  margin-top: var(--space-6);
}
.cta {
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 var(--space-5);
  border-radius: var(--radius);
  background: var(--color-cta);
  color: var(--color-on-cta);
  font-family: var(--font-brand);
  font-size: var(--step-1);
  font-weight: var(--weight-wordmark);
  letter-spacing: var(--tracking-wordmark);
  text-transform: uppercase;
  text-decoration: none;

  &:hover { color: var(--color-on-cta); text-decoration: underline; }
}
.register__note {
  margin: var(--space-2) 0 0;
  color: var(--color-fg-muted);
  font-size: var(--step--1);
}
.hero .register__note { color: var(--color-on-deep); }

/* ---- Footer ---------------------------------------------------------------------------------- */
.site-footer {
  border-top: var(--rule-width) solid var(--color-rule);
  color: var(--color-fg-muted);
  font-size: var(--step--1);
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-4);

  & p { margin: 0; }
}
/* ---- Print: content only --------------------------------------------------------------------- */
@media print {
  .skip-link, .site-nav, .register { display: none; }
  body { background: #fff; color: #000; }
  .site-header, .brand, .hero { color: #000; }   /* their light-on-navy colour is invisible without backgrounds (critic F1) */
  a { color: inherit; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Draft copy marked [[placeholder]] in the Markdown: obvious on screen until the real copy lands */
mark.placeholder {
  padding: 0 var(--space-1);
  border-radius: var(--radius);
  background: var(--color-placeholder-bg);
  color: var(--color-placeholder-fg);
  font-family: var(--font-mono);
  font-size: var(--step--1);
}
