/* ============================================================================
   Safari Heirloom — Base / reset / element defaults / a11y primitives
   Depends on tokens.css. Mobile-first, fluid. (Design spec §2.5, §7.)
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Contain any horizontal overflow AT THE ROOT so fixed/off-canvas descendants
     (e.g. the mobile nav drawer parked at translateX(100%)) can never create a
     sideways scroll. `clip` (not `hidden`) avoids making the root a scroll
     container, so sticky header + smooth anchor scrolling keep working. */
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-0);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

/* Media defaults — never overflow, intrinsic sizing prevents CLS */
img, picture, video, svg { display: block; max-width: 100%; height: auto; }
img { background: var(--sunk); }      /* gentle placeholder while decoding */

/* Headings — display serif, tight, balanced. Optical tracking closes as the
   Playfair (a high-contrast didone) grows, which is the biggest "couture" tell. */
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: var(--lh-heading);
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
  color: var(--ink);
}
h1 { font-size: var(--fs-5); line-height: var(--lh-display); letter-spacing: var(--tracking-display); }
h2 { font-size: var(--fs-3); }
h3 { font-size: var(--fs-2); letter-spacing: var(--tracking-tight); }
p, li { text-wrap: pretty; }
p { max-width: var(--measure); }

a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 0.15em;
  transition: color var(--dur-micro) var(--ease-settle); }
a:hover { color: var(--brand-bright); }

strong { font-weight: 600; }

/* Form controls inherit type */
input, button, select, textarea { font: inherit; color: inherit; }

/* --- Focus: a visible, warm ring on every interactive element ------------- */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-input);
}
:focus:not(:focus-visible) { outline: none; }

/* --- Layout helpers ------------------------------------------------------- */
.container { width: 100%; max-width: var(--frame); margin-inline: auto; padding-inline: var(--gutter); }
.measure { max-width: var(--measure); }
.section { padding-block: var(--space-3xl); }
.section--band { background: var(--cream-band);
  border-block: 1px solid color-mix(in srgb, var(--line) 65%, transparent); }
.stack > * + * { margin-top: var(--space-md); }
.center { text-align: center; margin-inline: auto; }

/* eyebrow / kicker above section titles */
.eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs--1);
  font-weight: 600;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--brand);
  margin-bottom: var(--space-sm);
}
.lead { font-size: var(--fs-1); line-height: var(--lh-lead); color: var(--ink-soft); }
.muted { color: var(--ink-faint); }

/* --- Accessibility primitives -------------------------------------------- */
.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-to-content {
  position: absolute; left: var(--space-md); top: -100%;
  z-index: var(--z-toast);
  background: var(--paper); color: var(--ink);
  padding: var(--space-sm) var(--space-md); border-radius: var(--r-input);
  box-shadow: var(--shadow-raised);
}
.skip-to-content:focus { top: var(--space-md); }

[hidden] { display: none !important; }

/* --- Motion: honoured, never imposed -------------------------------------- */
@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;
  }
}

/* Reveal-on-scroll: a slow, weighty expo rise. Uses `animation` (not transition)
   so it can't be clobbered by a component's own transition declaration
   (e.g. .card{transition:transform,box-shadow} used to cancel the fade). */
.reveal { opacity: 0; }
.reveal.is-visible { animation: reveal-rise var(--dur-reveal) var(--ease-luxe) both; }
@keyframes reveal-rise {
  from { opacity: 0; transform: translateY(1.25rem); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; }
  .reveal.is-visible { animation: none; }
}
