/*
 * The crash-course page (LibraryPageController::crashcourse, CrashCourses).
 *
 * Built from the library's tokens only (library.css section 1, family/tokens.css), so it
 * turns dark with the rest. One long column to read, with the parts list beside it on a
 * wide screen and above it on a phone. Each phrase is three lines in a fixed order:
 * the language, how to say it, the English. "Hide the English" (.crash--cover) blanks
 * the third line until it is tapped, which turns every list into flashcards.
 */

.crash-meta { margin: 0.6rem 0 0; color: var(--ink-2); font-size: 0.95rem; }
.crash-meta--region { margin-top: 0.2rem; color: var(--ink-3); font-size: 0.88rem; }

.crash-layout { display: grid; gap: 2rem; }
@media (min-width: 900px) {
  .crash-layout { grid-template-columns: 15rem minmax(0, 1fr); align-items: start; }
  .crash-side { position: sticky; top: 1rem; max-height: calc(100vh - 2rem); overflow: auto; }
}
.crash-main { min-width: 0; max-width: 46rem; }

/* ── the parts list and the tools ── */
.crash-toc__title { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin: 0 0 0.5rem; }
.crash-toc ol { list-style: none; margin: 0; padding: 0; }
.crash-toc a, .crash-toc a:hover { display: flex; gap: 0.5rem; padding: 0.3rem 0.4rem; border-radius: var(--r-s); color: var(--ink); text-decoration: none; font-size: 0.92rem; line-height: 1.3; }
.crash-toc a:hover { background: var(--surface-2); }
.crash-toc__num { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; display: inline-grid; place-items: center; font-size: 0.75rem; background: var(--surface-2); color: var(--ink-2); }
.crash-toc a.is-done .crash-toc__num { background: var(--accent); color: var(--on-accent, #1d1b18); }
@media (max-width: 899px) {
  .crash-toc ol { columns: 2; column-gap: 1rem; }
  .crash-toc li { break-inside: avoid; }
}
@media (max-width: 480px) { .crash-toc ol { columns: 1; } }
.crash-tools { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.crash-switch { display: flex; gap: 0.5rem; align-items: center; font-weight: 600; cursor: pointer; }
.crash-tools__note { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--ink-3); }

.crash-howto { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); padding: 1rem 1.25rem; margin-bottom: 2rem; }
.crash-howto__title { font-size: 1.05rem; margin: 0 0 0.4rem; }
.crash-howto ul { margin: 0; padding-left: 1.1rem; }
.crash-howto li { margin: 0.3rem 0; color: var(--ink-2); }

/* ── a unit ── */
.crash-unit { padding: 2rem 0; border-top: 1px solid var(--rule); scroll-margin-top: 1rem; }
.crash-unit__head { display: flex; align-items: baseline; gap: 0.75rem; }
.crash-unit__num { flex: none; font-family: var(--serif); font-size: 1.6rem; color: var(--accent-ink); }
.crash-unit__title { font-family: var(--serif); font-size: 1.55rem; margin: 0; line-height: 1.2; }
.crash-frame { font-size: 1.08rem; color: var(--ink); margin: 0.6rem 0 1rem; font-style: italic; }
.crash-teach p { margin: 0 0 0.8rem; color: var(--ink-2); line-height: 1.6; }
.crash-h { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); margin: 1.6rem 0 0.6rem; }

.crash-phrases { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.crash-phrase { display: grid; gap: 0.1rem; padding: 0.7rem 0.9rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--r); }
.crash-phrase__es, .crash-menu dt, .crash-line__es, .crash-try__answer { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); }
.crash-phrase__say { font-size: 0.88rem; color: var(--ink-3); letter-spacing: 0.01em; }
.crash-phrase__en { color: var(--ink-2); }
.crash-phrase__note { font-size: 0.88rem; color: var(--ink-3); margin-top: 0.15rem; }

/* the listen button crashcourse.js puts beside a phrase */
.crash-say { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; margin-left: 0.4rem; vertical-align: middle; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface-2); color: var(--ink-2); cursor: pointer; padding: 0; }
.crash-say:hover { border-color: var(--accent); color: var(--ink); }
.crash-say svg { width: 1rem; height: 1rem; }

.crash-menu { margin: 0; display: grid; gap: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.crash-menu__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 0.75rem; padding: 0.55rem 0.9rem; border-top: 1px solid var(--rule); }
.crash-menu__row:first-child { border-top: 0; }
.crash-menu dt { font-size: 1.02rem; }
.crash-menu dd { margin: 0; }
@media (max-width: 520px) { .crash-menu__row { grid-template-columns: 1fr; gap: 0.1rem; } }

