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

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.5;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, figure { margin: 0; }
h1, h2 { font-family: var(--font-display); font-weight: 800; letter-spacing: 0.005em; text-transform: uppercase; }
h1 { font-size: var(--text-2xl); line-height: 1.02; }
h2 { font-size: var(--text-xl); line-height: 1.08; }
h3 { font-size: var(--text-base); font-weight: 700; line-height: 1.3; }

a { color: inherit; text-decoration: none; }
img, video, svg { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

/* :where keeps this low in priority, so a component can set its own padding. */
input:where(:not([type="checkbox"], [type="radio"], [type="range"])), textarea, select {
  width: 100%;
  min-height: var(--tap-size);
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  /* 16px stops iOS zooming in on focus. */
  font-size: 16px;
  transition: border-color var(--duration) var(--ease), background var(--duration) var(--ease);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--color-text-muted); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
input[type="datetime-local"], input[type="date"] { color-scheme: dark; }

:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 2px; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.muted { color: var(--color-text-muted); }
.small { font-size: var(--text-sm); }
.preline { white-space: pre-line; overflow-wrap: anywhere; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-tight { display: flex; flex-direction: column; gap: var(--space-2); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.row-end { display: flex; align-items: center; justify-content: flex-end; gap: var(--space-2); flex-wrap: wrap; }
.row-split { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.row-split > * { flex: 1 1 0; min-width: 96px; }
.row-icon { display: flex; align-items: center; gap: var(--space-2); }

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