/*
 * Reset, font, base typography and layout primitives.
 *
 * Load order matters: tokens.css must come first, since everything here reads
 * its custom properties. Both pages link them in that order.
 */

/*
 * Plus Jakarta Sans, self-hosted from the app's copy. Licensed under the SIL
 * Open Font License -- see fonts/OFL.txt, which ships with the site to satisfy
 * the licence's attribution clause.
 *
 * One variable file covers weights 200-800, so there is a single request for
 * the whole scale. It is still a .ttf; converting to .woff2 would cut it from
 * ~176KB to roughly a third. Worth doing before launch.
 */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../fonts/PlusJakartaSans-Variable.ttf") format("truetype-variations");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* ---- Reset ------------------------------------------------------------- */

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@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;
  }
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-body-lg);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  color: var(--color-text);
  background-color: var(--color-surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

/* ---- Typography -------------------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-weight: var(--weight-bold);
  letter-spacing: -0.015em;
  text-wrap: balance;
}

h1 {
  font-size: var(--text-display);
  line-height: var(--leading-display);
  font-weight: var(--weight-extrabold);
}

h2 {
  font-size: var(--text-display-sm);
  line-height: var(--leading-headline);
  font-weight: var(--weight-extrabold);
}

h3 {
  font-size: var(--text-headline-sm);
  line-height: var(--leading-headline);
}

h4 {
  font-size: var(--text-title-lg);
  line-height: var(--leading-title-lg);
}

p {
  text-wrap: pretty;
}

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

/* ---- Focus ------------------------------------------------------------- */

:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-xxs);
}

/* Skip link, visible only once focused. */
.skip-link {
  position: absolute;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 100;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: var(--weight-bold);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

/* ---- Layout primitives -------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--width-page);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

@media (min-width: 48rem) {
  .container {
    padding-inline: var(--space-xxl);
  }
}

.section {
  padding-block: var(--space-section);
}

.prose {
  max-width: var(--width-prose);
}

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

/* ---- Buttons ------------------------------------------------------------ */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: var(--touch-target);
  padding: var(--space-sm) var(--space-xl);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: var(--text-label-lg);
  font-weight: var(--weight-bold);
  line-height: 1.4;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-fast) var(--ease-out),
    border-color var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button--primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.button--primary:hover {
  background: var(--color-primary-dark);
}

.button--secondary {
  background: transparent;
  border-color: var(--color-border);
  color: var(--color-text);
}

.button--secondary:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
