/* ===========================
   Web font: EB Garamond (self-hosted; free Garamond for consistent rendering
   across devices where the system "Garamond" is absent — e.g. iOS/Android).
   Variable fonts: one file per style covers weights 400-800.
=========================== */

@font-face {
    font-family: 'EB Garamond';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/ebgaramond/ebgaramond-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'EB Garamond';
    font-style: normal;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/ebgaramond/ebgaramond-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'EB Garamond';
    font-style: italic;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/ebgaramond/ebgaramond-italic-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'EB Garamond';
    font-style: italic;
    font-weight: 400 800;
    font-display: swap;
    src: url('/fonts/ebgaramond/ebgaramond-italic-latinext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ===========================
   General Page Styles
=========================== */

body {
    font-family: 'EB Garamond', Garamond, Georgia, Times, serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

/* ===========================
   Lists
=========================== */

ul {
    font-size: small;
    list-style-type: none;
    padding: 0;
    margin: 0;
    margin-left: 12px;
}

li {
    font-size: small;
    list-style-type: disc;
    padding: 0;
    margin: 0;
    margin-left: 6px;
}

/* Fold-out section headers — circles for parents, dots for children.
   Class-based; replaces the vestigial #foldheader / #foldinglist ID
   selectors that never matched anything. */
.fold-header {
    cursor: pointer;
    list-style-type: circle;
}

.fold-list {
    display: none;
    list-style-type: disc;
    padding-left: 1rem;
}

/* ===========================
   Printing Styles
=========================== */

.PageBreakBefore {
    page-break-after: always;
}

.PageBreakAfter {
    page-break-before: always;
}

/* ===========================
   Link Styles
=========================== */

a:link {
    color: #000099;
    text-decoration: none;
}

a:visited {
    color: #663366;
    text-decoration: none;
}

a:hover {
    color: #cccc00;
    text-decoration: underline;
}

a:active {
    color: #009900;
    text-decoration: underline;
}

/* ===========================
   Header / Title Graphic
=========================== */

.site-header {
    margin-top: 20px;
    margin-bottom: 20px;
}

.header-graphic {
    display: block;
    margin: 0 auto;
    max-width: 95%;   /* default for desktop */
    height: auto;
}

@media (max-width: 767px) {
    .header-graphic {
        max-height: 20vh;   /* phones */
        max-width: 90%;
    }
}

/* ===========================
   Main Image
=========================== */

#main-image {
    display: block;
    margin: 0 auto;
    max-width: 95%;
    height: auto;
}

/* ===========================
   Cryptogram / Puzzle Layout
=========================== */

.cryptogram {
    font-family: "Courier New", Courier, monospace;
    white-space: pre;
    letter-spacing: 0.08em;
}

/* ===========================
   Character images (column banners)
=========================== */

/* The three Wonderland character PNGs sit at the top of each
   resource column as small icons, ~124px tall (matching the
   placeholder height in the _live mockup and within range of the
   2008 site's 100-122px display sizes). Centered horizontally;
   width scales with the image's natural aspect ratio. */
.character-image {
    display: block;
    margin: 0 0 0.75rem 0;   /* left-justified, to align with the link tree below */
    max-height: 180px;       /* larger -- reads more naturally */
    width: auto;
    max-width: 100%;
}

/* Section titles above each resource cluster's character image. */
.resource-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 0.4rem 0;
}

/* Site-wide return-home mark (top-left of every inner page; hidden on home). */
.home-mark {
    display: inline-block;
    margin: 0.75rem 0 0.5rem 0;
}

.home-mark img {
    height: 50px;
    width: auto;
    display: block;
}

/* Tablet and up: let the return mark read as a banner. */
@media (min-width: 768px) {
    .home-mark img {
        height: 84px;
    }
}

/* Homepage search box (text + category-scope checkboxes). */
.home-search {
    text-align: center;
}

.home-search-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* centre the textbox + button */
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.home-search-row .form-control {
    flex: 0 1 18rem;   /* shorter textbox, doesn't hog the row */
}

.home-search-scopes {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;   /* checkboxes on their own centred second line */
    gap: 1rem;
    font-size: small;
    margin: 0;
}

.home-search-scopes label {
    cursor: pointer;
}

/* Authoring dashboard (dev-only quiz creator) */
.author-form { max-width: 48rem; }
.auth-label { display: block; margin: 0.5rem 0; font-weight: 600; }
.auth-label .form-control { font-weight: 400; }
.auth-scopes { border: 1px solid #ddd; border-radius: 5px; padding: 0.4rem 0.75rem; margin: 0.75rem 0; }
.auth-scopes legend { font-size: 1rem; font-weight: 600; width: auto; padding: 0 0.3rem; }
.auth-scopes label { margin-right: 1rem; }
.qcard { border: 1px solid #ccc; border-radius: 6px; padding: 0.75rem; margin: 0.6rem 0; background: #fafafa; }
.qcard-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.q-stem { margin-bottom: 0.5rem; }
.opt-row { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.3rem; }
.opt-row .opt-text { flex: 2 1 auto; }
.opt-row .opt-feedback { flex: 1 1 10rem; }
.add-buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.75rem 0; }

/* Search results */
.search-results .search-title {
    font-size: 1.15rem;
    font-weight: 600;
}
.search-results .search-snippet {
    font-size: 0.95rem;
    margin-top: 0.15rem;
}

/* Shape Shifters — the abstract shapes (restored from .swf as SVG line art). */
.shape-img {
    display: block;
    width: 320px;
    max-width: 85%;
    height: auto;
    margin: 0.25rem 0 0.75rem;
    border: 4px double #000;   /* bold double frame — the shapes (e.g. the "brick") need a strong canvas edge */
    border-radius: 4px;
    padding: 0.55rem;
    background: #fff;
}

/* The poem's companion cartoon. */
.poem-figure {
    margin: 1.25rem 0 0;
    text-align: center;
}

.poem-figure img {
    width: 100%;
    max-width: 420px;
    height: auto;
}

.poem-figure figcaption {
    font-size: small;
    font-style: italic;
    color: #666;
    margin-top: 0.25rem;
}

/* Bad Ideas lesson mascot (the rattlesnake) — floated so the text wraps. */
.lesson-mascot {
    float: left;
    width: 150px;
    max-width: 40%;
    height: auto;
    margin: 0 1rem 0.5rem 0;
}

/* Quiz intro / word-bank panel — a crisp reference block (was a muted
   fst-italic text-secondary wrapper that made word banks look de-emphasized). */
.quiz-intro {
    border: 1px solid #d8d8d8;
    border-left: 3px solid #888;
    background: #fafafa;
    border-radius: 4px;
    padding: 0.75rem 1rem;
}

.quiz-intro details {
    margin-top: 0.5rem;
}

.quiz-intro summary {
    cursor: pointer;
    font-weight: 600;
}

/* Homepage fold-tree (expand/collapse menu, leaves link to content) */
.foldtree,
.foldtree .fold-children {
    list-style: none;
    margin: 0;
    padding-left: 0;
}

/* Kill the stray disc bullet the global `li` rule leaks onto every tree row;
   the gray caret (branches) / clean indent (leaves) is the only marker we want. */
.foldtree .fold-branch,
.foldtree .fold-leaf {
    list-style: none;
}

.foldtree .fold-children {
    padding-left: 1.1rem;
}

.foldtree .fold-branch > .fold-toggle {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: 0;
    padding: 0.15rem 0;
    font: inherit;
    font-weight: 600;
    color: inherit;
    cursor: pointer;
}

/* Black dot markers on every row (JR prefers the dots over carets; suits the
   Garamond/Times feel, and expansion is self-evident on click. Branches stay
   bold, so categories still read as distinct from leaf links). */
.foldtree .fold-branch > .fold-toggle::before,
.foldtree .fold-leaf a::before {
    content: "\2022";          /* • */
    display: inline-block;
    width: 1.1em;
    color: #000;
    font-size: 0.9em;
}

.foldtree .fold-leaf a {
    display: block;
    padding: 0.12rem 0;   /* the ::before dot supplies the left indent */
}

/* On narrow screens the resource columns stack — centre the image + tree as a
   block, but keep the tree text left-aligned in a fixed-width box so expanding
   a branch doesn't shift the whole column around. */
@media (max-width: 767.98px) {
    .home-resources {
        text-align: center;
    }

    .home-resources .character-image {
        margin-left: auto;
        margin-right: auto;
    }

    .home-resources .foldtree {
        display: inline-block;
        text-align: left;
        width: 100%;
        max-width: 22rem;
    }
}

/* Decryptifier — on-screen cryptogram solver (responsive). */
.dx-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.5rem 0 1.25rem;
}

.dx-puzzle {
    font-family: "Courier New", monospace;
    line-height: 2.8;
}

.dx-word {
    display: inline-block;
    white-space: nowrap;
    margin: 0 0.55rem 0.4rem 0;
}

.dx-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 1.5rem;
    vertical-align: bottom;
}

