:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --ink: #272432;
  --muted: #5b5568;
  --lilac: #e6dff1;
  --lilac-soft: #efeaf5;
  --plum: #4d376b;
  --plum-deep: #37264e;
  --sage: #e4eddc;
  --sage-ink: #33482b;
  --sand: #f1e6cd;
  --sand-ink: #554528;
  --white: #fffefa;
  --line: #d6d1db;
  --dock: #292432;
  --dock-active: #ded3ed;
  --focus: #674794;
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono-font: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --body-size: 1.125rem;
  --label-size: 1rem;
  --measure: 66ch;
  --wide: 1264px;
  --reading: 800px;
  --space-xs: .5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-xxl: 4.5rem;
  --round-small: 16px;
  --round: 28px;
  --round-large: 48px;
  --pill: 999px;
  --gutter: clamp(20px, 4vw, 64px);
  --dock-shadow: 0 6px 28px #29243230;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-padding-bottom: 120px; }
body {
  margin: 0;
  padding: 0 var(--gutter) calc(128px + env(safe-area-inset-bottom));
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body-font);
  font-size: var(--body-size);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}
body > header, main, body > footer { max-width: var(--wide); margin-inline: auto; }
body > header {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}
body > header > a {
  display: inline-flex;
  gap: .8rem;
  align-items: center;
  text-decoration: none;
  font-weight: 650;
  padding-block: var(--space-xs);
}
body > header > a > span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--ink);
  border-radius: 50% 50% 50% 10%;
  font-family: var(--mono-font);
  font-size: 1.5rem;
  font-weight: 400;
}
body > header > p {
  font-family: var(--mono-font);
  font-size: var(--label-size);
  line-height: 1.5;
  color: var(--muted);
  margin: 0;
}
a { color: var(--plum); text-underline-offset: .25em; }
a, button, input { -webkit-tap-highlight-color: transparent; }
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 5px;
}
a:hover { color: var(--plum-deep); }
p { margin: 0 0 var(--space-md); max-width: var(--measure); }
h1, h2, h3 { margin: 0; line-height: 1.12; letter-spacing: -.035em; overflow-wrap: break-word; }
h1 { font-size: clamp(2.5rem, 5.6vw, 4.75rem); font-weight: 560; max-width: 20ch; }
h2 { font-size: clamp(1.75rem, 3.2vw, 2.5rem); font-weight: 560; max-width: 28ch; }
h3 { font-size: 1.3rem; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; }
ul { padding-left: 1.25rem; margin: var(--space-sm) 0 var(--space-md); }
li { padding-left: .15rem; margin-block: var(--space-xs); }
[hidden] { display: none !important; }
[data-kicker] { font-family: var(--mono-font); font-size: var(--label-size); line-height: 1.5; margin-bottom: var(--space-md); color: var(--muted); }
[data-skip] { position: fixed; left: var(--gutter); top: -150px; z-index: 20; min-height: 48px; padding: var(--space-sm); background: var(--ink); color: var(--white); border-radius: var(--round-small); }
[data-skip]:focus { top: 16px; }
[data-action] {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  min-height: 56px;
  margin-top: var(--space-sm);
  padding: .85rem 1.5rem;
  border-radius: var(--pill);
  background: var(--plum);
  color: var(--white);
  text-decoration: none;
  font-size: var(--body-size);
  font-weight: 550;
}
[data-action]:hover { color: var(--white); background: var(--plum-deep); }
[data-action="secondary"] { background: var(--lilac); color: var(--ink); }
figure { margin: 0; min-width: 0; }
figure img { display: block; width: 100%; height: auto; background: var(--sage); object-fit: cover; color: var(--sage-ink); font-size: 1rem; }
figcaption { font-family: var(--mono-font); font-size: var(--label-size); color: var(--muted); line-height: 1.5; padding-top: var(--space-sm); }

