/* ==========================================================================
   base.css – reset, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* Anchor links (#video-v003) should not land hidden under the sticky header. */
  scroll-padding-top: calc(var(--header-height) + var(--space-4));
}

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

/* While the lightbox (a <dialog>) is open, the page behind must not scroll. */
html:has(dialog[open]) {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  /* Ease the switch between light and dark instead of a hard flash. */
  transition: background-color var(--dur-slow) ease, color var(--dur-slow) ease;
}

main {
  flex: 1;
}

/* --- Typography ----------------------------------------------------------
   Tracking (letter-spacing) depends on size: big headings get NEGATIVE
   tracking (large letters look too far apart), body stays at 0, tiny labels
   get slightly positive tracking. Line-height goes the other way: tight for
   big type, comfortable for body. */
h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 700;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.25rem, 1.4rem + 4vw, 4.5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

h2 {
  font-size: clamp(1.625rem, 1.2rem + 1.6vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* .h3 = looks like an h3 but keeps the correct heading level for structure. */
h3,
.h3 {
  font-size: 1.1875rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.lead {
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem);
  line-height: 1.45;
  letter-spacing: -0.005em;
  color: var(--color-text-2);
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent);
}

.meta {
  font-size: 0.875rem;
  letter-spacing: 0.005em;
  color: var(--color-text-2);
}

a {
  color: var(--color-accent);
  text-underline-offset: 0.18em;
}

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

/* touch-action: manipulation removes the old ~300ms tap delay on mobile. */
a,
button,
summary,
label {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

/* Keyboard focus: always clearly visible, but only for keyboard users
   (:focus-visible), so mouse clicks don't leave rings everywhere. */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* --- Layout primitives --------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(3rem, 2rem + 5vw, 6rem);
}

.section + .section {
  padding-top: 0;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.section-head > div {
  display: grid;
  gap: var(--space-2);
  max-width: 40rem;
}

.stack > * + * {
  margin-top: var(--space-4);
}

.page-head {
  padding-top: clamp(2.5rem, 1.5rem + 5vw, 5rem);
  padding-bottom: var(--space-6);
  display: grid;
  gap: var(--space-3);
  max-width: 48rem;
}

/* Hidden visually, still read by screen readers. */
.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;
}

/* First Tab press on every page: jump past the navigation. */
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-text);
  color: var(--color-bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

[hidden] {
  display: none !important;
}