.dx-in {
    width: 1.4rem;
    text-align: center;
    text-transform: uppercase;
    font-family: inherit;
    font-size: 16px;          /* >=16px so mobile browsers don't zoom on focus */
    border: 0;
    border-bottom: 2px solid #555;
    padding: 0;
    background: transparent;
}

.dx-in:focus {
    outline: none;
    border-bottom-color: #0d6efd;
    background: #eef4ff;
}

/* Decryptifier: intro text, button captions, and the cipher hints under the
   blanks all solid black (were faint grey / muted on JR's laptop). */
.dx-intro {
    color: #000;
}

.dx-controls .btn {
    color: #000;
}

.dx-cipher {
    font-size: 0.7rem;
    color: #000;
    margin-top: 0.1rem;
}

.dx-punc {
    display: inline-block;
    vertical-align: bottom;
}

/* ===========================
   Placeholder / Ad Banner
=========================== */

.placeholder {
    background-color: #ddd;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.placeholder.ad {
    min-height: 80px;
    max-height: 120px;
    font-size: 1rem;
}

/* ===========================
   Daily features (homepage slots flanking the title)
   ===========================
   One DailyFeature ContentBlock per kind renders via per-region format
   templates that emit these stable class names. The slot containers are
   .daily-feature; each region has its own class (df-*). */

