/* tour.css — the guided tours (lib/tour.js; SPEC §5.6): the spotlight (.tour-hole: a ring + the dimming around the part
   of the page a step is about), the step card (dialog.tour-pop: a card by the spotlight on wide screens, a sheet at the
   bottom or the top on phones) and the speller tour's small practice-screen drawing (.tour-mock, lib/tour-speller.js).
   Loaded by parent/index.html and student/index.html (before themes.css). Colors only from the tokens of app.css :root
   (--scrim is the dimming; themes.css redefines every token per speller theme), so every theme recolors it. */

.tour-hole { position: fixed; z-index: 40; top: 0; left: 0; width: 0; height: 0; pointer-events: none; border-radius: var(--r);
  box-shadow: 0 0 0 4px var(--sun), 0 0 0 9999px var(--scrim); }
.tour-hole.none { top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0;
  background: var(--scrim); box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .tour-hole { transition: top .2s ease, left .2s ease, width .2s ease, height .2s ease; }
  .tour-hole.instant, .tour-hole.none { transition: none; }
}

/* The card. Positions come from lib/tour.js through CSSOM (top/left), never a style attribute (CSP). */
dialog.tour-pop { position: fixed; inset: auto; margin: 0; width: min(400px, calc(100vw - 24px)); max-width: none;
  max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow: auto; overscroll-behavior: contain; padding: 0;
  border: 2px solid var(--forest-2); border-radius: var(--r); background: var(--card); color: var(--ink); box-shadow: none; }
dialog.tour-pop::backdrop { background: transparent; } /* the spotlight draws the dimming (the page stays inert) */
.tour-body { display: grid; gap: 10px; padding: 16px 18px; }
.tour-count { margin: 0; font-size: .85rem; font-weight: 800; letter-spacing: .04em; color: var(--forest-2); }
.tour-title { margin: 0; font-size: 1.25rem; line-height: 1.25; color: var(--pine); }
.tour-title:focus { outline: none; } /* moved there by the tour, not by the keyboard */
.tour-text p { margin: 0; }
/* A smaller line set apart under the words (the Questions? step's COPPA line). */
.tour-note { margin: 0; padding-top: 8px; border-top: 1px solid var(--line); font-size: .875rem; line-height: 1.4; color: var(--muted); }
/* The see-through twin of the lit button a step invites the parent to use (lib/tour.js step.act: + Add a speller). It is
   inside the card (the page under the card is inert) and fixed over that button, so a tap or a click there works it; its
   focus ring (app.css :focus-visible) shows around the real button. */
.tour-act { position: fixed; z-index: 1; margin: 0; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer; }
/* The buttons stay in view when the words scroll inside the card (Bigger text, a small phone). */
.tour-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 2px 0 0; padding: 4px 0 0; background: var(--card); }
.tour-gap { flex: 1 1 auto; }
.tour-actions .btn { min-height: 44px; min-width: 76px; }
.tour-skip { min-height: 44px; padding: 0 4px; }

/* Phones: a sheet from the bottom (or the top, when the spotlight is low on the screen, e.g. Questions?). */
dialog.tour-pop.is-sheet { inset: auto 0 0 0; width: 100%; max-width: 100%; max-height: 55vh; max-height: 55dvh;
  border-width: 2px 0 0; border-radius: var(--r-lg) var(--r-lg) 0 0; padding-bottom: env(safe-area-inset-bottom); }
dialog.tour-pop.is-sheet.at-top { inset: 0 0 auto 0; border-width: 0 0 2px; border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding-bottom: 0; padding-top: env(safe-area-inset-top); }
dialog.tour-pop.is-sheet.centered { max-height: 85vh; max-height: 85dvh; } /* nothing to show behind it: room for the drawing */
/* A part fixed in the corner (the Questions? button: lib/tour.js 'pinned'): the sheet may fill the height above it (its
   ring included: the button is 48 px tall, max(16px, the safe area) up from the bottom), so a 320×568 phone needs no scroll. */
