/*
 * Source Mode — site theme.
 * Developer-doc aesthetic built around the <html> wordmark's red (#cc3333).
 * Colour, type and spacing are defined once as custom properties; dark mode
 * redefines only the colour tokens, so there is a single home for each value.
 */

:root {
  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Scale */
  --measure: 60rem;
  --radius: 8px;
  --gap: 1rem;

  /* Colour — light (default) */
  --bg: #ffffff;
  --surface: #f6f7f9;
  --text: #1a1d21;
  --muted: #5b636d;
  --border: #e2e5e9;
  --accent: #cc3333;
  --accent-ink: #ffffff;
  --code-bg: #f3f4f6;
  --code-text: #b02a2a;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16181c;
    --surface: #1e2127;
    --text: #e6e8eb;
    --muted: #9aa3ad;
    --border: #2b2f36;
    --accent: #e06666;
    --accent-ink: #16181c;
    --code-bg: #22262e;
    --code-text: #f0a0a0;
  }
}

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

html {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
  color: var(--text);
  background: var(--bg);
}

/* Links */
a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;

  &:hover {
    text-decoration-color: color-mix(in oklab, var(--accent), transparent 50%);
  }
}

/* Headings */
h1, h2, h3 {
  line-height: 1.25;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2rem;
  margin-block: 0.2em 0.6em;
}

/* Skip link — visible only on focus */
.skip {
  position: absolute;
  left: -999px;

  &:focus {
    position: static;
    display: inline-block;
    margin: 0.5rem 0;
  }
}

/* Header / brand */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding-block: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
}

.brand__mark {
  display: block;
  width: 28px;
  height: 28px;
}

.site-nav {
  display: flex;
  gap: 1.25rem;

  a {
    color: var(--muted);
    text-decoration: none;

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

/* Main content */
main {
  flex: 1;
  padding-block: 2rem;
}

main :where(p, ul, ol) {
  max-width: 44rem;
}

/* Status / callout blockquote (home page #rel-status lives here) */
blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);

  & ul {
    margin: 0;
    padding-left: 1.2rem;
  }

  & :first-child { margin-top: 0; }
  & :last-child { margin-bottom: 0; }
}

/* Code and keyboard shortcuts */
code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 4px;
}

kbd {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.15em 0.45em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
}

/* Buttons — for a future download CTA */
.button {
  display: inline-block;
  padding: 0.6rem 1.1rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: var(--radius);
  text-decoration: none;

  &:hover {
    background: color-mix(in oklab, var(--accent), black 12%);
  }
}

/* Footer */
.site-footer {
  margin-top: 2rem;
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;

  & p { margin: 0.25rem 0; }

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

/* Honour reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