.daily-feature {
    font-size: 0.95rem;
    text-align: center;
}

.df-heading {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #777;
    margin-bottom: 0.35rem;
}

/* Cryptogram: monospaced, wide word spacing -- a puzzle to decode. */
.df-cryptogram {
    font-family: "Courier New", Courier, monospace;
    word-spacing: 0.4em;
    line-height: 1.6;
    text-align: justify;
}

.df-word {
    font-weight: 700;
}

.df-pos {
    font-style: italic;
    color: #777;
    margin-left: 0.25rem;
}

.df-definition {
    display: block;
    color: #444;
}

.df-pun {
    font-style: italic;
}

.df-empty {
    color: #aaa;
    font-style: italic;
    font-size: 0.85rem;
    margin: 0;
}

@media (max-width: 767px) {
    .placeholder.ad {
        min-height: 60px;
        font-size: 0.9rem;
    }
}

/* ===========================
   Readers
===========================
   A book-like reading column: capped measure, serif face, roomy leading.
   Scoped to .reader so the rest of the site is untouched. */

.reader {
    max-width: 40rem;
    margin: 0 auto;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.075rem;
    line-height: 1.7;
    color: #222;
}

.reader h1 {
    margin-bottom: 0.25rem;
}

.reader p {
    margin-bottom: 1rem;
}

.reader-byline {
    margin-bottom: 1rem;
    font-style: italic;
}

/* The preface is editorial framing -- sans-serif (against the serif story
   text) in a bordered, softly tinted box, so it reads as "our note". */
.reader-preface {
    font-family: var(--bs-body-font-family, system-ui, sans-serif);
    background-color: #faf9f6;
    border: 1px solid #cfc9bd;
    border-radius: 5px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.75rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: #444;
}

.reader-preface p:last-child {
    margin-bottom: 0;
}