#opening {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, .8fr);
  gap: var(--space-lg);
  padding: clamp(28px, 4vw, 56px);
  border-radius: var(--round-large);
  background: var(--lilac);
  align-items: center;
}
#opening > div { padding-block: var(--space-sm); }
#opening h1 { font-size: clamp(2.6rem, 5.1vw, 4.65rem); max-width: 17ch; margin-bottom: var(--space-lg); }
#opening h1 > span { color: var(--plum); }
#opening > div > p:not([data-kicker]) { max-width: 42ch; font-size: 1.2rem; line-height: 1.6; }
#opening figure { align-self: stretch; display: flex; flex-direction: column; justify-content: center; }
#opening img { border-radius: var(--pill) var(--pill) var(--round) var(--round); aspect-ratio: 5 / 6; }
#opening figcaption { color: var(--plum); }
#starting { padding-block: var(--space-xl) var(--space-xxl); }
#starting h2 { font-size: 1.6rem; margin-bottom: var(--space-md); }
#starting > div { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
#starting a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-xs) var(--space-sm);
  background: var(--sage);
  color: var(--sage-ink);
  padding: var(--space-md);
  border-radius: var(--round);
  text-decoration: none;
  min-height: 130px;
}
#starting a > span:first-child { font-family: var(--mono-font); font-size: var(--label-size); }
#starting strong { font-size: 1.25rem; font-weight: 570; grid-row: 2; }
#starting a > span:last-child { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 1.5rem; }
#starting a:hover { background: #d7e5cd; }
#questions > section { display: grid; grid-template-columns: minmax(0, .65fr) minmax(0, 1.35fr); gap: var(--space-xl); padding-block: var(--space-xl); border-top: 1px solid var(--line); }
#questions > section > header { padding-top: var(--space-sm); }
#questions h2 { max-width: 16ch; }
#questions ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
#questions li { margin: 0; padding: 0; min-width: 0; }
#questions li:last-child:nth-child(odd) { grid-column: 1 / -1; }
#questions li a { position: relative; display: flex; flex-direction: column; justify-content: flex-start; height: 100%; min-height: 192px; padding: var(--space-md) calc(var(--space-md) + 24px) var(--space-md) var(--space-md); background: var(--white); border: 1px solid var(--line); border-radius: var(--round); color: var(--ink); text-decoration: none; }
#questions li a:hover { background: var(--lilac-soft); border-color: #a996bc; }
#questions h3 { margin-bottom: var(--space-sm); max-width: 26ch; }
#questions li p { color: var(--muted); font-size: var(--body-size); line-height: 1.5; margin: 0; max-width: 37ch; }
#questions li a > span { position: absolute; right: 20px; top: 20px; color: var(--plum); font-size: 1.35rem; }

article { max-width: var(--reading); margin-inline: auto; }
article > header { padding: var(--space-xl) 0 var(--space-lg); }
article > header h1 { margin-bottom: var(--space-lg); }
article > header > p:last-child { font-size: 1.3rem; line-height: 1.6; max-width: 52ch; color: var(--muted); margin: 0; }
[data-answer] { background: var(--lilac); border-radius: var(--round-large) var(--round-large) var(--round-large) var(--round-small); padding: var(--space-lg); margin-block: var(--space-md) var(--space-xl); }
[data-answer] > p:first-child { font-family: var(--mono-font); font-size: var(--label-size); color: var(--plum); margin-bottom: var(--space-sm); }
[data-answer] > p:last-child { font-size: 1.3rem; line-height: 1.55; margin-bottom: 0; }
article > section:not([data-recap]) { margin-top: var(--space-xxl); }
article > section > h2 { margin-bottom: var(--space-md); }
article > figure { margin-block: var(--space-xl); }
article > figure > img { border-radius: var(--round-large); aspect-ratio: 5 / 3; }
[data-ask] { margin-top: var(--space-lg); border-top: 1px solid var(--line); padding-top: var(--space-md); }
[data-ask] > p { font-family: var(--mono-font); font-size: var(--label-size); font-weight: 500; line-height: 1.35; margin: 0; color: var(--plum); }
[data-ask] ul { list-style: none; padding: 0; }
[data-ask] li { padding-left: var(--space-md); position: relative; max-width: var(--measure); }
[data-ask] li::before { content: "›"; position: absolute; left: 0; color: var(--plum); }
[data-recap] { margin-block: var(--space-xxl) var(--space-lg); padding: var(--space-xl); background: var(--sage); color: var(--sage-ink); border-radius: var(--round-large); }
[data-recap] > p:first-child { font-family: var(--mono-font); font-size: var(--label-size); margin-bottom: var(--space-sm); }
[data-recap] h2 { margin-bottom: var(--space-md); }
[data-recap] > p:last-child { margin: 0; }
[data-next] { padding-block: var(--space-md); }
[data-next] > p { font-family: var(--mono-font); font-size: var(--label-size); color: var(--muted); margin-bottom: var(--space-xs); }
[data-next] a { display: flex; gap: var(--space-md); justify-content: space-between; align-items: center; min-height: 64px; padding-block: var(--space-sm); text-decoration: none; border-bottom: 1px solid var(--line); font-size: 1.4rem; line-height: 1.45; font-weight: 550; }
[data-next] a > span { flex: 0 0 auto; }

