/* ==========================================================================
   Base: reset, typography, layout utilities
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}

@media (min-width: 768px) {
  :root {
    --header-h: 5.5rem;
  }
}

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

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

ul, ol {
  padding: 0;
  list-style: none;
}

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

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

h1, h2, h3 {
  font-weight: var(--fw-heavy);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.12;
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.2;
  font-weight: var(--fw-bold);
}

p {
  max-width: 65ch;
}

a {
  color: inherit;
}

/* ---- Focus ---- */
:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
}

/* Form fields already have a border, so the focus ring sits flush on it as one
   outline instead of a second box floating outside it. */
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--color-focus);
  box-shadow: 0 0 0 4px rgba(81, 186, 108, 0.45);
}

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

/* ---- Colour contexts ---- */
.is-dark {
  color: var(--gg-white);
  --color-text-muted: #E0E0E0;
  --eyebrow-color: var(--gg-green);
  --color-focus: var(--gg-white);
}

.is-green {
  color: var(--gg-on-green);
  --color-text-muted: var(--gg-on-green);
  --eyebrow-color: var(--gg-on-green);
  --color-focus: var(--gg-ink);
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide {
  max-width: var(--container-wide);
}

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

.section--tint {
  background: var(--gg-mint-light);
}

.section--flush-top {
  padding-top: 0;
}

.grid {
  display: grid;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .grid--2,
  .grid--4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .grid--4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.stack > * + * {
  margin-top: var(--space-4);
}

/* ---- Utilities ---- */
.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;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -4rem;
  z-index: 200;
  padding: var(--space-3) var(--space-5);
  background: var(--gg-ink);
  color: var(--gg-white);
  border-radius: var(--radius-pill);
  font-weight: var(--fw-bold);
}

.skip-link:focus {
  top: var(--space-3);
  outline-color: var(--gg-white);
}

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