.reader-chapter h2 {
    margin-top: 1.75rem;
}

/* Footer nav aligned to the reading column. */
.reader-footer {
    max-width: 40rem;
    margin: 1.5rem auto 0;
}

/* Generic article (Tips and other prose with parent + sections): a readable
   centered column (sans-serif, unlike the literary serif reader). */
.article {
    max-width: 46rem;
    margin: 0 auto;
}

.article-section h2 {
    margin-top: 1.5rem;
}

.article-footer {
    max-width: 46rem;
    margin: 1.5rem auto 0;
}

/* Grammar lessons -- reuse the .article reading column, add structure for
   Part headings, indented examples, timeline figures and the verb tables. */
.grammar-lesson {
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Section titles as a full-width grey stripe, echoing the legacy bgcolor bar. */
.grammar-lesson h2 {
    margin-top: 2rem;
    margin-bottom: 0.9rem;
    padding: 0.4rem 0.7rem;
    background-color: #d9d9d9;
    font-size: 1.1rem;
    font-weight: 700;
}

.grammar-lesson p {
    margin-bottom: 0.75rem;
}

/* Examples: a plain left offset (no quote-bar). */
.grammar-lesson .example {
    margin: 0.35rem 0 0.35rem 1.75rem;
}

.grammar-fig {
    margin: 0.6rem 0 0.6rem 1.75rem;
}

/* Info/warning callout: icon in a left column beside a group of lines,
   echoing the legacy rowspan-icon layout. */
.grammar-note {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 0.85rem 0 0.85rem 1rem;
}

.grammar-note-icon {
    flex: 0 0 auto;
    width: 30px;
    height: auto;
    margin-top: 0.2rem;
}

.grammar-note-body {
    flex: 1 1 auto;
}

.grammar-note-body p {
    margin-bottom: 0.35rem;
}

.grammar-fig img {
    max-width: 100%;
    height: auto;
}

.verb-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0 1.5rem;
}

.verb-table th,
.verb-table td {
    padding: 0.35rem 0.6rem;
    text-align: left;
}

.verb-table thead th {
    border-bottom: 2px solid #cccccc;
}

.verb-table tbody tr:nth-child(even) {
    background-color: #f2f2f2;
}

.grammar-subtable {
    border-collapse: collapse;
    margin: 0.5rem 0 0.75rem 1.25rem;
}

.grammar-subtable td {
    padding: 0.25rem 0.7rem 0.25rem 0;
    vertical-align: top;
}

/* Lessons -- a slightly wider reading column (some lessons carry printable
   grids/matrices) with responsive images and tables. Legacy table borders
   are left to the migrated markup. */
.lesson-content {
    max-width: 52rem;
    margin: 0 auto;
    line-height: 1.55;
}

.lesson-content img {
    max-width: 100%;
    height: auto;
}

.lesson-content table {
    max-width: 100%;
}

/* Mobile: legacy lesson layout-tables have fixed cell widths (e.g. width="485")
   that don't collapse, leaving body text crammed into the left half. Stack the
   cells to one full-width column and un-float the mascot. */
@media (max-width: 767.98px) {
    .lesson-content table,
    .lesson-content tbody,
    .lesson-content tr,
    .lesson-content td,
    .lesson-content th {
        display: block;
        width: 100% !important;
        height: auto !important;   /* kill legacy height="600"/height="12%" that overlap when stacked */
    }

    .lesson-mascot {
        float: none;
        display: block;
        margin: 0 auto 0.75rem;
        max-width: 55%;
    }
}

/* Clear any legacy floats so the "Back to Lessons" footer never overlaps content. */
.lesson-content::after { content: ""; display: table; clear: both; }
.article-footer { clear: both; }

/* Amusements -- poem rendering. */
.poem {
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.55;
    margin: 1.25rem 0;
}

.poem p {
    margin-bottom: 1.1rem;
}

.poem-intro {
    color: #555;
}

.retired-media {
    color: #888;
    font-size: 0.9rem;
    margin-top: 1.5rem;
}

/* Creativity -- Shape Shifters reveal blocks. */
.puzzle-intro {
    color: #555;
    margin-bottom: 1.25rem;
}