dialog.tour-pop.is-sheet.pinned { max-height: calc(100vh - max(16px, env(safe-area-inset-bottom)) - 64px);
  max-height: calc(100dvh - max(16px, env(safe-area-inset-bottom)) - 64px); }
.is-sheet .tour-body { padding: 14px var(--gutter) 0; gap: 8px; }
.is-sheet .tour-actions { padding-bottom: 12px; }
.is-sheet .tour-actions .btn, .is-sheet .tour-skip { min-height: 48px; }

/* The speller tour's drawing of the practice screen: grey bars, never a word (lib/tour-speller.js practiceMock). */
.tour-picture { justify-self: center; width: 100%; max-width: 320px; }
.tour-mock { display: grid; gap: 6px; padding: 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--cream); color: var(--pine); font-size: .8rem; line-height: 1.25; }
.tm-top { display: flex; align-items: center; gap: 8px; }
.tm-speaker { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--forest); color: var(--on-forest); }
.tm-clues, .tm-answer { display: grid; gap: 4px; border-radius: 8px; }
.tm-row { display: flex; align-items: center; gap: 6px; min-height: 22px; padding: 2px 6px; border-radius: 8px; background: var(--card); }
.tm-label { flex: none; font-weight: 800; color: var(--forest-2); }
.tm-bar { flex: 1 1 auto; min-width: 24px; height: 6px; border-radius: 3px; background: var(--line-strong); opacity: .55; }
.tm-chip { flex: none; padding: 0 7px; border-radius: 999px; background: var(--sage); color: var(--pine); font-weight: 700; }
.tm-q { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border: 2px solid var(--forest-2); border-radius: 50%;
  background: var(--card); color: var(--forest); font-weight: 800; font-size: .75rem; }
.tm-input { height: 28px; border: 2px solid var(--line-strong); border-radius: 8px; background: var(--card); }
.tm-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.tm-pill { padding: 1px 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--card); color: var(--pine); font-weight: 700; }
.tm-pill.go { background: var(--sun); color: var(--on-sun); border-color: var(--sun-deep); }
.tour-mock .is-focus { outline: 3px solid var(--forest); outline-offset: 1px; background: var(--sun-soft); }
.tour-mock .tm-q.is-focus { outline-offset: 2px; border-color: var(--sun-deep); background: var(--sun); color: var(--on-sun); }
.is-sheet .tour-mock { gap: 4px; padding: 8px; font-size: .74rem; }
.is-sheet .tm-input { height: 22px; }
/* Short windows (a phone on its side, a big zoom): only the part of the drawing the step is about, so it fits in the
   card (lib/tour.js also scrolls that part into view inside the card if it still doesn't), and less space between the
   lines, so two lines of words fit the sheet without a scroll, Bigger text too (812×375). The buttons stay 48 px. */
@media (max-height: 499px) {
  .tour-mock .tm-top, .tour-mock:not(.f-answer) .tm-answer, .tour-mock.f-answer .tm-clues,
  .tour-mock.f-tip .tm-row:not(.tm-origin) { display: none; }
  .is-sheet .tour-body { padding-top: 10px; gap: 6px; }
  .is-sheet .tour-count { line-height: 1.3; }
  .is-sheet .tour-actions { margin-top: 0; padding-bottom: 8px; }
}

@media (forced-colors: active) {
  .tour-hole { outline: 4px solid Highlight; outline-offset: 2px; }
  .tour-hole.none { outline: none; }
  dialog.tour-pop { border: 2px solid CanvasText; }
  .tm-row, .tm-input, .tm-pill, .tm-chip, .tm-q, .tm-speaker { border: 1px solid CanvasText; }
  .tm-bar { background: CanvasText; }
  .tour-mock .is-focus { outline: 3px solid Highlight; }
}
@media print {
  .tour-hole, dialog.tour-pop { display: none !important; }
}
