/*
 * Wombook colour tokens. The only place colours are defined; tokens.ts mirrors
 * these values for three.js (a test keeps the two in step). Every text pair is
 * checked against WCAG AA in tokens.test.ts.
 *
 *   desk        the surface the book lies on (app background, header)
 *   paper       the page: cards, panels, reading surface
 *   ink         body text
 *   ink-soft    secondary text
 *   line        hairlines and decorative borders
 *   line-strong edges that identify a control (form fields), at least 3:1
 *   accent      bookcloth green: primary buttons and the selected state
 *   accent-ink  text on accent
 *   accent-soft quiet highlight (avatar discs, spine labels, hover)
 *   focus       keyboard focus ring
 *   danger      destructive actions and errors
 *   danger-ink  text on danger
 *   shadow      shadow colour, used with transparency
 */
:root,
:root[data-theme="sepia"] {
  color-scheme: light;
  --wb-desk: #e8dcc2;
  --wb-paper: #f6edd9;
  --wb-ink: #3b2c1e;
  --wb-ink-soft: #6a563f;
  --wb-line: #d8c6a3;
  --wb-line-strong: #8a7454;
  --wb-accent: #2f5d46;
  --wb-accent-ink: #fff8ea;
  --wb-accent-soft: #dfe0c3;
  --wb-focus: #2d6596;
  --wb-danger: #9e3328;
  --wb-danger-ink: #fff8ea;
  --wb-shadow: #5a4128;
}

:root[data-theme="papier"] {
  color-scheme: light;
  --wb-desk: #efebe3;
  --wb-paper: #fdfbf6;
  --wb-ink: #2a2520;
  --wb-ink-soft: #5f574d;
  --wb-line: #ddd5c8;
  --wb-line-strong: #878072;
  --wb-accent: #2b5f48;
  --wb-accent-ink: #fffbf4;
  --wb-accent-soft: #e4eadc;
  --wb-focus: #2f6fa3;
  --wb-danger: #a3352b;
  --wb-danger-ink: #fffbf4;
  --wb-shadow: #4a3b2a;
}

:root[data-theme="donker"] {
  color-scheme: dark;
  --wb-desk: #14110d;
  --wb-paper: #201b16;
  --wb-ink: #eadfcb;
  --wb-ink-soft: #b8aa92;
  --wb-line: #3b342b;
  --wb-line-strong: #83745f;
  --wb-accent: #9fcbad;
  --wb-accent-ink: #16211a;
  --wb-accent-soft: #28312a;
  --wb-focus: #8cc0ea;
  --wb-danger: #f08e7e;
  --wb-danger-ink: #23180f;
  --wb-shadow: #000000;
}

/*
 * The public pages (landing.go): the landing page and the content pages for
 * parents. The colour tokens come first in the same file (web/src/theme/tokens.css,
 * embedded by the server); every colour here is a var(--wb-*) or a mix of two.
 * The look is the app's (DESIGN.md): paper on a desk, bookcloth green for the
 * one action, Andika throughout. Below the fold nothing loads before it is needed.
 */
@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url('/landing/fonts/andika-latin-400-normal.woff2?v=dd6bb7266c94') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: 'Andika';
  font-style: normal;
  font-display: swap;
  font-weight: 700;
  src: url('/landing/fonts/andika-latin-700-normal.woff2?v=61c90acb5f96') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

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

:root {
  --wb-font-ui: 'Andika', ui-rounded, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wb-touch: 48px;
  --wb-touch-min: 44px;
  --wb-radius-card: 20px;
  --wb-radius-tile: 16px;
  --wb-radius-pill: 999px;
  --wb-gutter-l: max(1rem, env(safe-area-inset-left));
  --wb-gutter-r: max(1rem, env(safe-area-inset-right));
  --wb-shadow-paper: 0 1px 2px color-mix(in srgb, var(--wb-shadow) 14%, transparent),
    0 10px 24px -14px color-mix(in srgb, var(--wb-shadow) 38%, transparent);
  --wb-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --site-width: 72rem;
  --read-width: 46rem;
  font-family: var(--wb-font-ui);
  font-size: 100%;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  accent-color: var(--wb-accent);
  caret-color: var(--wb-accent);
  scrollbar-color: var(--wb-line-strong) var(--wb-desk);
}