.shape-shifters .shape {
    margin: 1.25rem 0;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.shape-shifters details summary {
    cursor: pointer;
    color: #0d6efd;
}

.shape-shifters details[open] summary {
    margin-bottom: 0.5rem;
}

/* Puzzles -- clue lists with reveal answers. */
.puzzle-item {
    margin: 0.6rem 0;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #f0f0f0;
}

.puzzle-clue {
    font-weight: 700;
    font-size: 1.1rem;
    margin-right: 0.75rem;
}

.puzzle-page details summary {
    cursor: pointer;
    color: #0d6efd;
    display: inline;
}

.puzzle-answer {
    font-weight: 700;
}

.puzzle-syn {
    color: #777;
    font-weight: 400;
}

/* Kangaroo Words: highlight the hidden synonym's letters. */
.kw-hi {
    color: #c0392b;
    font-weight: 700;
}

/* Vocabulary -- picture galleries + figure exercises. */
.vocab-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin: 1.25rem 0;
}

.vocab-item {
    width: 130px;
    margin: 0;
    text-align: center;
}

.vocab-item img {
    max-width: 110px;
    max-height: 110px;
    height: auto;
}

.vocab-item figcaption {
    margin-top: 0.35rem;
    font-weight: 600;
}

.vocab-figure {
    text-align: center;
    margin: 1rem 0;
}

.vocab-figure img {
    max-width: 100%;
    height: auto;
}

.vocab-wordlist {
    columns: 3;
    -webkit-columns: 3;
}

@media (max-width: 600px) {
    .vocab-wordlist { columns: 2; }
}

/* Body Parts — interactive label-the-figure exercise. */
.bp-figure {
    position: relative;
    display: inline-block;
    max-width: 100%;
}

.bp-figure img {
    max-width: 100%;
    height: auto;
    display: block;
}

.bp-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    width: 1.4rem;
    height: 1.4rem;
    background: #0d6efd;
    color: #fff;
    border: 1px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
}

.bp-controls {
    margin: 0.75rem 0;
}

.bp-list {
    columns: 2;
    max-width: 32rem;
}

.bp-list li {
    margin-bottom: 0.3rem;
}

.bp-input {
    margin-left: 0.35rem;
    border: 1px solid #aaa;
    border-radius: 3px;
    padding: 0.05rem 0.3rem;
}

.bp-input.bp-correct { border: 2px solid #198754; background: #d1e7dd; }
.bp-input.bp-wrong   { border: 2px solid #dc3545; background: #f8d7da; }

/* ---- Classroom Tools (Generators) ---------------------------------- */
.generator-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

/* Cryptifier */
.cryptogram {
    font-family: "Courier New", monospace;
    font-size: 1.25rem;
    line-height: 2.4;
}

.cg-word {
    display: inline-block;
    margin-right: 0.9rem;
    white-space: nowrap;
}

.cg-cell {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    width: 1.1rem;
}

.cg-letter {
    font-weight: 700;
    letter-spacing: 0;
}

.cg-blank {
    display: block;
    width: 0.9rem;
    border-bottom: 1px solid #333;
    height: 1.1rem;
}

.cryptogram-key {
    font-family: "Courier New", monospace;
    font-size: 0.8rem;
    color: #333;
    background: #f5f5f5;
    padding: 0.5rem;
    word-spacing: 0.2rem;
}

/* Bingo cards */
.bingo-card {
    max-width: 30rem;
    margin: 0 auto 1.5rem;
    padding: 0.5rem;
    border: 2px solid #222;
}

.bingo-grid {
    display: grid;
    gap: 3px;
}

.bingo-sq {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    border: 1px solid #888;
    padding: 0.2rem;
    font-size: 0.95rem;
    word-break: break-word;
}

.bingo-free {
    font-weight: 700;
    background: #eee;
}

@media print {
    .no-print, .fold-header, footer, nav, header { display: none !important; }
    .bingo-card { page-break-inside: avoid; break-inside: avoid; }
    .cg-blank { border-bottom-color: #000; }
}
