/* Base: reset, type roles, the design system's buttons, links, focus, eyebrow, section-num.
   Every value comes from tokens.css. */

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

:root {
  --gutter: var(--space-4);
  --header-height: var(--nav-height);
}

/* The page scrolls vertically without showing a bar, and never sideways: a bar that comes and
   goes (or a sideways one) changes the layout width and makes the whole page shift. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first allow-end;
  overflow-x: clip;
  scrollbar-width: none;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  overflow-x: clip;
}

/* Wide screens: scale the whole rem-based system instead of adding sizes. */
@media (min-width: 1920px) {
  html { font-size: 112.5%; }
}

@media (min-width: 2400px) {
  html { font-size: 125%; }
}

/* Copy is injected from the dictionaries; hide the empty skeleton until it is in place. */
html:not([data-copy="ready"]) body {
  visibility: hidden;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

img {
  height: auto;
}

h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote {
  margin: 0;
}

/* Zero specificity, so component classes can set their own padding. */
:where(ul[class], ol[class]) {
  list-style: none;
  padding: 0;
}

address {
  font-style: normal;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  text-wrap: balance;
}

p, li, dd {
  text-wrap: pretty;
}

a {
  color: var(--color-primary);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--color-primary-hover);
}

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}

main:focus,
section[tabindex="-1"]:focus {
  outline: none;
}

::selection {
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

[hidden] {
  display: none !important;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ─── Type roles ─── */

.title {
  max-width: 18ch;
  font-family: var(--font-display);
  font-size: var(--type-title);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.015em;
}

.title em,
.hero__title em {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-primary);
}

.h3 {
  font-family: var(--font-body);
  font-size: var(--text-lg);
  font-weight: 700;
  line-height: 1.3;
}

/* The system's lede: secondary colour, generous size, 62ch. */
.lede {
  max-width: var(--measure);
  font-size: var(--type-lede);
  line-height: 1.6;
  color: var(--color-text-secondary);
}

.body {
  max-width: var(--measure);
}

.small {
  font-size: var(--text-sm);
  line-height: 1.5;
}

.muted {
  color: var(--color-text-secondary);
}

/* Archivo 600, tracked, uppercase — the system's UI label and eyebrow. */
.label,
.eyebrow {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}

/* The italic serif numeral that closes a section head ("i.", "ii."…). */
.section-num {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-style: italic;
  color: var(--color-text-secondary);
}

/* ─── Buttons: the pill carries the primary action; the rest stays crisp ─── */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--size-touch);
  border: 1px solid transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--duration-hover) ease, color var(--duration-hover) ease, border-color var(--duration-hover) ease, transform var(--duration-hover) ease;
}

.button--primary {
  padding: 14px 28px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-primary-contrast);
}

.button--primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-primary-contrast);
  transform: translateY(-1px);
}

.button--secondary {
  padding: 13px 26px;
  border-color: var(--color-border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text);
}

.button--secondary:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
}

.button--ghost {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-text-secondary);
}

.button--ghost:hover {
  background: var(--color-surface-sunken);
  color: var(--color-text);
}

.button--large {
  padding: 16px 32px;
  font-size: var(--text-base);
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--size-touch);
  font-weight: 600;
  color: var(--color-primary);
}

/* ─── Tags ─── */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-full);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* ─── Skip link ─── */

.skip-link {
  position: fixed;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: var(--size-touch);
  padding: var(--space-2) var(--space-5);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-weight: 600;
  transform: translateY(calc(-100% - var(--space-5)));
}

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

.noscript {
  padding: var(--space-5);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

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