body > footer { padding-top: var(--space-xl); border-top: 1px solid var(--line); margin-top: var(--space-xl); display: flex; justify-content: space-between; gap: var(--space-xl); }
body > footer > p { font-size: var(--label-size); line-height: 1.7; max-width: 39ch; color: var(--muted); margin-bottom: 0; }
body > footer > div { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--space-sm); }
body > footer a { display: inline-flex; align-items: center; gap: var(--space-sm); padding: var(--space-xs) var(--space-sm); min-height: 48px; font-size: var(--label-size); line-height: 1.5; text-decoration: none; border: 1px solid var(--line); border-radius: var(--pill); }
body > footer a:hover { background: var(--lilac); }
body > nav {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(560px, calc(100% - 28px));
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  background: var(--dock);
  padding: 7px;
  border-radius: var(--pill);
  box-shadow: var(--dock-shadow);
  z-index: 10;
}
body > nav > a { display: flex; justify-content: center; align-items: center; min-height: 52px; text-align: center; font-size: var(--label-size); font-weight: 500; line-height: 1.25; text-decoration: none; color: var(--white); padding: .65rem .25rem; border-radius: var(--pill); }
body > nav > a:hover { background: #40364e; }
body > nav > a[aria-current="page"] { background: var(--dock-active); color: var(--ink); }
body > nav > a:focus-visible { outline-color: var(--dock-active); outline-offset: 1px; }

#word-filter { background: var(--lilac); padding: var(--space-lg); border-radius: var(--round); margin-bottom: var(--space-xl); }
#word-filter label { display: block; font-family: var(--mono-font); font-size: var(--label-size); margin-bottom: var(--space-sm); }
#word-filter > div { display: flex; gap: var(--space-sm); }
input, button { font: inherit; min-height: 52px; border-radius: var(--pill); }
input { width: 100%; min-width: 0; padding: .8rem 1.2rem; border: 1px solid #8e809e; background: var(--white); color: var(--ink); font-size: var(--label-size); }
input::placeholder { color: var(--muted); opacity: 1; }
button { padding: .8rem 1.2rem; background: var(--plum); color: var(--white); border: 0; flex: 0 0 auto; cursor: pointer; font-size: var(--label-size); }
button:hover { background: var(--plum-deep); }
button:disabled { cursor: default; }
#filter-status { font-size: var(--label-size); margin: var(--space-sm) 0 0; line-height: 1.5; }
dl { margin: 0; }
#terms > div { padding: var(--space-md) 0; display: grid; grid-template-columns: minmax(0, .7fr) minmax(0, 1.3fr); gap: var(--space-lg); border-top: 1px solid var(--line); }
dt { font-family: var(--mono-font); font-size: var(--body-size); color: var(--plum); font-weight: 500; line-height: 1.5; }
dd { margin: 0; font-size: var(--body-size); max-width: var(--measure); }
[data-source-index] { display: flex; flex-wrap: wrap; gap: var(--space-xs); margin-block: var(--space-md) var(--space-xl); }
[data-source-index] a { display: inline-flex; align-items: center; padding: .7rem 1rem; min-height: 48px; font-size: var(--label-size); background: var(--lilac); border-radius: var(--pill); text-decoration: none; }
[data-sources] { padding: 0; list-style: none; }
[data-sources] li { padding: var(--space-sm) 0 var(--space-md); border-bottom: 1px solid var(--line); }
[data-sources] a { min-height: 48px; display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); font-size: var(--body-size); line-height: 1.5; padding-block: var(--space-xs); }
[data-sources] p { color: var(--muted); margin: var(--space-xs) 0 0; font-size: var(--body-size); }

@media (max-width: 900px) {
  #opening { gap: var(--space-md); }
  #opening h1 { font-size: 3.25rem; }
  #questions > section { grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); }
  #questions h2 { max-width: 25ch; }
  body > footer { flex-direction: column; gap: var(--space-md); }
}
@media (max-width: 620px) {
  :root { --space-xxl: 3rem; --round-large: 32px; }
  body > header { min-height: 94px; }
  body > header > a { font-size: 1.05rem; gap: .6rem; }
  body > header > p { max-width: 11ch; text-align: right; }
  #opening { grid-template-columns: minmax(0, 1fr); padding: var(--space-md); }
  #opening h1 { font-size: clamp(2.45rem, 9vw, 3.5rem); max-width: 17ch; }
  #opening > div > p:not([data-kicker]) { font-size: var(--body-size); }
  #opening figure { margin-top: var(--space-sm); }
  #opening img { aspect-ratio: 5 / 4; max-height: 320px; border-radius: 80px 80px var(--round) var(--round); }
  #opening figcaption { max-width: 26ch; }
  [data-action] { gap: var(--space-sm); width: 100%; padding-inline: 1.1rem; }
  #starting > div { grid-template-columns: minmax(0, 1fr); }
  #starting a { min-height: 108px; }
  #starting { padding-block: var(--space-xl); }
  #questions ul { grid-template-columns: minmax(0, 1fr); }
  #questions li a { min-height: 156px; }
  article > header { padding-top: var(--space-md); }
  article > header > p:last-child { font-size: 1.2rem; }
  [data-answer] { padding: var(--space-md); }
  [data-answer] > p:last-child { font-size: 1.2rem; }
  [data-recap] { padding: var(--space-md); }
  [data-next] a { font-size: 1.25rem; }
  #word-filter { padding: var(--space-md); }
  #word-filter > div { flex-direction: column; gap: var(--space-sm); }
  #word-filter button { align-self: flex-start; }
  #terms > div { grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); }
  body > footer > div { gap: var(--space-xs); }
  body > footer a { padding-inline: .85rem; }
}
@media (prefers-reduced-motion: no-preference) {
  a, button { transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease; }
}
@media print {
  body { padding: 0; background: white; color: black; }
  body > nav, [data-skip], #word-filter, [data-action], [data-next] { display: none; }
  article { max-width: none; }
  [data-recap], [data-answer] { break-inside: avoid; }
  a { color: black; }
}
