/*
 * The script primer page (LibraryPageController::alphabet, ScriptPrimers).
 *
 * Built from the library's tokens only (library.css section 1), so it turns dark with the
 * rest. Letters are tiles in a grid: the letter large, its romanisation, the sound in a line or
 * two. Three tiles across on a phone, more on a wide screen. A tile is a button: alphabet.js
 * makes it speak.
 */

.abc-meta { margin: 0.6rem 0 0; color: var(--ink-2); font-size: 0.95rem; }
.abc-main { max-width: 52rem; }

.abc-intro p { margin: 0 0 0.8rem; color: var(--ink-2); line-height: 1.6; }
.abc-intro__rom { font-size: 0.92rem; color: var(--ink-3); }
.abc-voice-note { font-size: 0.9rem; color: var(--ink-3); }

.abc-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.25rem 0 0.5rem; }
.abc-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; }
.abc-chips a:hover, .abc-chips a:focus-visible { border-color: var(--accent); }

.abc-group { padding: 1.75rem 0 0.5rem; border-top: 1px solid var(--rule); margin-top: 1.25rem; scroll-margin-top: 1rem; }
.abc-h2 { font-family: var(--serif); font-size: 1.4rem; line-height: 1.25; margin: 0 0 0.4rem; }
.abc-note { margin: 0 0 1rem; color: var(--ink-2); line-height: 1.55; }
.abc-teach p { margin: 0 0 0.8rem; color: var(--ink-2); line-height: 1.6; padding-left: 0.9rem; border-left: 2px solid var(--rule); }

/* ── the letters ── */
.abc-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.5rem; }
@media (max-width: 520px) { .abc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.abc-grid li { display: flex; }
.abc-tile, .abc-example { display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; width: 100%; padding: 0.7rem 0.75rem 0.75rem; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.abc-tile:hover, .abc-example:hover { border-color: var(--accent); }
.abc-tile:focus-visible, .abc-example:focus-visible, .abc-part:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.abc-tile.is-speaking, .abc-example.is-speaking { border-color: var(--accent); background: var(--surface-2); }
.abc-tile__char { font-family: var(--serif); font-size: 2rem; line-height: 1.25; font-weight: 600; }
.abc-tile__rom { font-weight: 700; color: var(--accent-ink); }
.abc-tile__name { font-size: 0.85rem; color: var(--ink-3); }
.abc-tile__sound { font-size: 0.86rem; line-height: 1.4; color: var(--ink-2); }
.abc-tile__eg { font-size: 0.82rem; color: var(--ink-3); }

/* ── how vowels attach ── */
.abc-examples { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); gap: 0.5rem; }
@media (max-width: 520px) { .abc-examples { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.abc-examples li { display: flex; }
.abc-example__text { font-family: var(--serif); font-size: 1.8rem; line-height: 1.3; font-weight: 600; }
.abc-example__parts { color: var(--ink-2); font-size: 1rem; }
.abc-example__rom { font-weight: 700; color: var(--accent-ink); }
.abc-example__note { font-size: 0.84rem; color: var(--ink-3); line-height: 1.4; }

/* ── read a word ── */
.abc-words { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.abc-word { padding: 0.9rem 1rem; border: 1px solid var(--rule); border-radius: var(--r); background: var(--surface); }
.abc-word__word { margin: 0 0 0.5rem; font-family: var(--serif); font-size: 2.1rem; line-height: 1.3; font-weight: 600; }
.abc-word__parts { list-style: none; margin: 0 0 0.6rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
.abc-part { display: inline-flex; flex-direction: column; align-items: center; min-width: 3rem; padding: 0.35rem 0.6rem; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--paper); color: var(--ink); font: inherit; cursor: pointer; }
.abc-part__text { font-family: var(--serif); font-size: 1.35rem; line-height: 1.3; }
.abc-part__rom { font-size: 0.88rem; font-weight: 700; color: var(--accent-ink); min-height: 1.2em; }
.abc-part__note { font-size: 0.75rem; color: var(--ink-3); }
/* With the script, a piece's romanisation is a blank until tapped. */
.abc--practice .abc-part:not(.is-shown) .abc-part__rom,
.abc--practice .abc-part:not(.is-shown) .abc-part__note { color: transparent; background: var(--surface-2); border-radius: 4px; min-width: 1.5rem; }
.abc--practice .abc-part:not(.is-shown) .abc-part__note { display: none; }
.abc-word__check summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; }
.abc-word__answer { margin: 0.4rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.abc-word__note, .abc-word__dict { margin: 0.3rem 0 0; font-size: 0.9rem; color: var(--ink-2); }

.abc-say { display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface-2); color: var(--ink-2); cursor: pointer; padding: 0; }
.abc-say:hover { border-color: var(--accent); color: var(--ink); }
.abc-say svg { width: 1rem; height: 1rem; }

/* ── the quiz ── */
.abc-quiz { margin: 0; padding-left: 1.2rem; display: grid; gap: 1rem; }
.abc-q__q { margin: 0 0 0.3rem; font-weight: 600; }
.abc-q__show { margin: 0 0 0.4rem; font-family: var(--serif); font-size: 2.2rem; line-height: 1.25; font-weight: 600; }
.abc-q__options { display: grid; grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); gap: 0.35rem; }
.abc-q__options--script span { font-family: var(--serif); font-size: 1.4rem; }
.abc-q__option { display: flex; gap: 0.5rem; align-items: center; padding: 0.45rem 0.7rem; border: 1px solid var(--rule); border-radius: var(--r-s); background: var(--surface); cursor: pointer; }
.abc-q__option.is-right { border-color: var(--accent); background: var(--surface-2); }
.abc-q__option.is-wrong { opacity: 0.6; text-decoration: line-through; }
.abc-q__why { margin-top: 0.4rem; font-size: 0.92rem; color: var(--ink-2); }
.abc-q__why summary { cursor: pointer; color: var(--ink-3); }
.abc-q__why p { margin: 0.3rem 0 0; }
.abc-score { margin: 1rem 0 0; font-weight: 600; }

.abc-review { margin: 2rem 0 0; padding: 0.7rem 0.9rem; border-left: 3px solid var(--rule); background: var(--surface); color: var(--ink-3); font-size: 0.9rem; }
.abc-next { margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.abc-next ul { margin: 0; padding-left: 1.1rem; color: var(--ink-2); }
.abc-next li { margin: 0.35rem 0; }

@media print {
  .abc-chips, .abc-say, .lib-chrome, .site-header, .site-footer { display: none !important; }
  .abc-tile, .abc-word, .abc-q { break-inside: avoid; }
}

/* Arabic's joined forms and Hebrew's letter names are in the script: give them room. */
.abc-tile__name[dir="rtl"] { font-size: 1.1rem; line-height: 1.5; color: var(--ink-2); }
