/* ==========================================================================
   Base: reset, document, text defaults, focus, utilities.
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  scroll-padding-top: 0;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--fs-md);
  line-height: var(--lh-body-theme);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

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

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

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

table { border-collapse: collapse; width: 100%; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 118%;
  letter-spacing: var(--track-display);
  line-height: var(--lh-snug);
  text-wrap: balance;
}

p { text-wrap: pretty; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: color-mix(in oklch, var(--accent) 70%, transparent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: text-decoration-color var(--dur-1) ease, color var(--dur-1) ease;
}

@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration-color: var(--accent); }
}

::selection { background: var(--accent-wash-strong); color: var(--text); }

:focus { outline: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

.num { font-variant-numeric: tabular-nums; }

.vh {
  position: absolute !important;
  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: var(--space-sm);
  top: var(--space-sm);
  z-index: 100;
  padding: var(--space-2xs) var(--space-sm);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform var(--dur-2) var(--ease-out-expo);
}

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

.noscript {
  max-width: 40ch;
  margin: 20vh auto;
  padding: var(--space-md);
  color: var(--text-2);
}

/* Missing value: a centred dot in tertiary ink */
.na {
  color: var(--text-3);
  font-weight: 600;
}

/* Small uppercase label */
.label {
  font-family: var(--font-text);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--text-3);
  line-height: 1.3;
}

/* View Transitions: theme reveal is driven from JS (clip-path circle) */
::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-group(capture) {
  animation-duration: 460ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Lightbox open/close: the page cross-fades while the capture morphs */
.vt-lightbox::view-transition-old(root) { animation: vt-out 200ms ease both; }
.vt-lightbox::view-transition-new(root) { animation: vt-in 280ms ease both; }

@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
