/* ==========================================================================
   base.css — Reset, document defaults, typography
   Element-level styling only. No components, no layout.
   ========================================================================== */

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

* {
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;                 /* respect the user's browser setting */
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + var(--space-lg));
  -webkit-text-size-adjust: 100%;
  /* Horizontal clipping belongs here, not on <body>. Setting overflow-x on
     body forces its overflow-y to compute as `auto`, which turns body into
     its own scroll container — and because that container is as tall as its
     content it can never scroll. Every in-page anchor then silently does
     nothing, since scrollIntoView resolves against body instead of the
     document. On <html> the clip applies without creating that container. */
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--color-text);
  background-color: var(--color-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

/* ---------- Typography ---------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-tight);
  text-wrap: balance;              /* progressive enhancement */
  color: var(--color-text);
}

h1 {
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

h2 {
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-semibold);
}

h3 {
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-medium);
}

h4 {
  font-size: var(--font-size-h4);
  font-weight: var(--font-weight-medium);
}

p {
  text-wrap: pretty;
}

p + p {
  margin-top: var(--space-lg);
}

strong {
  font-weight: var(--font-weight-semibold);
}

em {
  font-style: italic;
}

blockquote {
  margin: 0;
}

/* ---------- Links ---------- */
a {
  color: var(--color-primary-deep);
  text-decoration: none;
  transition: color var(--transition-fast) var(--ease-out);
}

a:hover {
  color: var(--color-accent-deep);
}

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

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

button {
  background: none;
  border: none;
  cursor: pointer;
}

/* ---------- Focus ---------- */
/* Visible on every surface: amber reads against cream, navy and coral alike. */
:focus-visible {
  outline: 3px solid var(--color-amber);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* ---------- Selection ---------- */
::selection {
  background-color: var(--color-primary);
  color: var(--color-text-invert);
}

/* ---------- Screen-reader-only utility ---------- */
.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 — visible only once focused */
.skip-link {
  position: absolute;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 200;
  padding: var(--space-md) var(--space-xl);
  background-color: var(--color-primary);
  color: var(--color-text-invert);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  transform: translateY(-200%);
  transition: transform var(--transition-fast) var(--ease-out);
}

.skip-link:focus {
  transform: translateY(0);
  color: var(--color-text-invert);
}

/* ---------- Accessibility: reduced motion ----------
   Honours the OS-level setting. Animations collapse to ~0 rather than being
   removed, so any JS that relies on transitionend/animationend still fires. */
@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;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  body {
    background: #fff;
    color: #000;
  }

  .site-nav,
  .mobile-menu,
  .hero__visual,
  .scroll-top {
    display: none !important;
  }
}
