/*
 * A language's letters page (/hebrew/letters, /greek/letters, /akkadian/signs — LanguageLettersController,
 * Views/LanguageLetters/Letters.cshtml, 2026-11-09; a grid of tiles with a popup since 2026-11-14). Every colour
 * is the games' (aleph-bet-theme.css), and a letter's tile wears its group's tint as it does in the games:
 * --lg-bg/-edge/-ink/-mark are set on the tile from var(--ab-t{k}-…), which the Simple look (always on here)
 * makes the site blue. The phone rules are under max-width: 480px; the print rules at the foot.
 */

.lg { max-width: 1100px; margin: 0 auto; --lg-text: #374151; }

/* The scripts, each in the face the games draw it in. */
.lg-script[lang="he"] { font-family: 'SBL Hebrew', 'Times New Roman', serif; }
.lg-script[lang="el"] { font-family: 'GFS Neohellenic', Georgia, 'Times New Roman', serif; }
.lg-script[lang="akk"] { font-family: 'Assurbanipal', 'Noto Sans Cuneiform', 'Segoe UI Historic', sans-serif; }

/* The head of the page: the language's letters over its title, as on the language's own page. */
.lg-hero { text-align: center; padding: 1.5rem 1rem 1rem; }
.lg-hero-letters { font-size: 3.4rem; line-height: 1.2; letter-spacing: .25em; color: var(--ab-primary); margin-bottom: .25rem; }
.lg-hero-letters[lang="akk"] { letter-spacing: .15em; }
.lg-eyebrow { color: var(--ab-muted); font-weight: 800; font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; }
.lg-hero h1 { font-weight: 800; font-size: 2.4rem; margin: 0 0 .5rem; }
.lg-hero p { font-size: 1.15rem; color: var(--ab-muted); max-width: 42rem; margin: 0 auto; }

/* The sections as the language pages' pills, each with how many it holds; and the way to the games. */
.lg-nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; margin-top: 1.1rem; }
.lg-nav a { display: inline-flex; align-items: center; gap: .45rem; min-height: 2.5rem; padding: .3rem 1rem; border: 2px solid var(--ab-line); border-radius: 999px; background: var(--ab-surface); color: var(--ab-text-strong, #1f2937); font-weight: 700; text-decoration: none; }
.lg-nav a span { display: inline-flex; align-items: center; justify-content: center; min-width: 1.6rem; height: 1.5rem; padding: 0 .35rem; border-radius: 999px; background: var(--ab-page); color: var(--ab-muted); font-size: .8rem; font-weight: 800; }
.lg-nav a:focus-visible, .lg-play:focus-visible { outline: 3px solid var(--ab-primary-edge); outline-offset: 2px; }
.lg-nav a.lg-play, .lg-play { gap: .5rem; border-color: var(--ab-go); background: var(--ab-go); color: var(--ab-on-go); }
.lg-play { display: inline-flex; align-items: center; min-height: 2.9rem; padding: .5rem 1.4rem; border: 2px solid var(--ab-go); border-radius: 999px; font-weight: 800; text-decoration: none; }
.lg-play:hover, .lg-play:focus-visible { color: var(--ab-on-go); filter: brightness(1.06); text-decoration: none; }
@media (hover: hover) { .lg-nav a:not(.lg-play):hover { border-color: var(--ab-primary); color: var(--ab-primary); } }
.lg-foot { display: flex; justify-content: center; margin: 2.6rem 0 .5rem; }

/* A section: its heading in the language pages' small capitals. */
.lg-section { margin-top: 2.2rem; scroll-margin-top: 1rem; }
.lg-section-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .8rem; padding-bottom: .5rem; border-bottom: 2px solid var(--ab-line); }
.lg-section-head h2 { font-size: 1.15rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ab-primary); margin: 0; }
.lg-section-head p { color: var(--ab-muted); margin: 0; }

