/*
 * Shared base for both sites. Structure only: colours, fonts and the corner radius come from each site's
 * tokens.css (--bg, --text, --muted, --line, --link, --accent, --radius, --font-body, --font-display, --font-mono).
 * Pages may not use inline style attributes (the CSP forbids them), hence the width utilities at the end.
 */

:root {
  --gutter: clamp(1rem, 4vw, 2rem);
  --container: 72rem;
  --measure: 68ch;

  --step--1: clamp(0.82rem, 0.8rem + 0.1vw, 0.9rem);
  --step-0: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.45rem);
  --step-2: clamp(1.45rem, 1.25rem + 1vw, 2rem);
  --step-3: clamp(1.8rem, 1.4rem + 2vw, 2.8rem);
  --step-4: clamp(2.2rem, 1.5rem + 3.5vw, 4rem);

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: clamp(3.5rem, 8vw, 6.5rem);
}

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

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
}

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

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.08em;
}

a:hover {
  text-decoration-thickness: 0.14em;
}

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

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

.mono {
  font-family: var(--font-mono);
  font-feature-settings: "zero" 1;
}

.visually-hidden {
  position: absolute !important;
  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(--gutter);
  top: -4rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  text-decoration: none;
}

.skip-link:focus {
  top: 0.75rem;
}

/* Layout */

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

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

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

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

.stack-lg {
  --stack: var(--space-3);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

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

.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
}

.cols-3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}

.cols-4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

.split {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 56rem) {
  .split {
    grid-template-columns: 1.05fr 0.95fr;
  }
  .split--even {
    grid-template-columns: 1fr 1fr;
  }
}

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

.prose > * + * {
  margin-top: var(--space-2);
}

.eyebrow {
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--eyebrow, var(--muted));
}

.lede {
  font-size: var(--step-1);
  line-height: 1.5;
  color: var(--lede, var(--muted));
}

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1.4rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

/* Site header and navigation (colours in each site's css) */

.site-header {
  position: relative;
  z-index: 20;
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: 4.5rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-toggle {
  display: none;
}

@media (max-width: 55.99rem) {
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.9rem;
    font: inherit;
    font-weight: 600;
    color: inherit;
    background: transparent;
    border: 1.5px solid currentColor;
    border-radius: var(--radius);
    cursor: pointer;
  }

  .js .site-header__bar {
    flex-wrap: wrap;
  }

  .js .site-nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-bottom: var(--space-2);
  }

  .js .site-nav[data-open="true"] {
    display: flex;
  }

  .js .site-nav a {
    display: block;
    padding: 0.75rem 0;
  }
}

/* Width utilities in 5% steps, for bars that cannot carry an inline style under the CSP. */
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }
