/* ==========================================================================
   Jarana Spanish — Concept 2 theme (warm cream, terracotta, gold). Live from
   17 Oct 2026, replacing the Chicha look at the owner's request.
   Loaded on every page AFTER /_astro/index.*.css and /site-extra.css. It
   redefines the existing tokens and restyles existing classes, plus the .c2-*
   classes added by scripts/r53/concept2.py.

   Colours (WCAG 2.1 AA, measured 17 Oct 2026): terracotta text/buttons
   #A8432F (5.47:1 on cream, white on it 5.98:1). The brief's #C45C4A fails as
   text (3.85:1) and is used only for decoration. Gold #C9A24A is decoration
   only (2.19:1); gold text uses #8A6514 (4.85:1).
   Fonts: Lora (SIL OFL, /fonts/Lora-OFL.txt) self-hosted, because the CSP has
   no font-src for Google Fonts. Subset to Latin + Latin Extended-A.
   Photos: every photo slot stays hidden until its file is listed in
   /images/photos/photos.json (see photo-slots.js). No placeholder boxes.
   ========================================================================== */

@font-face {
  font-family: "Lora C2"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/lora-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Lora C2"; font-style: normal; font-weight: 600 700; font-display: swap;
  src: url("/fonts/lora-bold.woff2") format("woff2");
}

/* ---------- Tokens: light (the default the site stamps) ------------------ */
:root,
:root[data-theme=light] {
  color-scheme: light;
  --paper: #f8f4ef;
  --ink: #2a1d17;
  --ink-2: #6a5a50;
  --rule: #e6dccf;
  --accent: #a8432f;        /* AA terracotta for text, links, buttons */
  --accent-ink: #ffffff;
  --terracotta-deco: #c45c4a; /* brief value: decoration only */
  --gold: #c9a24a;           /* decoration only */
  --gold-ink: #8a6514;       /* gold when it must be read */
  --teal: #2f6b66;
  --amarillo: #8a6514;
  --answer-bg: #f1e8dc;
  --field-rule: #8f7e70;
  --card: #fffaf3;
  --r: 12px;
  --bad: #9b1c31;            /* wrong-answer crimson, distinct from terracotta */
  --bad-ink: #fdf1ee;
  --f-head: "Lora C2", "Lora", Georgia, "Times New Roman", serif;
  --f-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-ui: var(--f-body);
  --measure: 64ch;
}

/* ---------- Tokens: dark (warm night, not black) ------------------------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) {
    color-scheme: dark;
    --paper: #1e1713; --ink: #f3eae0; --ink-2: #bfae9f; --rule: #3a2e27;
    --accent: #e58a72; --accent-ink: #1e1713; --terracotta-deco: #e58a72;
    --gold: #d9b25a; --gold-ink: #d9b25a; --teal: #7cc2b9; --amarillo: #d9b25a;
    --answer-bg: #281f1a; --field-rule: #8c7b6e; --card: #261d18;
    --bad: #ff8a9c; --bad-ink: #2a0d13;
  }
}
:root[data-theme=dark] {
  color-scheme: dark;
  --paper: #1e1713; --ink: #f3eae0; --ink-2: #bfae9f; --rule: #3a2e27;
  --accent: #e58a72; --accent-ink: #1e1713; --terracotta-deco: #e58a72;
  --gold: #d9b25a; --gold-ink: #d9b25a; --teal: #7cc2b9; --amarillo: #d9b25a;
  --answer-bg: #281f1a; --field-rule: #8c7b6e; --card: #261d18;
    --bad: #ff8a9c; --bad-ink: #2a0d13;
}

/* ---------- Type and rhythm --------------------------------------------- */
body { font-family: var(--f-body); font-size: 18px; line-height: 1.75; }
h1, h2, h3, details.lesson-section > summary {
  font-family: var(--f-head); font-weight: 600; letter-spacing: -.01em; line-height: 1.18;
}
h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); }
h2 { font-size: 1.6rem; margin: 72px 0 14px; }
h3 { font-size: 1.15rem; }
main { padding-block: 8px 112px; }
p { margin: 0 0 18px; }

/* ---------- Header / footer --------------------------------------------- */
header.site { border-bottom: 1px solid var(--gold); padding-block: 20px 14px; }
header.site .brand { font-family: var(--f-head); font-size: 1.15rem; letter-spacing: 0; }
header.site .brand:after { background: var(--terracotta-deco); }
header.site nav a.nav-cta {
  color: var(--accent-ink); background: var(--accent); padding: 4px 12px; border-radius: 99px;
}
header.site nav a.nav-cta:hover, header.site nav a.nav-cta:focus-visible { color: var(--accent-ink); background: var(--ink); text-decoration: none; }
footer.site { border-top: 1px solid var(--gold); }

/* ---------- Buttons: soft, rounded -------------------------------------- */
a.cta { border-radius: 99px; padding: 13px 24px; background: var(--accent); color: var(--accent-ink); }
a.cta:hover, a.cta:focus-visible { background: var(--ink); color: var(--paper); }
a.cta.cta-secondary, html a.cta.cta-secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); }
a.cta.cta-secondary:hover, html a.cta.cta-secondary:hover { background: var(--answer-bg); }
.theme button:first-child { border-radius: 99px 0 0 99px; }
.theme button:last-child { border-radius: 0 99px 99px 0; }
.opt, .quiz-again, .yapa-poster, .dl-toggle, .lt-email input { border-radius: var(--r); }
a.chip, span.chip { border-radius: 99px; }

/* ---------- Homepage hero: from black box to warm gathering -------------- */
.hero {
  background: var(--card); color: var(--ink); border-left: 0;
  border: 1px solid var(--rule); border-radius: 20px; padding: 28px 24px 22px;
}
.hero h1 { color: var(--ink); }
.hero h1 .hl { color: var(--accent); }
.hero p { color: var(--ink); }
.hero .find-level-m { color: var(--ink-2); }
.hero a.cta { background: var(--accent); color: var(--accent-ink); }
.hero a.cta.cta-secondary, html .hero a.cta.cta-secondary { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); }
.hero a:not(.cta):not(.c2-listen) { color: var(--accent); }
.hero a.c2-listen { color: var(--ink); }

/* ---------- Paths become scenario cards --------------------------------- */
.paths { gap: 18px; }
.path {
  border-top: 0; background: var(--card); border: 1px solid var(--rule);
  border-radius: 16px; padding: 0 0 14px; overflow: hidden;
}
.path > :not(.c2-photo) { margin-inline: 16px; }
.path h3 { font-family: var(--f-head); font-size: 1.1rem; margin-top: 12px; }

/* ---------- Content blocks ---------------------------------------------- */
.answer { border-left: 3px solid var(--gold); border-radius: 0 var(--r) var(--r) 0; }
.cta-block { border-top: 2px solid var(--gold); }
.quiz { border-top: 2px solid var(--gold); }
.unit h3 { border-bottom-color: var(--gold); }
.unverified { border-left-color: var(--gold); }
.packs { background: var(--card); border-radius: var(--r); }
.exam-text { border-radius: var(--r); }

/* ---------- Photo slots (filled by photo-slots.js) ---------------------- */
[data-photo] { display: none; margin: 0; }
[data-photo].has-photo { display: block; }
[data-photo] img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: 16px; }
.c2-photo { aspect-ratio: 4 / 5; }
.c2-photo.wide { aspect-ratio: 16 / 9; margin: 8px 0 28px; }
.c2-photo.card { aspect-ratio: 16 / 10; }
.c2-photo.card img { border-radius: 0; }
.c2-hero-grid { display: grid; gap: 22px; align-items: center; }
@media (min-width: 860px) { .c2-hero-grid.with-photo { grid-template-columns: 1.25fr .9fr; } }
.c2-hero-grid .c2-photo img { border-radius: 16px; }

/* ---------- Listen button ------------------------------------------------ */
.c2-listen {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  font-weight: 700; color: var(--ink); border: 2px solid var(--teal); border-radius: 99px;
  padding: 9px 18px 9px 12px; min-height: 44px; margin-right: 12px;
}
.c2-listen::before {
  content: ""; width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 12px;
  border-color: transparent transparent transparent var(--teal);
}
.c2-listen:hover, .c2-listen:focus-visible { background: var(--answer-bg); }

/* ---------- Jhoslyn's line on /book/ ------------------------------------ */
.c2-voice {
  display: grid; grid-template-columns: 1fr; gap: 16px; align-items: center;
  margin: 28px 0; padding: 16px 18px; background: var(--card);
  border: 1px solid var(--rule); border-left: 4px solid var(--gold); border-radius: 16px; max-width: var(--measure);
}
.c2-voice.with-photo { grid-template-columns: 88px 1fr; }
.c2-voice .c2-photo { aspect-ratio: 1; }
.c2-voice .c2-photo img { border-radius: 99px; }
.c2-voice blockquote { margin: 0; font-family: var(--f-head); font-size: 1.2rem; line-height: 1.4; }
.c2-voice cite { display: block; margin-top: 6px; font: 400 .85rem var(--f-body); color: var(--ink-2); font-style: normal; }

/* ---------- Pack names --------------------------------------------------- */
.packs .pack-name { display: block; font-weight: 700; }
.packs .pack-size { display: block; font-size: .9rem; color: var(--ink-2); }

/* ---------- Teacher page: portrait beside the video ---------------------- */
.c2-tutor-top { display: grid; gap: 18px; margin: 0 0 24px; }
.c2-tutor-top > .vid { margin: 0; }
@media (min-width: 760px) { .c2-tutor-top.with-photo { grid-template-columns: 240px 1fr; align-items: start; } }

/* ---------- Intro video poster (was black with a rosa border) ----------- */
.vid { max-width: var(--measure); margin: 28px 0 8px; }
.vid-poster, html .vid-poster {
  background: var(--card); color: var(--ink);
  border: 1px solid var(--rule); border-left: 4px solid var(--gold); border-radius: 16px;
}
.vid-play { background: var(--accent); color: var(--accent-ink); }
.vid-poster:hover .vid-play, a.vid-poster:focus-visible .vid-play { background: var(--ink); color: var(--paper); }
.vid-m { color: var(--ink-2); }
.vid-frame { border-radius: 16px; }
.c2-tutor-top > .vid { max-width: none; }

/* Phone: the portrait should not fill the first screen before the video. */
@media (max-width: 759px) {
  .c2-tutor-top .c2-photo { max-width: 220px; }
}
.hero-listen a:not(.c2-listen) { white-space: nowrap; }

/* ---------- Intro video with its thumbnail ------------------------------ */
.vid-poster.has-thumb, html .vid-poster.has-thumb {
  position: relative; display: block; padding: 0; overflow: hidden;
  aspect-ratio: 16 / 9; border: 1px solid var(--rule); border-radius: 16px; background: #000;
}
.vid-poster.has-thumb .vid-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.vid-poster.has-thumb .vid-play {
  position: absolute; right: 18px; bottom: 18px;
  width: 64px; height: 64px; box-shadow: 0 4px 18px rgba(0, 0, 0, .35);
}
@media (max-width: 559px) {
  .vid-poster.has-thumb .vid-play { right: 10px; bottom: 10px; width: 48px; height: 48px; }
  .vid-poster.has-thumb .vid-play svg { width: 20px; height: 20px; }
}
.vid-poster.has-thumb .vid-play svg { width: 28px; height: 28px; }
/* The title and privacy note stay for screen readers; the image carries the text. */
.vid-poster.has-thumb .vid-t, .vid-poster.has-thumb .vid-m {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- "Play me!" note beside the intro video ----------------------- */
/* Decorative (aria-hidden): the poster link already carries the label. */
@font-face {
  font-family: "Jarana Hand"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/hand.woff2") format("woff2"); /* Nothing You Could Do, SIL OFL */
}
.vid { position: relative; }
.play-me {
  display: flex; align-items: flex-end; justify-content: flex-end; gap: 4px;
  margin: 0 8px 4px 0; color: var(--accent); pointer-events: none;
  font: 400 1.9rem/1 "Jarana Hand", "Segoe Print", "Bradley Hand", cursive;
}
.play-me-arrow { width: 64px; height: 48px; transform: scaleY(-1) rotate(-12deg); order: 2; }
.play-me span { transform: rotate(-4deg); }
/* Wide screens: in the empty space to the right, pointing back at the video. */
@media (min-width: 1100px) {
  .vid > .play-me {
    position: absolute; left: calc(100% + 18px); top: 38%;
    flex-direction: column; align-items: flex-start; gap: 6px; margin: 0;
    font-size: 2.6rem; white-space: nowrap;
  }
  .vid > .play-me .play-me-arrow { width: 110px; height: 82px; transform: none; order: 0; }
  .vid > .play-me span { margin-left: 30px; }
}
/* The teacher page's video sits in a grid with no space beside it. */
.c2-tutor-top .play-me { position: static; flex-direction: row; align-items: flex-end; font-size: 1.9rem; margin: 0 8px 4px 0; }
.c2-tutor-top .play-me .play-me-arrow { width: 64px; height: 48px; transform: scaleY(-1) rotate(-12deg); order: 2; }
.c2-tutor-top .play-me span { margin-left: 0; }
/* Once the video is playing the note has done its job. */
.vid:has(.vid-frame) .play-me { display: none; }

/* ---------- Photo framing (17 Oct 2026 photos) --------------------------- */
[data-photo="portrait"] img { object-position: 50% 20%; }
.c2-voice [data-photo="portrait"] img { object-position: 50% 12%; }
[data-photo="barranco"] img { object-position: 45% 60%; }
[data-photo="colonial-house"] img { object-position: 55% 45%; }
[data-photo="palms"] img { object-position: 60% 50%; }
[data-photo="andes"] img { object-position: 40% 35%; }
[data-photo="office"] img { object-position: 43% 45%; }
/* Scenario cards: show photos only when every card in the row has one, so a
   half-filled row never looks uneven. Each photo still shows on its own page. */
.paths:has(.path [data-photo]:not(.has-photo)) .path [data-photo] { display: none; }

/* ---- Phone menu (bottom-nav.js adds .jmenu-btn and .jmenu-panel) ---- */
header.site { position: relative; }
.jmenu-btn, .jmenu-panel { display: none; }
/* Compact header up to 960px: the full nav needs about 1000px on one line. */
@media (max-width: 960px) {
  header.site nav a:not(.nav-cta) { display: none; }
  header.site nav { gap: 0; }
  .jmenu-btn {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 42px; height: 42px; padding: 0; color: var(--ink);
    background: transparent; border: 1px solid var(--ink-2); border-radius: 10px; cursor: pointer;
  }
  header.site { flex-wrap: nowrap; }
  header.site nav { margin-left: auto; }
  header.site .brand { white-space: nowrap; }
  .jmenu-panel .theme { margin: 6px 0 0; }
  .jmenu-btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  .jmenu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
  .jmenu-panel:not([hidden]) {
    display: block; position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
    max-height: calc(100vh - 140px); overflow-y: auto;
    background: var(--paper); border: 1px solid var(--rule, #d9cfc2); border-top: 2px solid var(--gold);
    border-radius: 0 0 12px 12px; box-shadow: 0 12px 28px rgba(0,0,0,.18); padding: 8px 16px 16px;
  }
  .jmenu-panel ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
  .jmenu-panel li a { display: block; padding: 11px 2px; color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--rule, #e6ddd1); font-size: 1rem; }
  .jmenu-panel li a[aria-current="page"] { color: var(--accent); font-weight: 700; }
  .jmenu-label { margin: 14px 0 2px; font: 700 .75rem/1.2 var(--f-ui, system-ui, sans-serif); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2, #6b5d50); }
  .jmenu-langs { display: flex; flex-wrap: wrap; gap: 6px 16px; padding-top: 8px; }
  .jmenu-langs a, .jmenu-langs span { padding: 6px 0; color: var(--ink); }
  .jmenu-langs [aria-current] { font-weight: 700; }
}
@media (max-width: 960px) { header.site nav a.nav-cta { white-space: nowrap; } }
@media (max-width: 360px) {
  header.site { gap: 8px; }
  header.site .brand { font-size: 1rem; }
  header.site .brand:after { display: none; }
  header.site nav a.nav-cta { padding-inline: 12px; font-size: .9rem; }
}
@media (max-width: 360px) { .jmenu-btn { width: 38px; height: 38px; } }

/* ---- Header language dropdown (bottom-nav.js adds .jlang) ---- */
.jlang { position: relative; flex: none; }
.jlang-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 32px; padding: 0 10px;
  font: 600 .85rem/1 var(--f-ui, system-ui, sans-serif); color: var(--ink);
  background: transparent; border: 1px solid var(--ink-2); border-radius: 999px; cursor: pointer;
}
.jlang-btn[aria-expanded="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.jlang-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jlang-list:not([hidden]) {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 170px;
  list-style: none; margin: 0; padding: 6px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 10px; box-shadow: 0 10px 24px rgba(0,0,0,.16);
}
.jlang-list a, .jlang-list span { display: block; padding: 9px 12px; border-radius: 6px; color: var(--ink); text-decoration: none; white-space: nowrap; }
.jlang-list a:hover, .jlang-list a:focus-visible { background: var(--rule); }
.jlang-list [aria-current] { font-weight: 700; color: var(--accent); }
@media (max-width: 960px) { .jlang { display: none; } }
/* Desktop: the ES/PT nav labels are longer; tighter gaps keep the header on one line at the 928px content width. */
@media (min-width: 961px) { header.site { column-gap: 16px; } header.site nav { column-gap: 14px; } }

/* ---- Read-along (read-along.js): tap-a-word glosses and narration ---- */
.ra-hint { font-family: var(--f-ui); font-size: .9rem; color: var(--ink-2); margin: 0 0 .6rem; }
.ra-text .w { cursor: pointer; border-radius: 3px; }
.ra-text .w:hover { background: color-mix(in srgb, var(--gold) 22%, transparent); }
.ra-text .w.picked { background: color-mix(in srgb, var(--gold) 35%, transparent); }
/* Spoken word: background AND an underline bar, so it never relies on colour alone.
   (Bold would reflow the line on every word.) */
.ra-text .w.on { background: color-mix(in srgb, var(--accent) 22%, transparent); box-shadow: inset 0 -2px 0 var(--accent); }
.ra-current { background: color-mix(in srgb, var(--gold) 9%, transparent); border-radius: 6px; }
.ra-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 1rem; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); font-family: var(--f-ui); }
.ra-bar button { font: 600 .92rem/1 var(--f-ui); min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--ink-2); background: transparent; color: var(--ink); cursor: pointer; }
.ra-bar .ra-play { background: var(--accent); border-color: var(--accent); color: var(--accent-ink, #fff); }
.ra-speed { display: inline-flex; gap: 4px; }
.ra-speed button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.ra-status { font-size: .88rem; color: var(--ink-2); }
.ra-note { font-size: .8rem; color: var(--ink-2); margin-left: auto; }
.ra-bar button:focus-visible, .ra-pop button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ra-pop { position: absolute; z-index: 80; padding: 12px 40px 12px 14px; background: var(--paper); color: var(--ink); border: 1px solid var(--rule); border-top: 2px solid var(--gold); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.18); font-family: var(--f-ui); }
.ra-pop .ra-term { margin: 0 0 4px; font-weight: 700; font-family: var(--f-head); }
.ra-pop .ra-gloss { margin: 0; font-size: .95rem; line-height: 1.45; }
.ra-pop .ra-btn { margin-top: 8px; font: 600 .85rem/1 var(--f-ui); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--ink-2); background: transparent; color: var(--ink); cursor: pointer; }
.ra-pop .ra-x { position: absolute; top: 6px; right: 6px; width: 32px; height: 32px; border: 0; background: transparent; color: var(--ink-2); font-size: 1.3rem; cursor: pointer; border-radius: 6px; }
.ra-practise { margin-top: 1.4rem; font-family: var(--f-ui); }
@media (prefers-reduced-motion: reduce) { .ra-text .w, .ra-current { transition: none; } }

/* Header icons for Search and Account (20 Oct 2026). On phones they are
   hidden with the other header links and appear in the menu instead. */
@media (min-width: 961px) { header.site nav a.nav-icon { display: inline-flex; } }
header.site nav a.nav-icon { align-items: center; justify-content: center; align-self: center; min-width: 24px; min-height: 32px; color: var(--ink-2); }
@media (min-width: 961px) { header.site nav { column-gap: 11px; } header.site { column-gap: 12px; } }
header.site nav a.nav-icon:hover, header.site nav a.nav-icon:focus-visible { color: var(--accent); text-decoration: none; }
header.site nav a.nav-icon[aria-current="page"] { color: var(--accent); }

/* ---------- Round 55 (23 Oct 2026): flow and ease of use ------------------ */
/* Home: start at your level */
.home-levels, .home-how { margin: 40px 0 8px; }
.lvl-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 14px 0 10px; }
.lvl-chip { display: flex; flex-direction: column; gap: 2px; padding: 14px 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--card); text-decoration: none; color: var(--ink); min-height: 44px; }
.lvl-chip b { font-family: var(--f-head); font-size: 1.35rem; color: var(--accent); }
.lvl-chip span { font-size: .875rem; color: var(--ink-2); line-height: 1.3; }
.lvl-chip:hover, .lvl-chip:focus-visible { border-color: var(--accent); }
@media (max-width: 640px) { .lvl-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); } .lvl-chip:last-child { grid-column: span 2; } }
/* Home: how classes work */
.how-steps { list-style: none; counter-reset: how; padding: 0; margin: 14px 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.how-steps li { counter-increment: how; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px 16px 16px 16px; display: flex; flex-direction: column; gap: 6px; }
.how-steps li::before { content: counter(how); display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: .9rem; }
.how-steps li b { font-family: var(--f-head); font-size: 1.1rem; }
.how-steps li span { color: var(--ink-2); font-size: .95rem; line-height: 1.5; }
@media (max-width: 760px) { .how-steps { grid-template-columns: 1fr; } }
.home-how-cta { margin-top: 8px; }
/* Hero: the slang guide is now a text link beside the dialogues */
.hero-listen a + a { margin-left: 4px; }

/* Continue where you left off (journey.js) */
.journey-card { display: flex; margin-top: 0; align-items: center; gap: 14px; flex-wrap: wrap; margin: 18px 0; padding: 14px 16px; border: 1px solid var(--rule); border-left: 4px solid var(--gold); border-radius: var(--r); background: var(--card); }
.journey-card .jc-text { flex: 1 1 220px; min-width: 0; }
.journey-card .jc-k { display: block; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--gold-ink); font-weight: 700; }
.journey-card .jc-t { display: block; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.journey-card .jc-m { display: block; font-size: .875rem; color: var(--ink-2); }
.journey-card .cta { padding: 10px 18px; }
.journey-card .jc-x { background: none; border: 0; color: var(--ink-2); font-size: .875rem; text-decoration: underline; cursor: pointer; padding: 8px; min-height: 44px; }
/* "Read" ticks on lesson lists */
a.journey-read::after { content: " ✓"; color: var(--teal); font-weight: 700; }
/* Lesson position line */
.lesson-pos { font-size: .875rem; color: var(--ink-2); margin: 6px 0 0; }
.lesson-pos .bar { display: block; height: 4px; background: var(--rule); border-radius: 4px; margin-top: 6px; max-width: 320px; overflow: hidden; }
.lesson-pos .bar i { display: block; height: 100%; background: var(--accent); }

/* /learn/: jump to a level */
.unit-jump { position: sticky; top: 0; z-index: 20; background: var(--paper); border-bottom: 1px solid var(--rule); padding: 10px 0; margin: 10px 0 18px; display: flex; gap: 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.unit-jump::-webkit-scrollbar { display: none; }
.unit-jump a { flex: 0 0 auto; padding: 8px 14px; border-radius: 99px; border: 1px solid var(--rule); background: var(--card); color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 700; min-height: 36px; display: inline-flex; align-items: center; }
.unit-jump a:hover, .unit-jump a:focus-visible, .unit-jump a[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
.unit-jump .uj-label { flex: 0 0 auto; align-self: center; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); font-weight: 700; }
.unit-lvl { display: inline-block; margin-left: 8px; padding: 2px 8px; border-radius: 99px; font-family: var(--f-ui); font-size: .75rem; font-weight: 700; color: var(--gold-ink); border: 1px solid var(--gold); vertical-align: middle; }
.unit-count { font-family: var(--f-ui); font-size: .8125rem; font-weight: 400; color: var(--ink-2); margin-left: 8px; }
[id^="unit-"] { scroll-margin-top: 70px; }

/* /book/: pack table becomes cards on phones */
@media (max-width: 560px) {
  table.packs, table.packs tbody { display: block; width: 100%; }
  table.packs thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.packs tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 12px 14px; border-bottom: 1px solid var(--rule); }
  table.packs td { border: 0; padding: 0; text-align: left; }
  table.packs td:first-child { grid-row: span 3; }
  table.packs td.num { text-align: right; }
  table.packs td.num::before { content: attr(data-label) " "; color: var(--ink-2); font-size: .8125rem; }
}
/* /book/: booking request form (contact.js) */
.book-req { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; margin: 16px 0; display: grid; gap: 12px; max-width: var(--measure); }
.book-req label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 4px; }
.book-req input, .book-req select, .book-req textarea { width: 100%; box-sizing: border-box; font: inherit; padding: 10px 12px; border: 1px solid var(--field-rule); border-radius: 8px; background: var(--paper); color: var(--ink); min-height: 44px; }
.book-req .br-times { display: grid; gap: 8px; }
.book-req .br-hint { font-size: .8125rem; color: var(--ink-2); margin: 2px 0 0; }
.book-req .br-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 480px) { .book-req .br-row { grid-template-columns: 1fr; } }
.book-req .br-preview { font-size: .8125rem; color: var(--ink-2); white-space: pre-wrap; background: var(--answer-bg); border-radius: 8px; padding: 10px 12px; margin: 0; }
.book-req .br-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.book-req .br-copy { background: none; border: 1px solid var(--ink); color: var(--ink); border-radius: 99px; padding: 10px 16px; font: inherit; font-weight: 700; cursor: pointer; min-height: 44px; }
.book-req .br-status { font-size: .875rem; color: var(--teal); margin: 0; }
.book-req .br-status.bad { color: var(--bad, #9b1c31); font-weight: 600; }
.book-req [aria-invalid="true"] { border-color: var(--bad, #9b1c31); box-shadow: 0 0 0 2px color-mix(in srgb, var(--bad, #9b1c31) 25%, transparent); }
/* Header search icon stays visible on phones: the bottom bar now carries
   Practice instead of Search. */
@media (max-width: 960px) {
  header.site nav { display: flex; flex-wrap: nowrap; align-items: center; }
  header.site nav a.nav-icon[href$="/search/"] { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 42px; margin-right: 4px; color: var(--ink); }
}
.unit-jump .uj-sel { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.unit-jump select { font: inherit; font-size: .9rem; padding: 6px 10px; min-height: 36px; max-width: 46vw; border: 1px solid var(--field-rule); border-radius: 99px; background: var(--card); color: var(--ink); }
@media (max-width: 640px) {
  .unit-jump { gap: 6px; }
  .unit-jump .uj-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .unit-jump select { max-width: 42vw; }
  .unit-jump a { padding: 6px 10px; }
}
.book-req .br-copy { font-size: .95rem; }
.book-req h3 { margin: 0; }
/* Level test: Continue button (replaces the 0.9 s auto-advance) and the
   booking link on the result */
.lt-next { margin-top: 14px; font: inherit; font-family: var(--f-ui); font-weight: 700; padding: 11px 20px; min-height: 44px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.lt-next:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.result-step .result-next { display: flex; margin: 0 0 10px; }
.result-step .result-book { display: inline-flex; padding: 11px 20px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); text-decoration: none; }
/* Round 56: level-test explanation folded under "How the test works" */
.lt-how { margin: 0 0 18px; max-width: var(--measure); }
.lt-how > summary { cursor: pointer; font-family: var(--f-ui); font-weight: 700; color: var(--accent); min-height: 44px; display: flex; align-items: center; }
.lt-how[open] > summary { margin-bottom: 8px; }
/* Round 56: /practice/ list becomes tappable cards */
.practice-list { list-style: none; padding: 0; margin: 18px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; max-width: var(--wide, 58rem); }
.practice-list li { position: relative; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 16px; color: var(--ink-2); font-size: .95rem; line-height: 1.5; }
.practice-list li:hover, .practice-list li:focus-within { border-color: var(--accent); }
.practice-list li a { text-decoration: none; color: var(--ink); font-size: 1.05rem; }
.practice-list li a::after { content: ""; position: absolute; inset: 0; border-radius: var(--r); }
.practice-list li a:focus-visible { outline: none; }
.practice-list li:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Round 57c-1: space reserved for things drawn after the page appears, so
   nothing below them jumps (layout shift was 0.115 on /level-test/: the
   footer showed first, then the test pushed it off the screen; 0.041 on
   /jerga/ from the slang-of-the-day line). */
[data-level-test] { min-height: min(620px, 78vh); }
[data-wotd]:empty { min-height: 4.6em; }
@media (min-width: 700px) { [data-wotd]:empty { min-height: 1.9em; } }
/* The booking request form on /book/ is built by contact.js after the first
   paint; its measured height is held for it (980–1064px on a phone, 850px
   from 700px up) so the page below does not jump (was 0.175 on /book/). */
[data-contact-form]:empty { min-height: 1000px; }
@media (min-width: 700px) { [data-contact-form]:empty { min-height: 850px; } }

/* ---------- Print (Round 58.2) --------------------------------------------
   A printed lesson used to carry the header, the menu button and the footer
   link lists, and the collapsed lesson sections printed as bare "+ The
   forms" headings: 7 of 8 sections missing. print.js opens every <details>
   before printing and closes them again after; this sheet drops the
   site chrome and lays the page out for paper. */
@media print {
  @page { margin: 16mm 14mm; }
  :root { --paper: #fff; --card: #fff; }
  html, body { background: #fff !important; color: #000; }
  header.site, footer.site, .jarana-bottom-nav, .skip, .nav-cta, .cta-line, .lesson-nav,
  .lesson-pos, .journey-card, .unit-jump, .quiz-again, .quiz-more, [data-search],
  .dl-toggle, .theme-toggle, [data-theme-toggle], .anki-export, audio, video, iframe,
  .vid, .c2-voice, [data-contact] { display: none !important; }
  main { max-width: none !important; padding: 0 !important; margin: 0 !important; }
  a { color: inherit; text-decoration: underline; }
  details > summary { list-style: none; }
  details > summary::-webkit-details-marker { display: none; }
  details > summary::before, details > summary::after { content: none !important; }
  h1, h2, h3, summary { break-after: avoid; page-break-after: avoid; }
  p, li, blockquote, table, figure, .quiz .q { break-inside: avoid; page-break-inside: avoid; }
  img { max-width: 60% !important; height: auto !important; }
  /* The quiz prints as a worksheet: options as a plain list with a box. */
  .quiz button.opt, .quiz .opt { display: block; width: auto; min-height: 0; border: 0; background: none;
    padding: 2px 0 2px 1.6em; text-align: left; position: relative; color: #000; font: inherit; }
  .quiz button.opt::before, .quiz .opt::before { content: "\2610"; position: absolute; left: 0; }
  .quiz .is-right, .quiz .is-wrong, .quiz .is-off { opacity: 1; text-decoration: none; }
  .quiz-result { break-before: page; }
  .c2-hero-grid, .with-photo { display: block !important; }
}

/* Round 58.9: "Keep going" on lessons that have no previous/next links. */
.keep-going { margin: 40px 0 8px; padding-top: 20px; border-top: 1px solid var(--rule); }
.keep-going h2 { font-size: 1.15rem; margin: 0 0 10px; }
.keep-going ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.keep-going a { display: block; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--card); color: var(--ink); text-decoration: none; font-weight: 600; line-height: 1.35; }
.keep-going a:hover, .keep-going a:focus-visible { border-color: var(--accent); color: var(--accent); }
.keep-going a::after { content: " \2192"; color: var(--accent); }
@media print { .keep-going { display: none !important; } }

/* Round 59.1: "Your mistakes" on the Review pages (mistakes.js). The box
   keeps its height while the script fills it, so the flashcards below do
   not jump. */
.mk{min-height:21.5rem;margin-bottom:1.5rem}
@media (min-width:700px){.mk{min-height:17rem}}
.mk h2{margin-top:0}
.mk .mk-bar{display:flex;gap:.6rem;flex-wrap:wrap;align-items:center}
.mk .mk-clear{font-size:.85rem;opacity:.85}
.mk .mk-q{margin:0;padding:0;border:0;background:none}
.mk .mk-from{margin:.2rem 0 .6rem}
.mk .mk-why{margin:.6rem 0;font-size:.95rem}
.result-mk{margin:.6rem 0 0;font-size:.92rem}
@media print{.mk{display:none}}

/* Round 59.2: Spanish examples read aloud (listen.js). Only colour and
   decoration change on the text, and the pill is fixed, so nothing moves. */
.say-it{text-decoration:underline dotted;text-decoration-thickness:1px;text-underline-offset:3px;cursor:pointer;border-radius:3px}
.say-it:hover{text-decoration-style:solid}
.say-it:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.say-it.say-on{background:color-mix(in srgb,var(--accent) 16%,transparent);text-decoration-style:solid}
.say-pill{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(76px + env(safe-area-inset-bottom,0px));z-index:1001;display:flex;flex-wrap:wrap;gap:.4rem;align-items:center;justify-content:center;max-width:calc(100vw - 24px);padding:.5rem .7rem;border-radius:14px;background:var(--ink);color:var(--paper);font-size:.85rem;box-shadow:0 4px 18px rgba(0,0,0,.25)}
.say-pill[hidden]{display:none}
.say-pill .say-msg{flex:1 1 100%;text-align:center}
.say-pill button{font:inherit;font-size:.82rem;padding:.25rem .7rem;border-radius:999px;border:1px solid currentColor;background:transparent;color:inherit;cursor:pointer;min-height:32px}
.say-pill .say-speed[aria-pressed=true]{background:var(--paper);color:var(--ink)}
@media (min-width:641px){.say-pill{bottom:20px}.say-pill .say-msg{flex:0 1 auto}}
@media print{.say-pill{display:none}.say-it{text-decoration:none}}

/* Round 59.3: saved lessons (journey.js). */
.save-line{margin:1.2rem 0 .4rem}
.save-btn{font:inherit;font-size:.92rem;padding:.45rem .9rem;min-height:40px;border-radius:999px;border:1px solid var(--accent);background:transparent;color:var(--accent);cursor:pointer}
.save-btn[aria-pressed=true]{background:var(--accent);color:var(--accent-ink)}
.saved-card{display:block}
.saved-card .saved-list{list-style:none;margin:.4rem 0 0;padding:0}
.saved-card .saved-list li{display:flex;gap:.6rem;align-items:center;justify-content:space-between;padding:.35rem 0;border-top:1px solid var(--rule)}
.saved-card .saved-list li:first-child{border-top:0}
.saved-card .saved-list a{font-weight:600;overflow-wrap:anywhere}
@media print{.save-line,.saved-card{display:none}}

/* Round 59.4: "Test me" on the verb pages (conj-test.js). */
.ct-bar{display:flex;flex-wrap:wrap;gap:.5rem;align-items:center;margin:.5rem 0 1.4rem}
.ct-bar button{font:inherit;font-size:.9rem;padding:.4rem .85rem;min-height:40px;border-radius:999px;border:1px solid var(--accent);background:transparent;color:var(--accent);cursor:pointer}
.ct-bar .ct-check{background:var(--accent);color:var(--accent-ink)}
.ct-bar .ct-out{font-weight:600}
table.ct-on td strong,table.ct-on .spk-btn{display:none}
.ct-in{font:inherit;width:100%;max-width:14rem;padding:.35rem .5rem;border:1px solid var(--rule);border-radius:8px;background:var(--paper);color:var(--ink)}
.ct-in.ct-ok{border-color:var(--good,#2f7a45);box-shadow:0 0 0 1px var(--good,#2f7a45)}
.ct-in.ct-bad{border-color:var(--bad,#b3261e);box-shadow:0 0 0 1px var(--bad,#b3261e)}
.ct-note{display:block;font-size:.85rem;color:var(--ink-2);margin-top:.2rem}
.ct-note:empty{display:none}
table:not(.ct-on) .ct-in,table:not(.ct-on) .ct-note{display:none}
@media print{.ct-bar{display:none}}

/* Round 59.4: the pronunciation-voice bar is in the HTML now, so its look
   must be here at first paint too (pron.js injects the same rules later). */
.pron-voice-toggle{display:flex;flex-wrap:wrap;align-items:center;gap:8px;font-size:.82rem;color:var(--ink-2,#666);margin:0 0 16px}
.pron-voice-btn{font-size:.8rem;font-weight:600;padding:5px 12px;border-radius:99px;border:1px solid var(--field-rule,#ccc);background:var(--paper,transparent);color:var(--ink-2,#666);cursor:pointer}
.pron-voice-btn[aria-pressed=true]{border-color:var(--accent,#999);color:var(--accent,#333)}
.pron-voice-toggle[data-pending]{visibility:hidden}
@media print{.pron-voice-toggle{display:none}}

/* Round 59.5: share a level-test result. */
.lt-share{display:flex;flex-wrap:wrap;gap:.6rem;align-items:center;margin:1rem 0 .4rem}
.lt-share-msg{font-size:.9rem;color:var(--ink-2)}
.lt-share-text{flex:1 1 100%;min-height:4.5rem;font:inherit;font-size:.9rem;padding:.4rem;border:1px solid var(--rule);border-radius:8px;background:var(--paper);color:var(--ink)}
@media print{.lt-share{display:none}}
.save-note{font-size:.85rem;color:var(--ink-2)}
