/* SwiftStats marketing site — tokens and the shell.
   ==========================================================================
   Two halves, and the split is the convention every later phase follows:

     1. TOKENS AND RESET. The helmet <style> of
        `design/design_handoff_site/SwiftStats Site.dc.html`, ported as-is:
        light on bare `:root`, dark via `prefers-color-scheme` for readers who
        have made no choice, and dark again under `[data-theme="dark"]` so an
        explicit choice wins in either direction.
     2. THE SHELL. The accent rule, the header, the nav, the theme button, the
        CTA, the footer — plus the handful of page-level primitives (`.page`,
        `.page-title`, `.page-lede`) the stub pages use and the real pages will
        keep.

   A rule used by ONE page does not belong here. It belongs in
   `public/views/<page>.css`, named by that page through `<Layout styles={…}>`.

   There is no inline <style> and no `style=` attribute anywhere on this site:
   `style-src 'self'` forbids both, and the design file — which is built almost
   entirely from style attributes — has to be translated here to render at all.
   ========================================================================== */

/* ── 1. Tokens ──────────────────────────────────────────────────────────── */

:root {
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f2f4f3;
  --surface: #ffffff;
  --surface2: #eef1ef;
  --surface3: #e8ecea;
  --border: #dfe5e3;
  --hairline: #e9edeb;
  --text: #16302a;
  --text2: #46534e;
  --text3: #616c68;
  --accent: #0d6f76;
  --accent-h: #0a5c62;
  --accent-quiet: #e6f2f3;
  --accent-quiet-b: #c8e2e4;
  --on-accent: #ffffff;
  --chart1: #0d6f76;
  --chart2: #b06a12;
  --warn-bg: #faf6ec;
  --warn-b: #e7dcc2;
  --warn-fg: #4a3810;
  --shadow: 0 1px 2px rgba(16, 22, 25, 0.05);

  /* Layout constants the design repeats verbatim in every section. */
  --page-max: 1120px;
  --page-gutter: 40px;
}

/* A reader who has expressed no preference follows the OS. The `:not()` is what
   makes an explicit LIGHT choice win here: /theme.js writes
   `data-theme="light"`, and this block then does not apply. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1114;
    --surface: #141a1e;
    --surface2: #10161a;
    --surface3: #1b2328;
    --border: #262f35;
    --hairline: #1e262b;
    --text: #e8edf0;
    --text2: #9aa5ac;
    --text3: #8b959c;
    --accent: #4fd0d6;
    --accent-h: #8ae3e7;
    --accent-quiet: #10333a;
    --accent-quiet-b: #1c4a52;
    --on-accent: #06222a;
    --chart1: #4fd0d6;
    --chart2: #e0a44a;
    --warn-bg: #1d1a12;
    --warn-b: #3b3218;
    --warn-fg: #e8dcc0;
    --shadow: none;
  }
}

/* An explicit DARK choice, which must win on a light OS too — hence the second
   copy rather than a second selector on the media query above. */
:root[data-theme="dark"] {
  --bg: #0d1114;
  --surface: #141a1e;
  --surface2: #10161a;
  --surface3: #1b2328;
  --border: #262f35;
  --hairline: #1e262b;
  --text: #e8edf0;
  --text2: #9aa5ac;
  --text3: #8b959c;
  --accent: #4fd0d6;
  --accent-h: #8ae3e7;
  --accent-quiet: #10333a;
  --accent-quiet-b: #1c4a52;
  --on-accent: #06222a;
  --chart1: #4fd0d6;
  --chart2: #e0a44a;
  --warn-bg: #1d1a12;
  --warn-b: #3b3218;
  --warn-fg: #e8dcc0;
  --shadow: none;
}

/* `color-scheme` is what themes the form controls, the scrollbars and the
   canvas the browser paints before our CSS lands. The three states have to be
   spelled out separately or a reader who chose LIGHT on a dark OS gets dark
   scrollbars against a light page. */
html { color-scheme: light dark; }
html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* ── 2. Reset ───────────────────────────────────────────────────────────── */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  /* The footer sits at the bottom of a short page rather than halfway up it.
     The design achieved this with a flex wrapper div; the wrapper existed only
     to hold a style attribute, so the body does the job instead. */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-h); text-decoration: underline; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ── 3. The shell ───────────────────────────────────────────────────────── */

