/* =========================================================================
   Base — modern reset, typography defaults, element styling.
   ========================================================================= */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--leading-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Faint earthy vignette so the dark never reads as flat black. */
  background-image:
    radial-gradient(120% 80% at 50% -10%, rgba(169, 163, 106, 0.06), transparent 60%),
    radial-gradient(80% 60% at 100% 0%, rgba(160, 107, 72, 0.05), transparent 55%);
  background-attachment: fixed;
}

/* ---- Headings ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 460;
  line-height: var(--leading-tight);
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}

h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p { text-wrap: pretty; }

/* ---- Links ------------------------------------------------------------- */
a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color var(--dur) var(--ease);
}
a:hover { color: var(--olive); }

/* In-prose links get an underline for clarity. */
.prose a,
a.link {
  color: var(--olive);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
}
.prose a:hover,
a.link:hover {
  text-decoration-color: var(--olive);
}

/* ---- Media ------------------------------------------------------------- */
img, picture, svg, video {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---- Forms inherit type ------------------------------------------------ */
input, button, textarea, select { font: inherit; color: inherit; }

/* ---- Lists ------------------------------------------------------------- */
ul, ol { padding: 0; list-style: none; }

hr {
  border: none;
  border-top: 1px solid var(--line);
  margin: var(--space-7) 0;
}

::selection {
  background: var(--olive);
  color: var(--accent-ink);
}

/* ---- Accessibility ----------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.visually-hidden {
  position: absolute !important;
  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;
  left: var(--space-4);
  top: -100px;
  z-index: 999;
  background: var(--ink);
  color: var(--ink-on-light);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius);
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: var(--space-4); }

@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;
  }
}