::selection {
  background: var(--wb-accent-soft);
  color: var(--wb-ink);
}

html,
body {
  margin: 0;
  background: var(--wb-desk);
  color: var(--wb-ink);
}

body {
  font-size: 1.125rem;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 700;
  text-wrap: balance;
  overflow-wrap: break-word;
}

h1 {
  font-size: clamp(1.875rem, 1.3rem + 2.4vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.5rem;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 1.25rem;
  line-height: 1.25;
}

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

ul,
ol {
  margin: 0;
}

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

a {
  color: inherit;
  text-decoration-color: var(--wb-accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}

@media (hover: hover) {
  a:hover {
    text-decoration-color: currentColor;
  }
}

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

main:focus {
  outline: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.soft {
  color: var(--wb-ink-soft);
}

.fine {
  font-size: 1rem;
}

[hidden] {
  display: none !important;
}

/* Header: flat on the desk, as in the app. */
.skip-link {
  position: absolute;
  left: var(--wb-gutter-l);
  top: 0.5rem;
  z-index: 20;
  padding: 0.75rem 1.25rem;
  border-radius: var(--wb-radius-pill);
  background: var(--wb-ink);
  color: var(--wb-paper);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: none;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: max(0.5rem, env(safe-area-inset-top)) var(--wb-gutter-r) 0.5rem var(--wb-gutter-l);
  border-bottom: 1px solid var(--wb-line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: var(--wb-touch);
  padding: 0 0.25rem;
  margin-left: -0.25rem;
  border-radius: 10px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--wb-ink);
  text-decoration: none;
}

/* The mark before the word, as in the app's header (brand.css): a 3rem square, its empty margins tucked in. */
.wordmark {
  gap: 0.3rem;
}

.mark,
.spot {
  display: block;
  flex: none;
  overflow: visible;
}

.wordmark .mark {
  width: 3rem;
  height: 3rem;
  margin: -0.5rem 0 -0.25rem -0.3rem;
}

/* Spots are drawn in faded ink, at the app's size. */
.spot {
  height: 5.25rem;
  width: auto;
  color: var(--wb-ink-soft);
}

.header-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* On a phone the landing page's own Aanmelden is in view under the title, so the header stays one row (as the app's welcome). */
@media (max-width: 29.99rem) {
  .home .header-action {
    display: none;
  }
}

/* Theme switcher: three native radios, as ThemeSwitcher.tsx. */
.theme-switch {
  display: inline-flex;
  margin: 0;
  padding: 2px;
  gap: 2px;
  min-width: 0;
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-pill);
}

.theme-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: max(var(--wb-touch-min), 2rem);
  min-height: max(var(--wb-touch-min), 2rem);
  border-radius: var(--wb-radius-pill);
  font-size: 1rem;
  cursor: pointer;
}

.theme-option:has(input:checked) {
  background: var(--wb-accent);
  color: var(--wb-accent-ink);
}

.theme-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.theme-option:has(input:focus-visible) {
  outline: 3px solid var(--wb-focus);
  outline-offset: 3px;
}

.swatch {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, currentColor 55%, transparent);
}

