/*
  base.css: what every theme shares. Reset, layout, components, utilities,
  accessibility rules and motion, written against custom properties.
  Each theme (css/themes/<name>.css, scoped to html[data-ui="<name>"])
  supplies the colour and display-type tokens and its own overrides.
  Switzer is the body face of all three themes, so it is declared here.
  Order: font-face, tokens, reset, base type, layout, components,
  utilities, theme marks, motion.
*/

/* ---------- 1. Font faces ---------- */

@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Regular.woff2") format("woff2"), url("/fonts/Switzer-Regular.woff") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Medium.woff2") format("woff2"), url("/fonts/Switzer-Medium.woff") format("woff");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Semibold.woff2") format("woff2"), url("/fonts/Switzer-Semibold.woff") format("woff");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Switzer";
  src: url("/fonts/Switzer-Bold.woff2") format("woff2"), url("/fonts/Switzer-Bold.woff") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Tokens ---------- */

:root {
  /* Colour tokens come from the active theme. */
  --focus: var(--accent);

  /* Type */
  --font-body: "Switzer", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-body); /* a theme names its display face */

  /* Fluid scale: ratio 1.2 at 375px growing to 1.333 at 1280px. */
  --step--1: clamp(0.833rem, 0.829rem + 0.019vw, 0.844rem);
  --step-0: clamp(1rem, 0.948rem + 0.221vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.076rem + 0.53vw, 1.5rem);
  --step-2: clamp(1.44rem, 1.208rem + 0.99vw, 2rem);
  --step-3: clamp(1.728rem, 1.339rem + 1.659vw, 2.666rem);
  --step-4: clamp(2.074rem, 1.46rem + 2.618vw, 3.554rem);
  --step-5: clamp(2.488rem, 1.556rem + 3.977vw, 4.738rem);

  /* Space */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: clamp(2rem, 1.6rem + 1.7vw, 3rem);
  --space-7: clamp(3rem, 2.2rem + 3.4vw, 5rem);
  --space-8: clamp(4rem, 2.6rem + 6vw, 8rem);

  /* Shape and layout */
  --radius: 1rem;
  --measure: 68ch;
  --max: 76rem;
  --gutter: clamp(1rem, 0.4rem + 2.6vw, 2.5rem); /* 16px on a phone */
  --tap: 2.75rem;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- 3. Reset ---------- */

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

* {
  margin: 0;
}

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

body {
  min-height: 100vh;
  min-height: 100dvh;
}

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

img {
  height: auto;
}

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

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

/* ---------- 4. Base typography ---------- */

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 400;
  line-height: 1.6;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 { font-size: var(--step-5); letter-spacing: -0.035em; line-height: 1.02; }
h2 { font-size: var(--step-4); letter-spacing: -0.03em; }
h3 { font-size: var(--step-2); font-weight: 500; }
h4 { font-size: var(--step-1); font-weight: 500; }

p,
li {
  text-wrap: pretty;
}

strong,
b {
  font-weight: 600;
}

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent);
}

a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

