/* =============================================================================
   base.css — reset, self-hosted fonts, fluid type baseline, links, focus,
   skip-link, the twilight gradient ground, and the global reduced-motion switch
   (UI-001 / UI-008 / KD-1 / KD-10).
   ========================================================================== */

/* @font-face declarations live in tokens.css (the single font/colour source). */

/* --- Reset --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}
input,
button,
textarea,
select {
  font: inherit;
}
ul[class],
ol[class] {
  list-style: none;
  padding: 0;
}

/* --- The page: twilight gradient ground (z-base, CSS only) ---------------- */
html {
  background-color: var(--bg-midnight);
}
body {
  min-height: 100svh;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: var(--leading-prose);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  /* Layered twilight: a warm low horizon glow over a midnight-to-forest fall. */
  background-color: var(--bg-midnight);
  background-image:
    radial-gradient(
      120% 80% at 50% 116%,
      rgb(var(--c-gold) / 0.1) 0%,
      rgb(var(--c-amber) / 0.05) 22%,
      transparent 55%
    ),
    radial-gradient(
      90% 60% at 50% -10%,
      rgb(var(--c-navy) / 0.9) 0%,
      transparent 60%
    ),
    linear-gradient(
      180deg,
      var(--bg-midnight) 0%,
      var(--bg-navy) 42%,
      var(--bg-charcoal) 72%,
      var(--bg-forest) 100%
    );
  background-attachment: fixed;
}

/* --- Headings & prose rhythm --------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: var(--leading-tight);
  letter-spacing: -0.01em;
  font-optical-sizing: auto;
}

/* --- Links --------------------------------------------------------------- */
a {
  color: var(--accent-gold);
  text-decoration-color: var(--hairline-strong);
  text-underline-offset: 0.18em;
  transition: color var(--dur-1) var(--ease),
    text-decoration-color var(--dur-1) var(--ease);
}
a:hover {
  color: var(--accent-amber);
  text-decoration-color: currentColor;
}

/* --- Focus: visible, non-color-only ring everywhere (UI-008 / KD-7) ------- */
:focus-visible {
  outline: 2px solid var(--accent-neon);
  outline-offset: 3px;
  border-radius: 3px;
}

/* --- Skip link ----------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: var(--space-2xs);
  left: var(--space-2xs);
  z-index: var(--z-skip);
  padding: var(--space-2xs) var(--space-s);
  background: var(--bg-navy);
  color: var(--text);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--radius-s);
  transform: translateY(-150%);
  transition: transform var(--dur-1) var(--ease);
}
.skip-link:focus {
  transform: translateY(0);
}

/* --- Visually-hidden (accessible name kept, nothing painted) -------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --- Selection ----------------------------------------------------------- */
::selection {
  background: rgb(var(--c-gold) / 0.28);
  color: var(--text);
}

/* --- Skip-link target: focusable container with a calm focus treatment ----
   #main carries tabindex="-1" so the skip link lands here; suppress the large
   container outline (the heading below orients the user — KD-10). */
#main:focus {
  outline: none;
}
#main:focus-visible {
  outline: none;
}

/* --- Global reduced-motion switch (KD-10) --------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