.theme-name {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 40rem) {
  .theme-option {
    padding: 0 1rem 0 0.75rem;
  }

  .theme-name {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
}

/* Buttons: pills, 48px, bold labels. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: var(--wb-touch);
  padding: 0 1.25rem;
  border: 1px solid var(--wb-line-strong);
  border-radius: var(--wb-radius-pill);
  background: var(--wb-paper);
  color: var(--wb-ink);
  font: inherit;
  font-weight: 700;
  text-align: center;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    transform 0.15s var(--wb-ease-out);
}

.button:active {
  transform: scale(0.97);
}

.button.primary {
  background: var(--wb-accent);
  border-color: var(--wb-accent);
  color: var(--wb-accent-ink);
}

.button.big {
  min-height: 56px;
  padding: 0 2rem;
  font-size: 1.25rem;
}

@media (hover: hover) {
  .button:hover,
  .theme-option:hover:not(:has(input:checked)) {
    background: var(--wb-accent-soft);
  }

  .button.primary:hover {
    background: color-mix(in srgb, var(--wb-accent) 86%, var(--wb-ink));
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Main column */
main {
  flex: 1;
  display: grid;
  gap: clamp(3.5rem, 8vw, 6rem);
  width: min(100%, var(--site-width));
  margin: 0 auto;
  padding: clamp(1.5rem, 5vw, 3.5rem) var(--wb-gutter-r) clamp(3rem, 8vw, 5rem) var(--wb-gutter-l);
}

.sheet {
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-card);
  box-shadow: var(--wb-shadow-paper);
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.spine-label {
  display: inline-block;
  padding: 0.25rem 0.875rem;
  border-radius: 0.875rem;
  background: var(--wb-accent-soft);
  color: var(--wb-ink);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.4;
  white-space: nowrap;
}

/* ——— Landing page ——— */

/* The hero: the promise and the two ways in beside a real capture of a page turning. */
.hero {
  display: grid;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
}

.hero-copy {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
}

.hero h1 {
  font-size: clamp(2.25rem, 1.4rem + 3.2vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  max-width: 14ch;
}

.hero-lede p {
  max-width: 36ch;
  font-size: 1.25rem;
  line-height: 1.45;
}

.hero-copy .actions {
  margin-top: 0.25rem;
}

.hero-demo {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

/* The capture and its pause button; the button stays outside the frame's mask. */
.demo-stage {
  position: relative;
  margin-inline: -0.5rem;
}

/* The capture already lies on this desk; its edges fade into the page so the two desks meet without a seam. */
.demo-frame {
  -webkit-mask-image: linear-gradient(to right, transparent, currentColor 3%, currentColor 97%, transparent),
    linear-gradient(to bottom, transparent, currentColor 1.5%, currentColor 98.5%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, currentColor 3%, currentColor 97%, transparent),
    linear-gradient(to bottom, transparent, currentColor 1.5%, currentColor 98.5%, transparent);
  mask-composite: intersect;
}

/* One capture per theme; only the one of the theme on screen shows (and loads). */
.demo-theme {
  display: none;
  position: relative;
}

:root[data-theme='sepia'] .demo-sepia,
:root[data-theme='papier'] .demo-papier,
:root[data-theme='donker'] .demo-donker {
  display: block;
}

.demo-still {
  display: block;
  width: 100%;
}

/* The loop lies over its still and fades in once it plays (site.js); never under reduced motion. */
.demo-loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 0.45s var(--wb-ease-out);
}

.demo-loop.is-playing {
  opacity: 1;
}

/* Pause and play (site.js, WCAG 2.2.2): a round secondary button on the corner of the right page. */
.demo-toggle {
  position: absolute;
  right: 6%;
  bottom: 7%;
  width: var(--wb-touch);
  height: var(--wb-touch);
  padding: 0;
  box-shadow: var(--wb-shadow-paper);
}

.demo-toggle[hidden] {
  display: none;
}

.demo-toggle .icon {
  width: 1.5rem;
  height: 1.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.demo-toggle[data-state='playing'] .demo-play,
.demo-toggle[data-state='paused'] .demo-pause {
  display: none;
}

.hero-demo figcaption {
  padding-inline: 0.25rem;
  text-align: center;
}

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

  .demo-stage {
    margin-inline: 0 -1rem;
  }
}

/* A band: a heading and its text, with what proves it next to or under it. */
.band {
  display: grid;
  gap: 1.75rem;
}

.band-copy {
  display: grid;
  gap: 1rem;
  max-width: 40rem;
}

.band-copy p {
  max-width: 62ch;
}

/* The three colours of the page, as the reader shows them. */
.theme-pages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.theme-pages li {
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  font-weight: 700;
}

.theme-pages img {
  display: block;
  width: 100%;
  border-radius: 10px;
  box-shadow: var(--wb-shadow-paper);
}

@media (min-width: 56rem) {
  .feel {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
  }
}

/* Levels: which levels have books, then the originals on a shelf (as the library's shelf). */
.level-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.level-counts li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.shelf {
  --cover-h: clamp(6.5rem, 4.5rem + 8vw, 10rem);
  --shelf-gap: clamp(1rem, 3vw, 1.75rem);
  --plank: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  column-gap: var(--shelf-gap);
  row-gap: 1.75rem;
  margin: 0;
  padding: 0.75rem calc(var(--shelf-gap) / 2) 0;
  list-style: none;
  overflow-x: clip;
}

.shelf::after {
  content: '';
  flex: 999 1 0;
}

.book {
  --slot-min: 9.125rem;
  flex: 1 1 min(100%, max(var(--slot-min), min(calc(var(--cover-h) * var(--ratio)), calc((100% - var(--shelf-gap)) / 2 - 1px))));
  min-width: 0;
}

.book-link {
  display: grid;
  height: 100%;
  align-content: start;
  border-radius: 12px;
  color: var(--wb-ink);
  text-decoration: none;
}

.book-stand {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: var(--cover-h);
}

.book-stand::after {
  content: '';
  position: absolute;
  top: 100%;
  left: calc(var(--shelf-gap) / -2);
  right: calc(var(--shelf-gap) / -2);
  height: var(--plank);
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--wb-paper) 55%, var(--wb-line)) 0 0.25rem,
    var(--wb-line) 0.25rem calc(100% - 1px),
    color-mix(in srgb, var(--wb-line-strong) 45%, var(--wb-line)) calc(100% - 1px)
  );
  box-shadow: 0 10px 14px -10px color-mix(in srgb, var(--wb-shadow) 45%, transparent);
}