.crash-dialogue { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.45rem; }
.crash-line { display: grid; gap: 0.1rem; max-width: 85%; padding: 0.6rem 0.9rem; border-radius: var(--r); background: var(--surface); border: 1px solid var(--rule); }
.crash-line--you { margin-left: auto; background: var(--surface-2); }
.crash-line__who { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.crash-line__es { font-size: 1.05rem; }

.crash-try { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.crash-try details { border: 1px dashed var(--rule-2, var(--rule)); border-radius: var(--r); padding: 0.55rem 0.9rem; background: var(--paper); }
.crash-try summary { cursor: pointer; color: var(--ink); }
.crash-try summary::marker { color: var(--ink-3); }
.crash-try__answer { display: block; margin-top: 0.35rem; }

.crash-quiz { margin: 0; padding-left: 1.2rem; display: grid; gap: 1rem; }
.crash-q__q { margin: 0 0 0.4rem; font-weight: 600; }
.crash-q__options { display: grid; gap: 0.3rem; }
.crash-q__option { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.45rem 0.7rem; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--surface); cursor: pointer; }
.crash-q__option.is-right { border-color: var(--accent); background: var(--surface-2); }
.crash-q__option.is-wrong { opacity: 0.6; text-decoration: line-through; }
.crash-q__why { margin-top: 0.4rem; font-size: 0.92rem; color: var(--ink-2); }
.crash-q__why summary { cursor: pointer; color: var(--ink-3); }
.crash-q__why p { margin: 0.3rem 0 0; }

.crash-done { margin: 1.5rem 0 0; font-weight: 600; }
.crash-done label { display: inline-flex; gap: 0.5rem; align-items: center; cursor: pointer; }
.crash-next { margin: 2rem 0 0; padding-top: 1.5rem; border-top: 1px solid var(--rule); color: var(--ink-2); }

/* ── Hide the English: the third line blanks until tapped ── */
.crash--cover .crash-phrase__en { color: transparent; background: var(--surface-2); border-radius: var(--r-s); cursor: pointer; user-select: none; }
.crash--cover .crash-phrase__en.is-shown { color: var(--ink-2); background: none; }

/* ── printing it, or saving it as a PDF for the flight ── */
@media print {
  .crash-side, .crash-say, .crash-done, .crash-next, .lib-chrome, .site-header, .site-footer { display: none !important; }
  .crash-layout { display: block; }
  .crash-unit { break-before: auto; }
  .crash-phrase, .crash-menu__row, .crash-line, .crash-q { break-inside: avoid; }
  .crash-try details > *, .crash-q__why > * { display: block; }
}
.crash-menu dd .crash-phrase__say { display: block; }

/* ── one part at a time (crashcourse.js) ──
 * With the script, each part folds to a row: number, title, a tick when done. The open part
 * reads top to bottom and ends with its tick and a button to the next part. Phrases sit in one
 * card as rows (the language, then how to say it beside the English) instead of a card each,
 * so a screen holds six phrases, not three. Without the script none of this applies. */
.crash-howto { padding: 0.75rem 1.1rem; margin-bottom: 1.25rem; }
.crash-howto > summary { cursor: pointer; list-style-position: inside; }
.crash-howto[open] > summary { margin-bottom: 0.4rem; }

.crash-unit { padding: 0; }
.crash-unit__head { display: block; }
.crash-unit__toggle { display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.9rem 0.1rem; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.crash-unit__toggle .crash-unit__num { width: 2rem; height: 2rem; border-radius: 50%; display: inline-grid; place-items: center; background: var(--surface-2); font-size: 1rem; font-family: inherit; color: var(--ink-2); }
.crash-unit__toggle .crash-unit__title { flex: 1; font-size: 1.15rem; }
.crash-unit__toggle::after { content: ''; flex: none; width: 0.55rem; height: 0.55rem; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); margin: 0 0.4rem 0.25rem; transition: transform .15s; }
.crash-unit.is-open .crash-unit__toggle::after { transform: rotate(225deg); margin-bottom: -0.2rem; }
.crash-unit.is-open .crash-unit__toggle .crash-unit__num { background: var(--accent); color: var(--on-accent, #1d1b18); }
.crash-unit.is-open .crash-unit__toggle .crash-unit__title { font-size: 1.45rem; }
.crash-unit__tick { display: none; flex: none; font-size: 0.75rem; font-weight: 600; color: var(--accent-ink); }
.crash-unit.is-done .crash-unit__tick { display: inline; }
.crash-unit.is-done .crash-unit__tick::before { content: '✓ done'; }
.crash-unit__toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-s); }
.crash-unit__body { padding: 0 0 1.75rem; }
.crash-frame--lead { margin-top: 0; padding: 0.7rem 0.9rem; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--r-s) var(--r-s) 0; font-style: normal; }

