/* The site's shared stylesheet: the colours, type, top bar, buttons and footer that the download page
   and the pages beside it (Getting Started, Privacy, Beta Terms) all use, so they read as one site.
   A page's own <style> holds only what that page alone has. The bar and the footer are written once,
   in shell/, and the build puts them in every page.

   Colours come from the design language (docs/DESIGN.md, design/system/glossium.css), light and dark,
   each written once. Every colour here is a token: a page uses these, not colours of its own. */

:root {
  color-scheme: light dark;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro", "Helvetica Neue", sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --page: #ffffff;
  --page-2: #f5f5f7;
  --label: rgb(0 0 0 / 0.85);
  --label-2: rgb(0 0 0 / 0.62);
  --separator: rgb(0 0 0 / 0.12);
  --accent: #0a5fc4;
  --error: #b3261e;
  --focus: #0a74e8;
  --key-face: #ffffff;
  --key-line: rgb(0 0 0 / 0.2);
  --code-bg: rgb(0 0 0 / 0.06);

  /* The primary button. Its lightest and darkest colours are each at least 3:1 against the page
     (WCAG 1.4.11) and 4.5:1 under white text: scripts/tests/site_build.test.mjs checks both. */
  --button-top: #1272e0;
  --button-bottom: #0a5fc4;
  --button-rim: rgb(255 255 255 / 0.45);
  --button-line: rgb(0 0 0 / 0.22);
  --button-glow: rgb(10 95 196 / 0.3);

  /* Glass, for the bar that floats over the page. */
  --glass: rgb(255 255 255 / 0.55);
  --glass-line: rgb(0 0 0 / 0.1);
  --rim-1: rgb(255 255 255 / 0.95);
  --rim-2: rgb(255 255 255 / 0.2);
  --rim-3: rgb(255 255 255 / 0.55);
  --shadow: 0 2px 6px rgb(0 0 0 / 0.08), 0 16px 40px rgb(0 0 0 / 0.14);

  /* Boxes that tell the reader something: information, and a warning or a draft. */
  --info-bg: #eaf2fc;
  --note-bg: #fff6df;
  --note-line: #e8cf86;
  --draft: #ffe08a;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #1c1c1e;
    --page-2: #232326;
    --label: rgb(255 255 255 / 0.88);
    --label-2: rgb(255 255 255 / 0.62);
    --separator: rgb(255 255 255 / 0.14);
    --accent: #6cb0ff;
    --error: #ff9a90;
    --focus: #6cb0ff;
    --key-face: #3a3a3c;
    --key-line: rgb(255 255 255 / 0.22);
    --code-bg: rgb(255 255 255 / 0.1);
    --button-top: #1572e6;
    --button-bottom: #0f6be0;
    --button-rim: rgb(255 255 255 / 0.3);
    --button-line: rgb(255 255 255 / 0.35);
    --button-glow: rgb(10 95 196 / 0.5);
    --glass: rgb(36 36 40 / 0.55);
    --glass-line: rgb(255 255 255 / 0.1);
    --rim-1: rgb(255 255 255 / 0.4);
    --rim-2: rgb(255 255 255 / 0.06);
    --rim-3: rgb(255 255 255 / 0.16);
    --shadow: 0 2px 6px rgb(0 0 0 / 0.35), 0 16px 40px rgb(0 0 0 / 0.5);
    --info-bg: #1d2a3a;
    --note-bg: #2b2716;
    --note-line: #6e5f22;
    --draft: #6b5500;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--page);
  color: var(--label);
  font: 17px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
/* A focus ring follows the element's own corners: a capsule gets a capsule ring, a text link a 6 px one. */
a { color: var(--accent); text-underline-offset: 0.15em; border-radius: 6px; }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
main:focus { outline: none; }
p { margin: 0 0 12px; }
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; }
kbd {
  display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 6px; text-align: center;
  font: 500 0.85em/1.5 var(--font); white-space: nowrap;
  background: var(--key-face); box-shadow: 0 0 0 1px var(--key-line), 0 1px 0 var(--key-line);
}
code { font: 0.92em var(--font-mono); overflow-wrap: anywhere; }

.wrap { width: 100%; max-width: 62rem; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: 16px; top: -64px; z-index: 20; padding: 10px 16px; border-radius: 999px; background: var(--page); color: var(--label); box-shadow: var(--shadow); }
.skip:focus { top: 12px; }

/* The bar floats over the page: regular glass, with a rim of light along its border. A page whose top
   is a picture draws it over that picture, with a negative bottom margin; otherwise it sits in the flow. */