.book:last-child .book-stand::after {
  right: -100vw;
}

.book-face {
  --board: var(--wb-paper);
  position: relative;
  display: block;
  width: min(100%, calc(var(--cover-h) * var(--ratio)));
  aspect-ratio: var(--ratio);
  border-radius: 3px 7px 7px 3px;
  background: var(--board);
  isolation: isolate;
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--wb-shadow) 18%, transparent),
    0 8px 16px -10px color-mix(in srgb, var(--wb-shadow) 50%, transparent);
  transition:
    transform 0.2s var(--wb-ease-out),
    box-shadow 0.2s var(--wb-ease-out);
}

.book-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
  mix-blend-mode: multiply;
}

.book-face::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--wb-shadow) 22%, transparent),
    transparent 4%,
    color-mix(in srgb, var(--wb-shadow) 10%, transparent) 5.5%,
    transparent 8%
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--wb-shadow) 12%, transparent);
  pointer-events: none;
}

:root[data-theme='donker'] .book-face {
  --board: color-mix(in srgb, var(--wb-ink) 84%, var(--wb-paper));
}

.book-caption {
  display: grid;
  justify-items: center;
  gap: 0.375rem;
  margin-top: calc(var(--plank) + 0.75rem);
  text-align: center;
}

.book-title {
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.spine-label.book-level {
  padding: 0.125rem 0.625rem;
  font-size: 0.9375rem;
}

@media (hover: hover) {
  .book-link:hover .book-face {
    transform: translateY(-3px);
    box-shadow:
      0 2px 4px color-mix(in srgb, var(--wb-shadow) 18%, transparent),
      0 16px 24px -12px color-mix(in srgb, var(--wb-shadow) 55%, transparent);
  }
}

.book-link:active .book-face {
  transform: scale(0.97);
}

/* How it works: the welcome spread of the app, one page in portrait, two from 56rem. */
.spread {
  --spine-edge: 7%;
  --spine-fold: 16%;
  display: grid;
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-card);
  box-shadow: var(--wb-shadow-paper);
}

