/* ─── Base Styles ────────────────────────────────────────────────────────────
   Breakpoints (mobile-first, min-width): 480 / 640 / 768 / 992 / 1200.
   Custom properties can't be used inside @media conditions, so the pixel
   values are written out — see docs/styling.md.
   ────────────────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Themed page scrollbar — never the unstyled OS default (docs/styling.md). */
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--primary-color) 70%, var(--bg-color)) var(--bg-light);
}

/* WebKit/Blink fallback (older Chrome/Safari ignore scrollbar-color). */
@supports not (scrollbar-color: auto) {
  ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
  }
  ::-webkit-scrollbar-track {
    background: var(--bg-light);
  }
  ::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary-color) 70%, var(--bg-color));
    border: 2px solid var(--bg-light);
    border-radius: 999px;

    &:hover {
      background: var(--primary-color);
    }
  }
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--paper);
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(15.5px, 0.3vw + 14.5px, 17px);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

img {
  /* auto height keeps the intrinsic aspect ratio, so the width/height
     attributes (used only to reserve space) can never stretch an image. */
  height: auto;
  border-style: none;
}

a {
  color: var(--ink);
  text-decoration: none;
  transition: color var(--hover-duration);

  &:hover {
    color: var(--coral-ink);
  }
}

/* Running-text links stay recognisable as links. */
.legal a,
.note a,
.ans a,
.consent a,
.single__text a,
.prose a {
  text-decoration: underline;
  text-decoration-color: var(--lantern-deep);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Bricolage Grotesque", ui-rounded, "Segoe UI", system-ui, sans-serif;
  line-height: 1.08;
  letter-spacing: -0.02em;
  margin: 0 0 0.5em;
  font-weight: 800;
  color: inherit;
}

h1 {
  font-size: clamp(2.35rem, 5.4vw, 4.6rem);
}

h2 {
  font-size: clamp(1.8rem, 3.4vw, 2.9rem);
}

h3 {
  font-size: clamp(1.18rem, 1.6vw, 1.45rem);
  letter-spacing: -0.01em;
}

h4 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1em;
}

ul,
ol {
  padding-left: 1.15em;
  margin: 0 0 1em;
}

figure {
  margin: 0;
}

b,
strong {
  font-weight: 700;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2em 0;
}

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

button {
  cursor: pointer;
}

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

.is-dark :focus-visible,
.footer :focus-visible,
.hero-app :focus-visible {
  outline-color: var(--lantern);
}

/* ─── Accessibility utilities ─────────────────────────────────────────────── */

.screen-reader-text,
.screen-reader-response {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;

  &:focus {
    top: 12px;
    color: var(--paper);
  }
}

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.main-wrapper {
  position: relative;
}

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 var(--gut);
}

main {
  display: block;
  position: relative;
}

main:focus {
  outline: none;
}

.locked {
  overflow: hidden;
}

.text-center {
  text-align: center;
}