.bar {
  position: sticky; top: 12px; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  margin: 12px auto 28px; padding: 8px 8px 8px 20px;
  width: calc(100% - 32px); max-width: calc(62rem - 32px);
  border-radius: 18px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(22px) saturate(1.9); backdrop-filter: blur(22px) saturate(1.9);
  box-shadow: 0 0 0 0.5px var(--glass-line), var(--shadow);
}
.bar::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(172deg, var(--rim-1) 0%, var(--rim-2) 22%, transparent 50%, var(--rim-2) 80%, var(--rim-3) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .bar { background: var(--page); } }
@media (prefers-reduced-transparency: reduce) { .bar { background: var(--page); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--label); text-decoration: none; font: 600 17px/1 var(--font-display); letter-spacing: -0.01em; }
.brand img { width: 28px; height: 28px; border-radius: 7px; box-shadow: 0 1px 2px rgb(0 0 0 / 0.18); }
.bar nav { flex: 1; }
.bar nav ul { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
.bar nav a { display: block; padding: 6px 12px; border-radius: 999px; color: var(--label-2); font-size: 15px; text-decoration: none; }
.bar nav a:hover { color: var(--label); background: var(--separator); }
.bar nav a[aria-current="page"] { color: var(--label); background: var(--separator); }
.bar .button { margin-left: auto; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 28px; border-radius: 999px;
  font: 600 17px/1 var(--font); text-decoration: none; color: #fff;
  background: linear-gradient(180deg, var(--button-top), var(--button-bottom));
  box-shadow: inset 0 1px 0 var(--button-rim), 0 0 0 0.5px var(--button-line), 0 1px 2px rgb(0 0 0 / 0.2), 0 6px 16px var(--button-glow);
}
a.button { color: #fff; }
.button:active { transform: translateY(1px); box-shadow: inset 0 1px 3px rgb(0 0 0 / 0.3), 0 0 0 0.5px var(--button-line); }
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button.small { min-height: 36px; padding: 0 18px; font-size: 15px; }
@media (prefers-reduced-motion: no-preference) { .button { transition: transform 0.12s ease-out, box-shadow 0.12s ease-out; } }

/* The pages that are mostly words: Getting Started, Privacy and Beta Terms. */
.doc { width: 100%; max-width: 44rem; margin: 0 auto; padding: 24px 16px 0; line-height: 1.55; }
.doc h1 { margin: 0 0 8px; font-size: clamp(2rem, 1.3rem + 2.6vw, 2.75rem); font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; }
.doc h2 { font-size: 1.5rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; }
.doc h3 { font-size: 1.1875rem; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.doc .lede { margin: 0 0 12px; font-size: 1.1875rem; line-height: 1.45; color: var(--label-2); }
.doc code { padding: 0.1em 0.35em; border-radius: 5px; background: var(--code-bg); }
.doc [id] { scroll-margin-top: 88px; }
/* The long, careful pages: Privacy and Beta Terms. */
.legal h2 { margin: 2.2em 0 0.5em; }
.legal h3 { margin: 1.8em 0 0.4em; }
.legal p, .legal ul { margin: 0.8em 0; }
.legal ul { padding-left: 1.3em; }
.legal li { margin: 0.4em 0; }
/* A box that tells the reader something: a note, or text that still waits for the owner. */
.draft { margin: 20px 0; padding: 12px 16px; border-radius: 12px; background: var(--note-bg); box-shadow: 0 0 0 1px var(--note-line); font-size: 0.95rem; line-height: 1.5; }
.draft p { margin: 0.4em 0; }
.todo { padding: 0 0.25em; border-radius: 4px; background: var(--draft); }

footer { margin-top: 72px; padding: 24px 0 56px; border-top: 1px solid var(--separator); color: var(--label-2); font-size: 15px; }
footer .wrap { display: grid; gap: 28px; }
footer p { margin: 0; max-width: 40rem; }
footer nav a { text-decoration: none; }
footer nav a:hover { text-decoration: underline; }
/* The beta terms and the privacy notice: fine print, at the very bottom. */
footer .fineprint { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; padding-top: 16px; border-top: 1px solid var(--separator); font-size: 13px; line-height: 1.45; }
footer .fineprint ul { gap: 4px 16px; }
footer ul { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; list-style: none; }
footer a { color: var(--label-2); }
footer a:hover { color: var(--label); }
footer a[aria-current="page"] { color: var(--label); }

@media (prefers-contrast: more) {
  :root { --label-2: var(--label); --separator: rgb(128 128 128 / 0.7); --glass-line: rgb(128 128 128 / 0.8); }
}
/* Forced colours drop shadows and gradients, so give each raised thing an outline. */
@media (forced-colors: active) {
  .button, .bar, .draft { border: 1px solid CanvasText; }
}

@media (max-width: 640px) {
  .bar nav { display: none; }
  .bar { gap: 12px; }
}
@media (max-width: 480px) { body { font-size: 16px; } }