/* The skip link: off-screen until focused, then pinned over the accent rule.
   `left` rather than `display:none` or `visibility:hidden`, because both of
   those take it out of the focus order entirely — which is the one thing it
   exists to be in. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 0 0 6px 0;
  background: var(--surface);
  color: var(--text);
  font: 500 14px/1 var(--sans);
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

/* <main> is only focusable because of `tabindex="-1"`, which the skip link
   needs; the ring it would draw on a mouse click is noise. Focus arriving from
   the keyboard still shows on the link itself. */
.site-main:focus {
  outline: none;
}

.accent-rule {
  height: 3px;
  background: var(--accent);
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 14px var(--page-gutter);
  display: flex;
  align-items: center;
  gap: 28px;
}

/* The mark. `stroke` is on the SVG element in CSS rather than as an attribute
   so it re-colours with the theme from one place. */
.mark { stroke: var(--accent); }
.mark-companion { stroke: var(--text3); }

.lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
}
.lockup:hover { color: var(--text); text-decoration: none; }

.wordmark {
  font: 600 15px/1 var(--sans);
  letter-spacing: -0.2px;
}

.site-nav {
  display: flex;
  gap: 20px;
  font: 400 14px/1 var(--sans);
  margin-right: auto;
  flex-wrap: wrap;
}

.nav-link { color: var(--text2); }
.nav-link:hover { color: var(--accent); text-decoration: none; }
/* The current section, which the design does not draw — it had no real routes
   to be current in. Weight rather than colour, so it does not read as a link
   state. */
.nav-link.on { color: var(--text); font-weight: 500; }

.theme-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  min-width: 58px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text2);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.4px;
  cursor: pointer;
}
.theme-button:hover { border-color: var(--accent); color: var(--accent); }

.cta {
  font: 500 14px/1 var(--sans);
  padding: 9px 16px;
  border-radius: 6px;
  background: var(--accent);
  color: var(--on-accent);
  white-space: nowrap;
}
.cta:hover { background: var(--accent-h); color: var(--on-accent); text-decoration: none; }

.site-main { flex: 1; }

/* ── 4. Page primitives ─────────────────────────────────────────────────── */

/* The default content column. A page with its own layout (the home hero, the
   docs sidebar) brings its own section styles in its own file and does not use
   this. */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 64px var(--page-gutter) 72px;
}

.page-title {
  font: 600 36px/1.12 var(--sans);
  letter-spacing: -1.2px;
  margin: 0 0 12px;
  max-width: 20ch;
  text-wrap: balance;
}

.page-lede {
  font: 400 17px/1.6 var(--sans);
  color: var(--text2);
  margin: 0;
  max-width: 60ch;
  text-wrap: pretty;
}

/* ── 5. Footer ──────────────────────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

.footer-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 36px var(--page-gutter);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr));
  gap: 32px;
}

.footer-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.footer-wordmark {
  font: 600 14px/1 var(--sans);
  letter-spacing: -0.2px;
}

.footer-blurb {
  font: 400 13px/1.6 var(--sans);
  color: var(--text3);
  margin: 0 0 10px;
  max-width: 34ch;
}

.footer-copyright {
  font: 400 12.5px/1.6 var(--sans);
  color: var(--text3);
}

.footer-column {
  display: grid;
  gap: 8px;
  align-content: start;
}

.footer-heading {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--text3);
}

.footer-link {
  font: 400 13.5px/1.5 var(--sans);
  color: var(--text2);
}
.footer-link:hover { color: var(--accent); }

/* ── 6. Narrow layouts ──────────────────────────────────────────────────── */

/* The design is desktop-only — it draws one 1120px column and never a phone.
   These two breakpoints are the minimum that keeps the shell usable on one,
   and they belong here rather than in a page file because they are the shell. */
@media (max-width: 900px) {
  :root { --page-gutter: 24px; }

  .header-inner {
    flex-wrap: wrap;
    gap: 16px;
  }
  .site-nav {
    order: 3;
    width: 100%;
    margin-right: 0;
    gap: 16px;
  }
  .footer-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding: 44px var(--page-gutter) 56px; }
  .page-title { font-size: 30px; letter-spacing: -0.9px; }
}

@media (max-width: 560px) {
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
}
