/* ==========================================================================
   Window Scene — Base layer
   Reset, base typography, focus, layout primitives. Mobile-first (authored at
   360px; layout expands upward). No fixed pixel widths on layout elements.
   ========================================================================== */

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

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

body {
  margin: 0;
  min-width: 0;
  background: var(--bg);
  color: var(--ink-body);
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.6;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* The classic overflow cause: flex/grid children that refuse to shrink. */
:where(.flow, .grid, [class$="-grid"]) > * {
  min-width: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

::selection {
  background: var(--wash-select);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

/* --- Headings: Newsreader display scale (exact from tokens table) --- */
h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
}

h1 {
  font-size: clamp(34px, 7.6vw, 86px);
  line-height: 1.03;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h2 {
  font-size: clamp(28px, 5vw, 58px);
  line-height: 1.08;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h3 {
  font-size: clamp(19px, 2.2vw, 28px);
  line-height: 1.2;
}

p {
  margin: 0;
}

/* --- Shared type roles --- */
.lead {
  font-size: clamp(15px, 2.1vw, 22px);
  line-height: 1.55;
  color: var(--ink-body);
  text-wrap: pretty;
}

.eyebrow {
  margin: 0;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}

.ui-label {
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-quiet);
}

/* --- Layout primitives --- */
.page {
  width: 100%;
  max-width: var(--measure-page);
  margin-inline: auto;
  padding-inline: var(--section-inline);
}

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

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

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

/* --- Accessibility: visible focus, never removed without replacement --- */
:focus-visible {
  outline: 2px solid var(--accent-deep);
  outline-offset: 2px;
}

.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;
  left: 8px;
  top: -48px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--accent-deep);
  color: var(--on-accent);
  transition: top 160ms ease;
}

.skip-link:focus {
  top: 8px;
  color: var(--on-accent);
}

/* --- Motion budget: honor reduced-motion globally --- */
@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;
  }
}
