:root {
  --ink: #fff;
  --ink-70: rgba(255, 255, 255, 0.72);
  --ink-45: rgba(255, 255, 255, 0.46);   /* the quiet gray: labels, kickers. 4.5:1 on black */
  --rule: rgba(255, 255, 255, 0.14);
  --serif: "Libre Baskerville", Baskerville, "Times New Roman", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: #000; }
body {
  margin: 0;
  background: #000;
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100svh;
}
p, h1, li { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
a, button { cursor: pointer; }

.page {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 640px) { .page { padding: 0 24px; } }

/* ---------- the first panel: the entry fills the screen, the cue sits on its floor ---------- */
html { scroll-snap-type: y mandatory; }
.panel {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding: 56px 0 22px;
  scroll-snap-align: start;
  scroll-snap-stop: always;
}
.panel .entry { margin: auto 0; }
.rest {
  scroll-snap-align: start;   /* one snap target for everything below; taller than the screen, so scrolling inside it is free */
  padding: 56px 0 48px;
}
@media (min-width: 640px) {
  .panel { padding: 72px 0 28px; }
  .rest { padding: 72px 0 64px; }
}

/* ---------- kicker ---------- */
.top { margin-bottom: 20px; }
.kicker {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--ink-45);
}
@media (min-width: 640px) { .kicker { font-size: 12px; } }

/* ---------- the entry ---------- */
.entry { padding-top: 0; }
.headword {
  margin: 0 0 10px;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(38px, 9vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.01em;
}
.pron {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  margin: 0 0 6px;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 17px;
  color: var(--ink-70);
}
.pos { font-family: var(--serif); font-style: italic; color: var(--ink-70); }
.sep { color: var(--ink-45); }
.ipa { letter-spacing: 0.01em; }
.also {
  margin: 0 0 22px;
  font-size: 14px;
  color: var(--ink-45);
}
.speak {
  appearance: none;
  background: none;
  border: 1px solid var(--rule);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  transition: border-color 200ms ease, transform 200ms ease;
}
.speak svg { width: 20px; height: 20px; }
.speak .horn { fill: currentColor; }
.speak .wave { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; opacity: 0.9; }
.speak:hover, .speak:focus-visible { border-color: var(--ink-70); outline: none; }
.speak:active { transform: scale(0.94); }
.speak.playing .w1 { animation: wave 900ms ease-in-out infinite; }
.speak.playing .w2 { animation: wave 900ms ease-in-out 150ms infinite; }
@keyframes wave { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }

.label {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-45);
  margin-right: 6px;
}
.origin, .related, .example, .note, .history {
  margin: 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--ink-70);
}
.origin { margin-bottom: 26px; }
.related .label:not(:first-child) { margin-left: 8px; }
.note, .history { margin-top: 12px; }
.example { margin-top: 12px; }
.example .label { margin-right: 8px; }
.cites {
  list-style: none;
  margin: 2px 0 0;
  padding: 0;
}
.cites li { margin: 0; }
.pop {
  margin: 8px 0 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-45);
}
@media (min-width: 640px) { .pop { font-size: 12px; } }

.senses {
  list-style: none;
  margin: 0 0 26px;
  padding: 0;
}
.senses li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0 6px;
  margin: 0 0 14px;
  font-size: 18px;
  line-height: 1.6;
}
.senses .num { font-weight: 700; color: var(--ink); }
.senses .num::after { content: ":"; font-weight: 400; color: var(--ink-45); margin-left: 4px; }
.senses .def { color: var(--ink); }
@media (min-width: 640px) {
  .senses li { font-size: 19.5px; }
  .origin, .related, .example, .note, .history { font-size: 16px; }
}