/* A group of a section (the vowels' sounds, the accents' ranks, Caplice's lessons). */
.lg-group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .7rem; margin: 1.8rem 0 0; }
.lg-group-head h3 { font-size: 1.15rem; font-weight: 800; margin: 0; color: var(--ab-text-strong, #1f2937); }
.lg-group-head p { margin: 0; color: var(--ab-muted); font-size: .95rem; }

/* The grid: a tile to a letter — the letter, its name, its sound in a few words — running the way the script
   does. A tile is a button; the rest of what is known of the letter opens in the popup below. */
.lg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .8rem; list-style: none; margin: 1rem 0 0; padding: 0; }
.lg-grid > li { display: flex; min-width: 0; }
.lg-tile { display: flex; flex-direction: column; align-items: center; gap: .1rem; width: 100%; min-width: 0; padding: .5rem .5rem .7rem; border: calc(2px * var(--ab-bw, 1)) solid var(--lg-edge); border-radius: 1.1rem; background: var(--ab-surface); color: var(--lg-text); font: inherit; text-align: center; cursor: pointer; box-shadow: 0 4px 12px rgba(var(--ab-shadow), .05); break-inside: avoid; }
.lg-tile:focus-visible { outline: 3px solid var(--lg-edge); outline-offset: 2px; }
@media (hover: hover) {
    .lg-tile { transition: transform .12s, box-shadow .12s; }
    .lg-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 20px rgba(var(--ab-shadow), .12); }
}
.lg-tile-glyph { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 6.6rem; margin-bottom: .4rem; border-radius: .75rem; background: var(--lg-bg); color: var(--lg-ink); font-size: 4.6rem; line-height: 1.15; white-space: nowrap; }
.lg-grid-el .lg-tile-glyph { font-size: 2.7rem; }
.lg-grid-akk .lg-tile-glyph { font-size: 3.4rem; }
.lg-tile-name, .lg-tile-sound { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; max-width: 100%; overflow-wrap: anywhere; }
.lg-tile-name { font-size: 1.08rem; font-weight: 800; line-height: 1.25; color: var(--ab-text-strong, #1f2937); }
.lg-tile-sound { font-size: .9rem; line-height: 1.3; color: var(--ab-muted); }

/* The popup: the tapped letter's card — the letter very big over all that is known of it — wearing the tile's
   tint (the script copies the tile's --lg-… onto it), with the way to the letters either side at its foot. */
html:has(.lg-pop[open]) { overflow: hidden; }
.lg-pop { width: min(36rem, calc(100vw - 1.5rem)); max-height: calc(100vh - 1.5rem); max-height: calc(100dvh - 1.5rem); padding: 0; border: calc(3px * var(--ab-bw, 1)) solid var(--lg-edge); border-radius: 1.4rem; background: var(--ab-surface); color: var(--lg-text); box-shadow: 0 24px 48px rgba(15, 23, 42, .28); overflow: hidden; }
.lg-pop[open] { display: flex; flex-direction: column; }
.lg-pop::backdrop { background: rgba(15, 23, 42, .5); }
.lg-pop-card { display: flex; flex-direction: column; gap: 1rem; min-height: 0; padding: 1rem 1rem 1.1rem; overflow-y: auto; overscroll-behavior: contain; }
.lg-pop-close { position: absolute; top: .55rem; inset-inline-end: .55rem; display: inline-flex; align-items: center; justify-content: center; width: 2.75rem; height: 2.75rem; padding: 0; border: 2px solid var(--ab-line); border-radius: 999px; background: var(--ab-surface); color: var(--ab-muted); font-size: 1.15rem; cursor: pointer; }
.lg-pop-close:focus-visible, .lg-pop-nav button:focus-visible { outline: 3px solid var(--lg-edge); outline-offset: 2px; }

.lg-face { display: flex; align-items: center; justify-content: center; gap: 2.2rem; min-height: 11rem; padding: .75rem 3.2rem; border-radius: 1rem; background: var(--lg-bg); color: var(--lg-ink); text-align: center; }
.lg-glyph { font-size: 8rem; line-height: 1.1; white-space: nowrap; }
.lg-glyph-el { font-size: 5rem; }
.lg-glyph-akk { font-size: 6rem; }
.lg-on { font-size: .85rem; font-weight: 700; line-height: 1.2; opacity: .85; }
.lg-on .lg-script { display: block; font-size: 3.2rem; line-height: 1.25; font-weight: 400; color: var(--lg-mark); }

.lg-body { min-width: 0; padding: 0 .3rem; color: var(--lg-text); }
.lg-body h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .8rem; font-size: 1.9rem; font-weight: 800; margin: 0 0 .35rem; color: var(--ab-text-strong, #1f2937); }
.lg-spelled { font-size: 2.1rem; font-weight: 400; color: var(--lg-ink); }
.lg-sound { margin: 0 0 .4rem; font-size: 1.2rem; font-weight: 700; color: var(--lg-ink); }
.lg-say { display: flex; align-items: baseline; gap: .45rem; margin: 0 0 .5rem; font-size: 1.05rem; color: var(--ab-muted); }
.lg-say strong { color: var(--lg-text); }
.lg-detail { margin: 0; font-size: 1.08rem; line-height: 1.5; }

/* A word it begins: the flashcards' example, without its picture. */
.lg-example { display: inline-flex; margin-top: .7rem; padding: .4rem .9rem; border-radius: .9rem; background: var(--lg-bg); }
.lg-example-words { display: flex; align-items: baseline; flex-wrap: wrap; gap: .1rem .7rem; min-width: 0; font-size: 1rem; color: var(--lg-ink); }
.lg-example-word { font-size: 1.8rem; line-height: 1.3; }

/* The foot of the popup: the letter before, where this one stands, the letter after — in the script's
   direction, as the grid is, so in Hebrew the next letter is to the left. */
.lg-pop-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-shrink: 0; padding: .6rem .7rem; border-top: 2px solid var(--ab-line); }
.lg-pop-nav button { display: inline-flex; align-items: center; gap: .5rem; min-height: 2.75rem; min-width: 0; padding: .3rem .9rem; border: 2px solid var(--ab-line); border-radius: 999px; background: var(--ab-surface); color: var(--ab-text-strong, #1f2937); font: inherit; font-weight: 700; cursor: pointer; }
.lg-pop-nav button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-pop-nav button:disabled { visibility: hidden; }
.lg-pop-nav[dir="rtl"] button i { transform: scaleX(-1); }
.lg-pop-count { flex-shrink: 0; color: var(--ab-muted); font-size: .9rem; font-weight: 700; }
@media (hover: hover) { .lg-pop-nav button:hover, .lg-pop-close:hover { border-color: var(--lg-edge); color: var(--lg-ink); } }

@media (max-width: 480px) {
    .lg-hero { padding-top: .75rem; }
    .lg-hero-letters { font-size: 2.6rem; }
    .lg-hero h1 { font-size: 1.9rem; }
    .lg-hero p { font-size: 1rem; }
    .lg-nav { gap: .4rem; }
    .lg-nav a { padding: .25rem .8rem; font-size: .95rem; }
    .lg-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
    .lg-tile { padding: .35rem .35rem .55rem; border-radius: .9rem; }
    .lg-tile-glyph { min-height: 4.7rem; margin-bottom: .3rem; border-radius: .6rem; font-size: 3.3rem; }
    .lg-grid-el .lg-tile-glyph { font-size: 1.9rem; }
    .lg-grid-akk .lg-tile-glyph { font-size: 2.4rem; }
    .lg-tile-name { font-size: .95rem; }
    .lg-tile-sound { font-size: .8rem; -webkit-line-clamp: 3; line-clamp: 3; }
    .lg-pop-card { padding: .7rem .7rem .9rem; gap: .8rem; }
    .lg-face { min-height: 8.5rem; gap: 1.4rem; padding: .5rem 2.8rem; }
    .lg-glyph { font-size: 6rem; }
    .lg-glyph-el { font-size: 3.6rem; }
    .lg-glyph-akk { font-size: 4.2rem; }
    .lg-on .lg-script { font-size: 2.6rem; }
    .lg-body h2 { font-size: 1.5rem; }
    .lg-spelled { font-size: 1.6rem; }
    .lg-sound { font-size: 1.08rem; }
    .lg-say, .lg-detail { font-size: 1rem; }
    .lg-example-word { font-size: 1.5rem; }
    .lg-pop-nav { padding: .5rem; }
    .lg-pop-nav button { padding: .3rem .7rem; }
}
@media (pointer: coarse) { .lg-nav a { min-height: 2.75rem; } }

/* On paper: the grid as a chart for the wall, in ink a printer can lay down — no site around it, no links to
   play, no popup. */
@media print {
    nav.navbar, footer, .lg-nav, .lg-foot, .lg-pop, .lg-tip { display: none !important; }
    body, body.bg-mtb, .stb-shell-main { background: #fff !important; }
    .lg-hero { padding: 0 0 .5rem; }
    .lg-hero-letters { font-size: 2.2rem; }
    .lg-hero h1 { font-size: 1.8rem; }
    .lg-section { margin-top: 1.2rem; break-before: auto; }
    .lg-section + .lg-section { break-before: page; }
    /* Seven across: the 31 Hebrew letters are then one page with their heading. A group stays whole, under its heading. */
    .lg-group { break-inside: avoid; }
    .lg-grid { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .35rem; }
    .lg-tile { box-shadow: none; padding: .3rem .3rem .4rem; border-radius: .7rem; }
    .lg-tile-glyph { min-height: 4.4rem; margin-bottom: .2rem; font-size: 3.2rem; }
    .lg-grid-el .lg-tile-glyph { font-size: 2rem; }
    .lg-grid-akk .lg-tile-glyph { font-size: 2.5rem; }
    .lg-tile-name { font-size: .9rem; -webkit-line-clamp: 4; line-clamp: 4; }
    .lg-tile-sound { font-size: .75rem; -webkit-line-clamp: 4; line-clamp: 4; }
    .lg-group-head, .lg-section-head { break-after: avoid; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
