/* =========================================================
   Base: reset, typography, links, buttons, layout helpers
   ========================================================= */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1.5rem;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  /* No automatic hyphenation: words stay whole whenever they fit on a line.
     Only a word that is wider than the whole line (e.g. at 400 % zoom) is broken,
     so nothing ever runs off the screen. */
  overflow-wrap: break-word;
}

/* Form controls use the page font (browsers default to a system font) */
input,
button,
select,
textarea {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* ---- Headings ---- */
h1,
h2,
h3 {
  margin: 0 0 var(--space-s);
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  /* Fraunces: soft, slightly "wonky" letterforms = warm and personal */
  font-variation-settings: "SOFT" 100, "WONK" 1;
  text-wrap: balance;
}

h1 { font-size: var(--text-hero); letter-spacing: -0.02em; }
h2 { font-size: var(--text-2xl); letter-spacing: -0.01em; }
h3 { font-size: var(--text-xl); }

p {
  margin: 0 0 var(--space-s);
  max-width: var(--text-width);
  text-wrap: pretty;
}

.lead {
  font-size: var(--text-lg);
  line-height: 1.5;
}

/* ---- Links ---- */
a {
  color: var(--teal);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}
a:hover {
  color: var(--ink);
}

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

/* ---- Buttons ---- */
.button {
  display: inline-block;
  padding: 0.85rem 1.5rem;
  border: 2px solid var(--ink);
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font: 700 var(--text-base) / 1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}
.button--ghost {
  background: transparent;
  color: var(--ink);
}
/* Hover colours only on devices with a mouse: on phones and tablets a tapped button
   would otherwise stay in its hover colour after going back to the page. */
@media (hover: hover) {
  .button:hover {
    background: var(--paper);
    color: var(--ink);
  }
  .button--ghost:hover {
    background: var(--ink);
    color: var(--paper);
  }
}

/* ---- Layout helpers ---- */
.container {
  width: min(100% - 2.5rem, var(--page-width));
  margin-inline: auto;
}

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

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper);
}
.skip-link:focus {
  top: 1rem;
}

[hidden] {
  display: none !important;
}

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