.crash-teach p { padding-left: 0.9rem; border-left: 2px solid var(--rule); }
.crash-teach p strong { color: var(--ink); }
.crash-more { margin: 0 0 0.5rem 0.9rem; padding: 0.35rem 0.85rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 0.9rem; cursor: pointer; }
.crash-more:hover { border-color: var(--accent); color: var(--ink); }

[data-crash] .crash-phrases { gap: 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); overflow: hidden; }
[data-crash] .crash-phrase { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 0.6rem; row-gap: 0.1rem; padding: 0.55rem 0.9rem; border: 0; border-top: 1px solid var(--rule); border-radius: 0; background: none; }
[data-crash] .crash-phrase:first-child { border-top: 0; }
[data-crash] .crash-phrase__es { flex-basis: 100%; }
[data-crash] .crash-phrase .crash-phrase__say::after { content: ' ·'; color: var(--ink-3); }
[data-crash] .crash-phrase__note { flex-basis: 100%; margin-top: 0; }
[data-crash] .crash-say { width: 1.7rem; height: 1.7rem; }

.crash-unit__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; margin-top: 1.75rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.crash-unit__foot .crash-done { margin: 0; }
.crash-next-btn { margin-left: auto; padding: 0.6rem 1.1rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent, #1d1b18); font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.crash-next-btn:hover, .crash-next-btn:focus-visible { filter: brightness(1.06); outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 899px) {
  .crash-toc ol { columns: 1; }
  .crash-toc a { padding: 0.25rem 0.4rem; font-size: 0.9rem; }
}
@media print {
  .crash-unit__toggle::after, .crash-more, .crash-unit__foot .crash-next-btn { display: none !important; }
}
/* On a phone the folded parts ARE the contents list, so the separate one goes. */
@media (max-width: 899px) { .crash--folding .crash-toc { display: none; } .crash--folding .crash-tools { margin-top: 0; padding-top: 0; border-top: 0; } }

/* ── the quick reference (course.reference): numbers, the clock, days, directions, emergencies ──
 * Chips jump to a table; each table folds, so the section is one screen until it is used. */
.crash-ref { margin: 0 0 1.75rem; }
.crash-ref__title { font-family: var(--serif); font-size: 1.3rem; margin: 0 0 0.2rem; }
.crash-ref__lede { margin: 0 0 0.7rem; color: var(--ink-3); font-size: 0.92rem; }
.crash-ref__chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 0.8rem; }
.crash-ref__chips a { padding: 0.35rem 0.8rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 0.88rem; text-decoration: none; }
.crash-ref__chips a:hover, .crash-ref__chips a:focus-visible { border-color: var(--accent); }
.crash-ref__table { border-top: 1px solid var(--rule); scroll-margin-top: 1rem; }
.crash-ref__table:last-child { border-bottom: 1px solid var(--rule); }
.crash-ref__table > summary { cursor: pointer; padding: 0.7rem 0.1rem; font-weight: 600; }
.crash-ref__table[open] > summary { color: var(--accent-ink); }
.crash-ref__table[open] { padding-bottom: 0.9rem; }
.crash-ref__note { margin: 0 0 0.6rem; color: var(--ink-2); font-size: 0.92rem; }
.crash-menu--ref .crash-menu__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr); padding: 0.45rem 0.9rem; }
@media (max-width: 520px) { .crash-menu--ref .crash-menu__row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 0.5rem; } }
.crash-ref__n { display: inline-block; min-width: 2.6em; font-family: var(--sans, inherit); font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.crash-menu--ref dd .crash-phrase__say { display: block; }
.crash-toc__ref { margin: 0 0 0.5rem; font-size: 0.92rem; }
.crash-toc__ref a { color: var(--accent-ink); }
@media print { .crash-ref__chips { display: none; } .crash-ref__table > *:not(summary) { display: block; } }

/* ── the Cheat sheet button and sheet (crashcourse.js) ── */
.crash-fab { position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 50; padding: 0.7rem 1.1rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--on-accent, #1d1b18); font: inherit; font-weight: 700; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); cursor: pointer; }
.crash-fab:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.crash-sheet-open .crash-fab { display: none; }
.crash-sheet { width: min(46rem, 100vw); max-width: 100vw; max-height: 88vh; margin: auto auto 0; padding: 1.1rem 16px 1.5rem; border: 0; border-radius: 16px 16px 0 0; background: var(--paper, var(--surface)); color: var(--ink); overflow: auto; overscroll-behavior: contain; }
.crash-sheet::backdrop { background: rgba(0, 0, 0, 0.55); }
.crash-sheet .crash-ref { margin: 0; }
.crash-sheet__close { position: sticky; top: 0; float: right; z-index: 1; width: 2.2rem; height: 2.2rem; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface-2); color: var(--ink); font-size: 1.3rem; line-height: 1; cursor: pointer; }
@media print { .crash-fab { display: none !important; } }