.spread-page {
  display: grid;
  align-content: start;
  gap: 1.25rem;
  padding: clamp(1.5rem, 5vw, 2.75rem);
}

.spread-page + .spread-page {
  border-top: 1px solid var(--wb-line);
}

.spread-page p {
  max-width: 60ch;
}

@media (min-width: 56rem) {
  .spread {
    grid-template-columns: 1fr 1fr;
    background:
      linear-gradient(
        to right,
        transparent calc(50% - 2.5rem),
        color-mix(in srgb, var(--wb-shadow) var(--spine-edge), transparent) calc(50% - 0.25rem),
        color-mix(in srgb, var(--wb-shadow) var(--spine-fold), transparent) 50%,
        color-mix(in srgb, var(--wb-shadow) var(--spine-edge), transparent) calc(50% + 0.25rem),
        transparent calc(50% + 2.5rem)
      ),
      var(--wb-paper);
  }

  :root[data-theme='donker'] .spread {
    --spine-edge: 25%;
    --spine-fold: 50%;
  }

  :root[data-theme='donker'] .spread-page + .spread-page {
    box-shadow: inset 1px 0 0 color-mix(in srgb, var(--wb-ink) 10%, transparent);
  }

  .spread-page {
    padding: clamp(2.5rem, 5vw, 4rem);
  }

  .spread-page + .spread-page {
    border-top: 0;
  }
}

/* The numbered steps on accent-soft discs. */
.steps ol {
  display: grid;
  gap: 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  column-gap: 1rem;
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--wb-accent-soft);
  font-weight: 700;
}

.steps li strong {
  display: block;
}

/* What is stored: a sheet of paper, like a note from the library. */
.privacy {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: var(--read-width);
  justify-self: center;
}

.privacy p {
  max-width: 62ch;
}

.privacy ul,
.prose ul,
.prose ol {
  display: grid;
  gap: 0.5rem;
  padding-left: 1.25rem;
}

.privacy li::marker,
.prose li::marker {
  color: var(--wb-ink-soft);
}

/* Questions: a question in bold, its answer under it. */
.questions {
  max-width: var(--read-width);
  width: 100%;
  justify-self: center;
}

.qa {
  display: grid;
  gap: 0.5rem;
}

.qa h3 {
  margin-top: 1rem;
}

.qa p {
  max-width: 62ch;
}

.qa > p:last-child {
  margin-top: 1rem;
}

.closing {
  display: grid;
  justify-items: center;
  gap: 1.25rem;
  text-align: center;
}

.closing .actions {
  justify-content: center;
}

.closing-line {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  text-wrap: balance;
}

/* ——— Content pages (Read) ——— */
.article {
  display: grid;
  gap: 2.5rem;
  width: 100%;
  max-width: var(--read-width);
  justify-self: center;
}

.trail {
  margin-bottom: -1.5rem;
  color: var(--wb-ink-soft);
}

.trail a {
  color: var(--wb-ink-soft);
}

.article-head {
  display: grid;
  gap: 1rem;
}

.article-lead {
  display: grid;
  gap: 0.75rem;
}

.article-lead p {
  max-width: 38rem;
  font-size: 1.25rem;
  line-height: 1.45;
}

.contents {
  display: grid;
  gap: 0.5rem;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-tile);
}

.contents h2 {
  font-size: 1rem;
  color: var(--wb-ink-soft);
}

.contents ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  padding: 0;
  list-style: none;
}

.contents a {
  display: inline-block;
  padding-block: 0.625rem;
  font-weight: 700;
}

