/* base.css: reset, element defaults, typography, focus, motion preferences */

/* Philosopher (display): self-hosted latin subset, SIL OFL
   (assets/fonts/OFL-Philosopher.txt). Source TTFs and the conversion
   pipeline live in ../site-tools/. */
@font-face {
  font-family: "Philosopher";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/philosopher-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Philosopher";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/philosopher-bold.woff2") format("woff2");
}
@font-face {
  font-family: "Philosopher";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/philosopher-italic.woff2") format("woff2");
}

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Sticky footer: on pages shorter than the viewport, main stretches so
     the footer band reaches the bottom edge. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

main {
  flex: 1 0 auto;
}

/* ---- Star-dust field ----
   Decorative gold motes drawn on a full-viewport canvas inserted by
   scripts/stardust.js. Progressive enhancement: no JS, no field; the page
   is complete without it (spec §4). Owner decision 2026-08-08 carves this
   single canvas effect out of the spec §5.2 exclusion, because tiled CSS
   gradients read as a regular lattice rather than organic dust.
   Random scatter with varied size/alpha; very slow drift and breath
   (spec §8.6) plus a subtle scroll parallax (owner-approved §5.2
   exception); reduced-motion users get a static render. Gold only:
   a pale moon-white field read as a generic starfield (spec §8.1). */
#stardust {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-display);
  letter-spacing: -0.01em;
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-md);
  line-height: 1.3;
}

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

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

a:hover {
  color: var(--color-text);
}

/* Focus styles must never be removed (spec §12.3) */
:focus-visible {
  outline: 2px solid var(--color-moon);
  outline-offset: 3px;
  border-radius: var(--radius);
}

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

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

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

::selection {
  background-color: var(--color-warm-dark);
  color: var(--color-text);
}

/* Shared utilities */

.wrap {
  width: min(100% - 2 * var(--gutter), var(--width-max));
  margin-inline: auto;
}

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

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--gutter);
  z-index: 10;
  padding: 0.75rem 1.25rem;
  background-color: var(--color-moon);
  color: var(--color-bg);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius);
}

.skip-link:focus {
  top: 0.75rem;
}

/* Reduced motion (spec §8.6, brand spec §16):
 * resolve every transition and the decorative motif animation immediately.
 * The !important here is the documented accessibility edge case allowed by §12.3. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