::selection {
  background: var(--accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* <main> takes focus from script (after the first-visit consent choice). It is
   a landmark, not a control, so a ring around the whole page would only be noise. */
#main:focus,
#main:focus-visible {
  outline: none;
}

/* ---------- 5. Layout ---------- */

.wrap {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.section + .section:not(.section--dark) {
  border-top: 1px solid var(--line);
}

.section--dark {
  --focus: var(--accent-on-dark);
  --line: var(--line-on-dark);
  --muted: var(--muted-on-dark);
  --accent: var(--accent-on-dark);
  background: var(--bg-dark);
  color: var(--ink-on-dark);
}

.grid-2,
.grid-3 {
  display: grid;
  gap: var(--space-6) var(--space-5);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
  .grid-2,
  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

/* ---------- 6. Components ---------- */

/* Header and navigation. Wraps to two rows on a phone, one row from 56rem. */
.site-header {
  border-bottom: 1px solid var(--line);
}

.nav {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "brand aside"
    "links links";
  align-items: center;
  gap: var(--space-2) var(--space-5);
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding: var(--space-3) var(--gutter);
}

.nav-brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav-links {
  grid-area: links;
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  min-width: var(--tap);
  justify-content: center;
  font-weight: 500;
  text-decoration-color: transparent;
}

.nav-links a:hover {
  color: var(--ink);
  text-decoration-color: var(--accent);
}

.nav a[aria-current="page"] {
  font-weight: 700 !important;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
}

.nav-aside {
  grid-area: aside;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  min-width: var(--tap);
  justify-content: center;
  margin-right: var(--space-2);
  padding-inline: var(--space-3);
  border: 1px solid var(--ink);
  border-radius: calc(var(--radius) / 2);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 180ms var(--ease-out);
}

/* Colours swap at once; only the lift is animated. */
.lang-switch:hover,
.lang-switch:focus-visible {
  background: var(--ink);
  color: var(--bg);
  transform: translateY(-2px);
}

.nav-social {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border-radius: 50%;
}

.nav-social svg {
  width: 1.125rem;
  height: 1.125rem;
}

@media (min-width: 56rem) {
  .nav {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand links aside";
    gap: var(--space-6);
  }

  .nav-links {
    justify-content: flex-end;
  }
}

/* Footer: a dark band carrying the closing line and the call. */
.site-footer {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-8) var(--space-6);
  padding-inline: max(var(--gutter), (100% - var(--max)) / 2);
}

.footer-tagline {
  max-width: 22ch;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--step-3);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.site-footer .btn {
  justify-self: start;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  text-decoration-color: transparent;
}

.footer-links a:hover {
  text-decoration-color: currentColor;
}

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.footer-copy {
  color: var(--muted);
  font-size: var(--step--1);
}

@media (min-width: 56rem) {
  .site-footer {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .site-footer .btn {
    justify-self: end;
  }

  .footer-meta {
    align-self: center;
    justify-content: flex-end;
  }
}

/* Hero: the one place type gets loud. */
.hero {
  padding-block: var(--space-7) var(--space-8);
}

.hero h1 {
  max-width: 17ch;
}

.hero .lede {
  margin-top: var(--space-5);
}

.hero .btn {
  margin-top: var(--space-6);
}

.eyebrow {
  margin-bottom: var(--space-4);
  color: var(--accent);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.lede {
  max-width: 40ch;
  font-size: var(--step-1);
  line-height: 1.45;
}

/* Cards: outlined, no shadow. The whole card may be a link. */
.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  text-decoration: none;
}

a.card:hover {
  color: inherit;
  border-color: var(--accent);
}

.card img {
  width: 100%;
  border-radius: calc(var(--radius) / 2);
  margin-bottom: var(--space-2);
}

.card__title {
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

a.card:hover .card__title {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.15em;
  text-decoration-color: var(--accent);
}

.card__meta {
  color: var(--muted);
  font-size: var(--step--1);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0.7em 1.3em;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) / 2);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-strong);
  color: #fff;
}

.section--dark .btn--primary {
  color: var(--bg-dark);
}

.section--dark .btn--primary:hover {
  background: var(--ink-on-dark);
  color: var(--bg-dark);
}

.btn--ghost {
  border-color: currentColor;
  background: transparent;
  color: inherit;
}

.btn--ghost:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.section--dark .btn--ghost:hover {
  background: var(--ink-on-dark);
  border-color: var(--ink-on-dark);
  color: var(--bg-dark);
}

/* Converge (partials/converge.njk): structure only; themes give it a look.
   No JS: the pile is a plain list above the four lanes. */
.converge__stage {
  display: grid;
  gap: var(--space-5);
  margin-top: var(--space-5);
}

.scraps,
.lane__slot,
.brief__fallback ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.scraps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.converge.is-converged .scraps {
  min-height: var(--pile-height, 0);
}

.scrap {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1px solid currentColor;
}

.converge__llama {
  --llama-size: 4rem;
  justify-self: start;
}

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

.converge__status {
  margin: 0;
}

/* The four moves: a real sequence, so they carry numbers. */
.lanes {
  display: grid;
  gap: var(--space-6) var(--space-5);
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 64rem) {
  .lanes {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.lane {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 2px solid currentColor;
}

.lane__num,
.brief__num {
  font-variant-numeric: tabular-nums;
}

.lane__name {
  font-size: var(--step-2);
}

.lane__slot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

/* Brief (partials/brief.njk): answers, then one visible result card. */
.brief__intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.brief__llama {
  --llama-size: 3.5rem;
}

.brief__answers {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: minmax(0, 1fr);
  margin-top: var(--space-5);
}

@media (min-width: 40rem) {
  .brief__answers {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.brief__answer {
  min-height: var(--tap);
  padding: var(--space-3) var(--space-4);
  border: 1px solid currentColor;
  background: none;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}

/* Non-colour state cues (WCAG 1.4.1). !important so no theme can drop them. */
.brief__answer[aria-pressed="true"] {
  border-width: 2px;
  font-weight: 700 !important;
  text-decoration: underline 2px !important;
  text-underline-offset: 0.25em;
}

.brief__results {
  margin-top: var(--space-5);
}

.brief__result {
  display: grid;
  gap: var(--space-3);
  justify-items: start;
}

.brief__move,
.brief__figure,
.brief__prompt {
  margin: 0;
}

/* Method page: one section per move. */
.method__body {
  margin-top: var(--space-6);
}

.method__body h3 {
  font-size: var(--step-1);
}

ul.practice,
ul.deliverables {
  list-style: square;
  padding-left: 1.25em;
}

.benchmarks {
  margin-top: var(--space-7);
}

.benchmarks > h3 {
  margin-bottom: var(--space-5);
  font-size: var(--step-2);
}

.benchmarks > .prose {
  margin-top: var(--space-6);
}

.bench__figure {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.bench figcaption > * + * {
  margin-top: var(--space-3);
}

.bench cite {
  font-style: normal;
}

.bench__caveat {
  color: var(--muted);
  font-size: var(--step--1);
}

/* Quote */
.quote {
  max-width: 32ch;
  padding-left: var(--space-5);
  border-left: 2px solid var(--accent);
}

.quote p {
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.quote__by {
  display: block;
  margin-top: var(--space-4);
  color: var(--muted);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0;
}

/* Quotes: stacked on a phone, three across from 64rem at a smaller size. */
.quotes {
  display: grid;
  gap: var(--space-7) var(--space-6);
}

@media (min-width: 64rem) {
  .quotes {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .quotes .quote p {
    font-size: var(--step-2);
  }
}

/* Section heading row: the h2, and an optional link at the far end. */
.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  margin-bottom: var(--space-6);
}

h2 + .lede {
  margin-top: var(--space-4);
}

/* A row of buttons that wraps on a phone. */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.hero .actions .btn {
  margin-top: 0;
}

/* Hero with an image: text first, image beside it from 56rem. */
.hero--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: center;
}

.hero__sub {
  max-width: var(--measure);
  margin-top: var(--space-4);
  color: var(--muted);
}

.hero--split img {
  border-radius: var(--radius);
}

@media (min-width: 56rem) {
  .hero--split {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

/* Project card image: one shape, whatever the source. */
.card__img {
  aspect-ratio: 16 / 10;
  object-fit: cover;
}

/* Timeline: a vertical rule with a mark per entry. */
.timeline {
  position: relative;
  display: grid;
  gap: var(--space-6);
  max-width: var(--measure);
  padding-left: var(--space-5);
  border-left: 1px solid var(--line);
}

.timeline__item {
  position: relative;
}

.timeline__item::before {
  content: "";
  position: absolute;
  top: 0.6em;
  left: calc(-1 * var(--space-5) - 4.5px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.timeline__item h3 {
  font-size: var(--step-1);
}

/* Case study: a label column beside the content from 48rem. */
.case {
  display: grid;
}

.case__section {
  display: grid;
  gap: var(--space-3);
  padding-block: var(--space-6);
  border-top: 1px solid var(--line);
}

.case__label {
  color: var(--accent);
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.6;
}

@media (min-width: 48rem) {
  .case__section {
    grid-template-columns: 12rem minmax(0, 1fr);
    gap: var(--space-6);
  }
}

/* Running text */
.prose {
  max-width: var(--measure);
}

.prose > * + * {
  margin-top: 1em;
}

.prose > h2,
.prose > h3 {
  margin-top: 1.6em;
}

.prose > h2 { font-size: var(--step-3); }

.prose ul,
.prose ol {
  padding-left: 1.25em;
}

.prose li + li {
  margin-top: 0.4em;
}

.prose li::marker {
  color: var(--accent);
}

.prose a {
  text-decoration-color: var(--accent);
}

.prose img {
  border-radius: var(--radius);
}

/* Gallery */
.gallery {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--radius) / 2);
}

.gallery figcaption {
  margin-top: var(--space-2);
  color: var(--muted);
  font-size: var(--step--1);
}

/* Forms: visible labels, 44px targets, a clear focus ring. */
.form {
  display: grid;
  gap: var(--space-5);
  max-width: 40rem;
}

.form__row {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 40rem) {
  .form__row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

.field label {
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  min-height: var(--tap);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--muted);
  border-radius: calc(var(--radius) / 2);
  background: #fff;
  color: var(--ink);
}

.field textarea {
  min-height: 10rem;
  resize: vertical;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-color: var(--accent);
}

.form .btn {
  justify-self: start;
}

/* About: the story reads as prose under its heading. */
.about__story,
.about__timeline {
  margin-top: var(--space-6);
}

/* The list reset (ol[class]) outranks .timeline; restore the gutter for the rule. */
ol.timeline {
  padding-left: var(--space-5);
}

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

/* 404: the French block under the English one. */
.not-found__fr {
  margin-top: var(--space-7);
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
}

.not-found__fr h2 {
  font-size: var(--step-3);
}

/* ---------- 7. Utilities ---------- */

/* The hidden attribute always wins over a component's display (brief cards,
   JS-revealed buttons). */
[hidden] {
  display: none !important;
}

/* JS swap: html.js is set by the inline head script before paint, so neither
   side flashes. Controls that need JS (Converge button, brief answers) step
   aside without it; their plain-link fallback steps aside with it. !important
   so a theme rule of equal specificity cannot undo the swap. */
html:not(.js) .js-only {
  display: none !important;
}

html.js .no-js-only {
  display: none !important;
}

.skip {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-3) var(--space-4);
  border-radius: calc(var(--radius) / 2);
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip:focus,
.skip:focus-visible {
  transform: none;
  color: var(--bg);
  outline-color: var(--accent);
}

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

/* ---------- 8. Theme marks and the shuffle control ---------- */

/* The llama partial renders all three marks; only the active theme's shows. */
.llama {
  display: none;
  line-height: 0;
}

html[data-ui="ink"] .llama--ink,
html[data-ui="poster"] .llama--poster,
html[data-ui="wool"] .llama--wool {
  display: inline-block;
}

.llama svg {
  width: var(--llama-size, 3rem);
  height: auto;
}

.footer-mark {
  --llama-size: 2.5rem;
  color: var(--accent);
}

/* Revealed by interactions.js (they do nothing without JS). */
.ui-shuffle,
.consent-open {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--step--1);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.ui-shuffle:hover,
.consent-open:hover {
  color: var(--accent);
}

.ui-shuffle[hidden],
.consent-open[hidden] {
  display: none;
}

/* Consent banner: a compact, non-modal bar on the bottom edge, small enough
   to leave the hero calls to action in the first screen. Layout only; each
   theme sets the --consent-* colour and type tokens. While it shows, focus
   scrolling keeps clear of it (WCAG 2.4.11). */
.consent {
  position: fixed;
  inset: auto 0 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--gutter) calc(var(--space-2) + env(safe-area-inset-bottom, 0px));
  border-top: var(--consent-rule, 1px solid transparent);
  background: var(--consent-bg, var(--bg-dark));
  color: var(--consent-ink, var(--ink-on-dark));
  font-family: var(--consent-font, var(--font-body));
  font-size: var(--step--1);
  line-height: 1.35;
}

.consent[hidden] {
  display: none;
}

.consent:focus {
  outline: none;
}

/* Theme rules set the ring colour from --focus on every :focus-visible; inside
   the bar that must be the bar's own contrast colour, not the page accent. */
.consent {
  --focus: var(--consent-focus, currentColor);
}

.consent__text {
  flex: 1 1 18rem;
  max-width: 80ch;
}

.consent__actions {
  display: flex;
  gap: var(--space-2);
}

.consent__btn {
  min-width: 6.5rem;
  min-height: var(--tap);
  padding: var(--space-2) var(--space-4);
  border: 2px solid var(--consent-btn-bg, currentColor);
  border-radius: var(--consent-radius, var(--radius));
  background: var(--consent-btn-bg, transparent);
  color: var(--consent-btn-ink, inherit);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.consent__btn:hover {
  text-decoration: underline;
}

.consent__btn:focus-visible {
  outline: 3px solid var(--consent-focus, currentColor);
  outline-offset: 2px;
}

/* Wide screens: a card in the bottom right corner, clear of the hero calls
   to action, which sit left or high in every theme. */
@media (min-width: 56rem) {
  .consent {
    inset: auto var(--gutter) var(--space-4) auto;
    max-width: 30rem;
    justify-content: flex-start;
    padding: var(--space-4);
    border: var(--consent-rule, 1px solid transparent);
    border-radius: var(--radius);
  }
}

/* interactions.js adds html.consent-visible and sets --consent-h on <html> while the bar shows. */
html.consent-visible {
  scroll-padding-bottom: var(--consent-h, 7rem);
}

html.consent-visible body {
  padding-bottom: var(--consent-h, 7rem);
}

/* Phones narrower than 400px: a tighter consent bar so it stays a small share
   of the screen (1.4.10). Targets keep their full height. */
@media (max-width: 24.99rem) {
  .consent {
    gap: var(--space-1) var(--space-2);
    padding-block: var(--space-1) calc(var(--space-1) + env(safe-area-inset-bottom, 0px));
    font-size: var(--step--2, 0.8125rem);
    line-height: 1.3;
  }

  .consent__text {
    flex-basis: 100%;
  }

  .consent__actions {
    width: 100%;
  }

  .consent__btn {
    flex: 1 1 0;
    min-width: 0;
    padding-inline: var(--space-2);
  }
}

/* ---------- 9. Motion ---------- */

/* One entrance: the hero settles in once on load. */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(0.75rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero > * {
  animation: rise 700ms var(--ease-out) both;
}

.hero > :nth-child(2) { animation-delay: 80ms; }
.hero > :nth-child(3) { animation-delay: 160ms; }
.hero > :nth-child(4) { animation-delay: 240ms; }
.hero > :nth-child(n + 5) { animation-delay: 320ms; }

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

/* ---------- Low vision (1.4.4, 1.4.10, 1.4.12) ---------- */

/* Long words and strings wrap instead of widening the page, even with
   wide letter and word spacing. */
:is(h1, h2, h3, h4, h5, h6, p, li, dt, dd, blockquote, figcaption, a, .btn) {
  overflow-wrap: anywhere;
}

/* Prose stays a readable line length at any zoom. */
p {
  max-inline-size: 70ch;
}

/* ---------- Forced colours (Windows High Contrast, 1.4.11) ---------- */

@media (forced-colors: active) {
  .btn,
  .consent__btn,
  .ui-shuffle,
  .consent-open,
  button {
    /* !important: themes reset borders on their own button skins. */
    border: 2px solid ButtonText !important;
    background: ButtonFace;
    color: ButtonText;
    forced-color-adjust: auto;
  }

  .btn:hover,
  .consent__btn:hover,
  .ui-shuffle:hover,
  .consent-open:hover,
  button:hover {
    border-color: Highlight;
    color: Highlight;
  }

  .btn:focus-visible,
  .consent__btn:focus-visible,
  button:focus-visible,
  a:focus-visible,
  :focus-visible {
    outline: 2px solid CanvasText;
    outline-offset: 2px;
  }

  .consent {
    border: 2px solid CanvasText;
    background: Canvas;
    color: CanvasText;
  }

  [aria-pressed="true"],
  [aria-current="page"] {
    border-color: Highlight;
    text-decoration: underline;
  }

  /* Llama marks and their pieces follow the text colour. */
  svg [fill]:not([fill="none"]) {
    fill: CanvasText;
  }

  svg [stroke]:not([stroke="none"]) {
    stroke: CanvasText;
  }
}

/* Form errors: stated in words (never colour alone), plus a thicker border. */
.field__req {
  font-weight: 400;
}

.field__error {
  margin: 0;
  font-weight: 600;
}

html[data-ui] .field input[aria-invalid="true"],
html[data-ui] .field textarea[aria-invalid="true"] {
  border-width: 3px;
}
