/* ==========================================================================
   GRAMMAR-LESSON.CSS — scoped styles for the "All Grammar Terms" page.
   A bare nav-link-style term row on top, one wide lesson card carrying a
   story per level, and a Quick Check card underneath. Colors/tokens/
   .topic-chip/.hl-base/.card/.choices-grid/.navbar are all inherited
   from see-test.css.
   ========================================================================== */

.gl-page {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 16px 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* --- Shared "back to X" link, used at the top of any gl-page that
   isn't the first stop in its chain (e.g. a chapter's lesson/drag pages
   linking back to german-a1-stories-path-story-1.html). --- */
.gl-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    text-decoration: none;
    color: var(--ink-soft, #475569);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 8px 4px;
    transition: color 0.15s ease;
}

.gl-back-link:hover {
    color: var(--accent, #334155);
}

/* --- Term row: plain nav-link-style toggles, no card/box around them.
   .topic-chip-N (from see-test.css) still supplies each term's color;
   these rules just strip its pill/background look down to flat text. --- */
.gl-term-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 2px;
    padding: 4px 2px;
}

.gl-term-link {
    background: transparent;
    border: none;
    border-radius: 6px;
    padding: 7px 11px;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.gl-term-link:hover {
    background-color: var(--accent-soft, #f1f5f9);
    transform: translateY(-1px);
}

.gl-term-link.is-active {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
}

/* --- Lesson card: the bulk of the page, full width --- */
.gl-lesson-card {
    padding: 32px 36px;
}

.gl-lesson-card h2 {
    font-size: 1.5rem;
    color: var(--ink, #1e293b);
    margin: 8px 0 6px;
}

.gl-lesson-sub {
    color: var(--ink-soft, #475569);
    line-height: 1.6;
    margin: 0 0 8px;
}

.gl-story-block {
    padding-top: 20px;
    margin-top: 20px;
    border-top: 1px dashed var(--line, #e2e8f0);
}

.gl-story-block:first-of-type {
    padding-top: 0;
    margin-top: 8px;
    border-top: none;
}

.gl-level-tag {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
    background-color: var(--accent-soft, #f1f5f9);
    color: var(--accent, #334155);
}

/* Only applies when a level tag is rendered as a link (currently just
   A1, which has a story page + lesson built out) — plain <span> tags
   for the other levels are unaffected. */
a.gl-level-tag {
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

a.gl-level-tag:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-sm, none);
}

.gl-story {
    font-size: 1.05rem;
    line-height: 1.9;
    color: var(--ink, #1e293b);
    margin: 0 0 8px;
}

.gl-gloss {
    font-size: 0.85rem;
    color: var(--ink-faint, #94a3b8);
    font-style: italic;
    line-height: 1.6;
    margin: 0;
}

/* --- Note-word popup: any .hl-base span can opt into a click-for-more-info
   "Note!" callout by adding this class + a data-note attribute. Reusable
   across any lesson page that links grammar-lesson.css. --- */
.gl-note-word {
    cursor: pointer;
    position: relative;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--gold, #b8873b);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

.gl-note-popup {
    position: absolute;
    left: 50%;
    top: calc(100% + 8px);
    transform: translateX(-50%);
    width: 240px;
    max-width: 70vw;
    background-color: var(--surface, #ffffff);
    border: 1px solid var(--gold, #b8873b);
    border-radius: 12px;
    padding: 12px 14px;
    box-shadow: var(--shadow-md, none);
    z-index: 20;
    text-align: left;
    white-space: normal;
}

.gl-note-popup-label {
    display: block;
    font-family: var(--mono);
    font-size: 0.66rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold, #b8873b);
    margin-bottom: 4px;
}

.gl-note-popup-text {
    font-size: 0.82rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--ink, #1e293b);
    margin: 0;
}

/* --- german-a0-absolute-foundations.css / german-a0-grammar-path.css aren't loaded on this page; these
   two rules are duplicated here so the submit button matches the rest
   of the site instead of falling back to see-test.css's icon-button size --- */
.a0-full-submit {
    width: auto;
    height: auto;
    border-radius: 12px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 700;
}

.floating-container[id$="InputZone"] .input-group {
    justify-content: center;
}

/* --- Grammar note card: an ordinary section in .gl-page's flex column —
   same card width/shape as every other section, nothing shrunk or
   shifted. Collapsed by default; the header itself is a button that
   shows/hides .gl-grammar-note-body (toggled by german-a1-stories-path-story-1.js). --- */
.gl-grammar-note-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--serif);
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--ink, #1e293b);
    text-align: left;
    text-wrap: balance;
    cursor: pointer;
}

.gl-grammar-note-toggle:hover {
    color: var(--color-irr, #c98a2c);
}

.gl-grammar-note-toggle-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--color-irr-bg, #faf1e1);
    color: var(--color-irr, #c98a2c);
    font-family: var(--sans);
    font-size: 0.95rem;
    font-weight: 700;
    transition: transform 0.15s ease;
}

.gl-grammar-note-toggle[aria-expanded="true"] .gl-grammar-note-toggle-icon {
    transform: rotate(45deg);
}

.gl-grammar-note-body {
    margin-top: 16px;
}

.gl-grammar-note-card p {
    font-size: 0.94rem;
    line-height: 1.7;
    color: var(--ink-soft, #475569);
    margin: 0 0 16px;
}

.gl-grammar-note-card p:last-child {
    margin-bottom: 0;
}

.gl-grammar-note-detail {
    font-size: 0.86rem !important;
    color: var(--ink-faint, #94a3b8) !important;
}

.gl-conjugation-table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--line, #e2e8f0);
    margin-bottom: 16px;
}

.gl-conjugation-table {
    width: 100%;
    min-width: 320px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--surface, #ffffff);
}

.gl-conjugation-table th,
.gl-conjugation-table td {
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--line, #e2e8f0);
}

.gl-conjugation-table th {
    font-family: var(--mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint, #94a3b8);
    background: var(--surface-2, #f8fafc);
}

.gl-conjugation-table td {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-soft, #475569);
    font-variant-numeric: tabular-nums;
}

.gl-conjugation-table tr:last-child td {
    border-bottom: none;
}

.gl-conjugation-table tr.gl-conjugation-irregular td {
    background: var(--color-irr-bg, #faf1e1);
    color: var(--color-irr, #c98a2c);
    font-weight: 700;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .gl-lesson-card {
        padding: 24px 20px;
    }

    .gl-story {
        font-size: 1rem;
        line-height: 1.75;
    }
}
