/* ==========================================================================
   Reset, typography defaults and accessibility primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
h5 {
  margin: 0 0 var(--sp-4);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: var(--ink-800);
  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 {
  margin: 0 0 var(--sp-4);
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--cyan-600);
}

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

ul,
ol {
  margin: 0 0 var(--sp-4);
  padding-left: 1.25em;
}

li {
  margin-bottom: var(--sp-2);
}

strong {
  font-weight: 650;
}

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

:where(a, button, summary, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- Screen-reader / skip navigation ------------------------------------ */

.sr-only {
  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: 0;
  left: 50%;
  z-index: 999;
  transform: translate(-50%, -120%);
  padding: 0.75rem 1.5rem;
  background: var(--ink-800);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: transform 0.18s var(--ease);
}

.skip-link:focus {
  transform: translate(-50%, 0);
  color: #fff;
}

/* --- Layout primitives --------------------------------------------------- */

.container {
  width: min(100% - 2.5rem, var(--container));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 2.5rem, var(--container-narrow));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-y);
}

.section--muted {
  background: var(--bg-muted);
}

.section--dark {
  background: var(--bg-dark);
  color: var(--text-on-dark);
}

.section--darker {
  background: var(--bg-darker);
  color: var(--text-on-dark);
}

.section--dark :is(h1, h2, h3, h4),
.section--darker :is(h1, h2, h3, h4) {
  color: #fff;
}

/* Inline prose links only. The :not() matters: a CTA is normally authored as
   <p><a class="btn btn--accent">, and without it this rule repaints the label
   cyan on a cyan button — invisible until hover restores the button's own
   colour. Card links are excluded for the same reason. */
.section--dark :is(p, li, dd, td, address) a:not(.btn):not(.card),
.section--darker :is(p, li, dd, td, address) a:not(.btn):not(.card) {
  color: var(--cyan-400);
}

/* --- Scroll reveal (progressive enhancement, see js/ui.js) ----------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

.js [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 1;
    transform: none;
  }
}