.prose {
  display: grid;
  gap: 1rem;
  scroll-margin-top: 1rem;
}

.prose h2 {
  margin-top: 0.5rem;
}

.prose h3 {
  margin-top: 0.75rem;
  scroll-margin-top: 1rem;
}

.prose p,
.prose li {
  max-width: 65ch;
}

.table-wrap {
  overflow-x: auto;
  margin-block: 0.5rem;
  border-radius: var(--wb-radius-card);
}

.prose-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--wb-paper);
  border: 1px solid var(--wb-line);
  border-radius: var(--wb-radius-card);
  box-shadow: var(--wb-shadow-paper);
  font-size: 1rem;
}

.prose-table th,
.prose-table td {
  padding: 0.75rem 1rem;
  text-align: start;
  vertical-align: top;
}

.prose-table thead th {
  color: var(--wb-ink-soft);
  border-bottom: 1px solid var(--wb-line);
}

.prose-table tbody tr + tr > * {
  border-top: 1px solid var(--wb-line);
}

.prose-table td:first-child {
  font-weight: 700;
}

.prose-table td:not(:first-child, :last-child) {
  white-space: nowrap;
}

/* Below 40rem any other table becomes a list: the first cell on its own line, the rest after it, joined by a dot. */
@media (max-width: 39.99rem) {
  .prose-table:not(.level-table) thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .prose-table:not(.level-table),
  .prose-table:not(.level-table) tbody,
  .prose-table:not(.level-table) tr {
    display: block;
  }

  .prose-table:not(.level-table) tr {
    padding: 0.75rem 1rem;
  }

  .prose-table:not(.level-table) tbody tr + tr {
    border-top: 1px solid var(--wb-line);
  }

  .prose-table:not(.level-table) tbody tr + tr > * {
    border-top: 0;
  }

  .prose-table:not(.level-table) td {
    display: inline;
    padding: 0;
    white-space: normal;
  }

  .prose-table:not(.level-table) td:first-child {
    display: block;
    margin-bottom: 0.125rem;
  }

  .prose-table:not(.level-table) td + td:not(:nth-child(2))::before {
    content: ' · ';
    color: var(--wb-ink-soft);
  }
}

/* The AVI level tables, as in the app's level table. */
.level-table td:first-child {
  white-space: nowrap;
}


.level-table td:nth-child(2) {
  font-weight: 700;
}

/* Below 40rem a row of the level table becomes a block: label and leerjaar on one line, the text under it. */
@media (max-width: 39.99rem) {
  .level-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }

  .level-table,
  .level-table tbody,
  .level-table tr {
    display: block;
  }

  .level-table tr {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.875rem 1rem;
  }

  .level-table tbody tr + tr {
    border-top: 1px solid var(--wb-line);
  }

  .level-table tbody tr + tr > * {
    border-top: 0;
  }

  .level-table td {
    padding: 0;
  }

  .level-table td:nth-child(3) {
    grid-column: 1 / -1;
  }
}

.level-table td:first-child {
  color: var(--wb-ink);
}

.try {
  display: grid;
  gap: 1rem;
  width: 100%;
  max-width: var(--read-width);
  justify-self: center;
}

/* Footer: the pages for parents, flat on the desk. */
.site-footer {
  display: grid;
  gap: 1rem;
  width: min(100%, var(--site-width));
  margin: 0 auto;
  padding: 1.5rem var(--wb-gutter-r) max(2rem, env(safe-area-inset-bottom)) var(--wb-gutter-l);
  border-top: 1px solid var(--wb-line);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.5rem;
  padding: 0;
  list-style: none;
}

.footer-links a {
  display: inline-block;
  padding-block: 0.625rem;
  font-size: 1rem;
  font-weight: 700;
}

.footer-links a[aria-current='page'] {
  text-decoration: none;
  color: var(--wb-ink-soft);
}

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

  .button:active,
  .book-link:active .book-face,
  .book-link:hover .book-face {
    transform: none;
  }
}
