/* =====================================================================
   BASE — reset, typography, accessibility primitives
   ===================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--color-ivory);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-body);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

body.is-locked {
  overflow: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
figure,
blockquote,
ul,
ol,
dl,
dd,
fieldset {
  margin: 0;
}
ul,
ol {
  padding: 0;
  list-style: none;
}
fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}
legend {
  padding: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: var(--fw-medium);
  line-height: var(--lh-heading);
  color: inherit;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

a {
  color: inherit;
  text-decoration: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

mark {
  background: none;
  color: var(--color-green);
  font-weight: var(--fw-medium);
  box-shadow: inset 0 -0.32em 0 var(--color-gold-soft);
}

::selection {
  background: var(--color-green);
  color: var(--color-ivory);
}

/* Focus — always visible for keyboard users */
:focus {
  outline: none;
}
:focus-visible {
  outline: 2px solid var(--color-green);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
.surface-green :focus-visible,
.surface-ink :focus-visible,
.on-dark :focus-visible {
  outline-color: var(--color-gold-light);
}

main:focus {
  outline: none;
}

.skip-link {
  position: fixed;
  inset-inline-start: 16px;
  top: 12px;
  z-index: 100;
  padding: 10px 18px;
  background: var(--color-ink);
  color: var(--color-ivory);
  border-radius: var(--radius-sm);
  font-size: var(--fs-small);
  transform: translateY(-160%);
  transition: transform var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  transform: none;
}

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

/* Icons */
.i {
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* Plus / minus — gold, used by accordions */
.pm {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
  flex: none;
}
.pm span {
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  width: 100%;
  height: 1.5px;
  margin-top: -0.75px;
  background: currentColor;
  transition:
    transform var(--dur) var(--ease-out),
    opacity var(--dur-fast);
}
.pm span:last-child {
  transform: rotate(90deg);
}
[aria-expanded="true"] .pm span:last-child {
  transform: rotate(0deg);
  opacity: 0;
}

/* Typographic helpers */
.display {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  font-weight: var(--fw-medium);
}
.display .accent,
.accent {
  color: var(--color-green);
}
.h2 {
  font-size: var(--fs-h2);
  line-height: 1.32;
  font-weight: var(--fw-medium);
}
.lead {
  font-size: var(--fs-lead);
  line-height: 1.8;
}

/* Latin numerals in a tabular rhythm */
.num,
[class*="__num"],
[class*="__code"] {
  font-feature-settings:
    "tnum" 1,
    "lnum" 1;
}

/* Reduced motion — kill non-essential animation */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
