/* ==========================================================================
   BASE STYLES
   Reset, default typography, and a few utilities. Reads everything from tokens.css.
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Headings */
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  line-height: var(--lh-heading);
  letter-spacing: var(--track-display);
  text-wrap: balance;
}
h1 { font-size: var(--step-6); line-height: var(--lh-tight); font-weight: 600; }
h2 { font-size: var(--step-4); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

/* Text */
p { margin: 0; max-width: var(--measure); text-wrap: pretty; }
small { font-size: var(--step--1); }

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

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

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

/* Media and form elements */
img, svg, video { display: block; max-width: 100%; height: auto; }
button, input, textarea, select { font: inherit; color: inherit; }

/* Layout helpers */
.container {
  width: min(100% - 2 * var(--gutter), var(--wrap));
  margin-inline: auto;
}
.section { padding-block: var(--space-section); }
.stack > * + * { margin-top: var(--stack, var(--space-4)); }

/* Button (a link that looks like a button) */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.9rem 1.75rem;
  border: 1px solid var(--color-accent);
  border-radius: 999px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font: 500 var(--step-0) / 1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out), color var(--dur-base) var(--ease-out);
}
.button:hover { background: transparent; color: var(--color-accent); text-decoration: none; }
.button--ghost { background: transparent; color: var(--color-accent); }
.button--ghost:hover { background: var(--color-accent); color: var(--color-accent-ink); }

/* Handwritten aside (Caveat) */
.note {
  font-family: var(--font-note);
  font-size: var(--step-1);
  line-height: 1.2;
  color: var(--color-accent);
}

/* Accessibility */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border-radius: var(--radius-s);
}
.skip-link:focus { top: var(--space-4); }

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