/* ---------- short windows: tighten the entry so the first panel still fits one screen ---------- */
@media (min-width: 640px) and (max-height: 960px) {
  .panel { padding: 40px 0 20px; }
  .headword { font-size: clamp(38px, 7vw, 54px); margin-bottom: 6px; }
  .pron { font-size: 16px; margin-bottom: 4px; }
  .also { margin-bottom: 14px; font-size: 13px; }
  .origin { margin-bottom: 16px; }
  .senses { margin-bottom: 16px; }
  .senses li { font-size: 17.5px; line-height: 1.5; margin-bottom: 9px; }
  .origin, .related, .example, .note, .history { font-size: 15px; line-height: 1.55; }
  .note, .history, .example { margin-top: 8px; }
  .cue { margin-top: 22px; gap: 6px; }
  .cue-arrow { height: 26px; }
}
@media (min-width: 640px) and (max-height: 820px) {
  .panel { padding: 28px 0 16px; }
  .headword { font-size: clamp(36px, 6vw, 46px); }
  .senses li { font-size: 16px; }
  .origin, .related, .example, .note, .history { font-size: 14px; line-height: 1.5; }
}

/* ---------- the scroll cue (the New Blue "SCROLL" hint: 9px tracked caps, an 8px bob over 2.4s, ease; stem swapped for an arrow) ---------- */
.cue {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: max-content;
  margin: 36px auto 0;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 9px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink);
  animation: cue-bob 2.4s ease infinite;
  transition: color 200ms ease;
}
.cue:hover, .cue:focus-visible { color: var(--ink-70); outline: none; }
.cue-text { padding-left: 0.4em; }   /* balances the trailing letter-spacing so the word sits centred over the arrow */
.cue-arrow { width: 18px; height: 34px; }
.cue-arrow path { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
@keyframes cue-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 8px; }
}
html { scroll-behavior: smooth; }

/* ---------- renderings ---------- */
.gallery {
  margin-top: 0;
  border-top: 1px solid var(--rule);
  padding-top: 36px;
  display: grid;
  gap: 36px;
}
.gallery figure { margin: 0; }
.gallery img {
  display: block;
  width: 100%;
  height: auto;
  background: #000;
}
.gallery figcaption {
  margin-top: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink-45);
}
.gallery figcaption .num {
  font-family: var(--sans);
  font-style: normal;
  font-size: 10px;
  letter-spacing: 0.3em;
  margin-right: 10px;
}
.gallery .open {
  appearance: none;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.gallery .open:focus-visible { outline: 1px solid var(--ink-70); outline-offset: 4px; }

/* ---------- the lightbox ---------- */
.box {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  touch-action: pan-y;
}
.box[hidden] { display: none; }
.box-img {
  max-width: 100%;
  max-height: calc(100svh - 80px);
  width: auto;
  height: auto;
  object-fit: contain;
}
.box-cap {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-45);
  text-align: center;
}
.box-close, .box-prev, .box-next {
  appearance: none;
  position: absolute;
  background: none;
  border: 0;
  color: var(--ink-70);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1;
  padding: 12px 16px;
  transition: color 200ms ease;
}
.box-close:hover, .box-prev:hover, .box-next:hover,
.box-close:focus-visible, .box-prev:focus-visible, .box-next:focus-visible { color: var(--ink); outline: none; }
.box-close { top: 8px; right: 8px; font-size: 32px; }
.box-prev, .box-next { top: 50%; transform: translateY(-50%); font-size: 44px; }
.box-prev { left: 4px; }
.box-next { right: 4px; }
body.boxed { overflow: hidden; }
@media (max-width: 639px) { .box-prev, .box-next { display: none; } }   /* phones swipe */

/* ---------- footer ---------- */
.foot {
  margin-top: 64px;
  font-family: var(--sans);
  font-weight: 300;
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-45);
}

@media (prefers-reduced-motion: reduce) {
  .speak.playing .w1, .speak.playing .w2 { animation: none; opacity: 1; }
  .speak { transition: none; }
  .cue { animation: none; }
  html { scroll-behavior: auto; scroll-snap-type: none; }
}
