/* Lehrplan 21 browser: the subject areas beside a competence tree with a
 * Zyklus switch. */
@layer pages {
    .lp-layout { --side-min: 14rem; --side-max: 17rem; }
    .lp-overview { grid-template-columns: minmax(0, 1fr); }
    .lp-overview .lp-areas { display: none; }
    /* One column: once an area is open, its tree replaces the area list (the
     * "← Fachbereiche" link leads back). */
    .lp-back { display: none; }
    @container content (max-width: 38rem) {
        .lp-layout:not(.lp-overview) nav.lp-areas { display: none; }
        .lp-back { display: block; }
    }
    nav.lp-areas { position: sticky; top: var(--space-5); max-height: calc(100dvh - var(--space-8)); overflow-y: auto; }
    .lp-areas a small { display: block; color: var(--text-muted); font-size: var(--text-xs); }
    .lp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: var(--space-3); }
    .lp-card {
        display: flex;
        flex-direction: column;
        gap: var(--space-1);
        align-items: flex-start;
        padding: var(--space-4);
        border: var(--border-width) solid var(--border);
        border-radius: var(--radius-md);
        color: var(--text);
        text-decoration: none;
    }
    .lp-card:hover { color: var(--text); border-color: var(--primary-fill); background: color-mix(in srgb, var(--primary) var(--tint-faint), transparent); }
    .lp-tools { display: flex; gap: var(--space-4); margin: 0 0 var(--space-3); font-size: var(--text-sm); }
    .lp-toggle { --btn-text: var(--primary); padding: 0; min-height: 0; }
    .lp-kb { margin: 0 0 var(--space-3); padding-top: var(--space-3); border-top: var(--border-width) solid var(--border); }
    .lp-kb > summary { font-family: var(--font-head); font-size: var(--text-lg); font-weight: var(--weight-semibold); }
    .lp-kb > summary :is(.chip, small) { font-family: var(--font-body); font-size: var(--text-sm); vertical-align: 0.15em; }
    .lp-kb > summary small { font-weight: var(--weight-regular); }
    .lp-ha { margin: var(--space-4) 0 var(--space-2); font-size: var(--text-base); font-weight: var(--weight-semibold); }
    .lp-code { margin-right: var(--space-1); font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-muted); }
    .lp-k { margin: 0 0 var(--space-1); padding: var(--space-1) var(--space-2); border-radius: var(--radius-md); }
    .lp-k[open] { background: color-mix(in srgb, var(--text-muted) 6%, transparent); }
    .lp-k > summary { display: flex; gap: var(--space-1); align-items: baseline; }
    .lp-k-text { flex: 1; }
    .lp-stufen { margin-top: var(--space-2); padding-left: var(--space-4); }
    .lp-stufen li { padding: var(--space-2) 0; }

    .lp-usage { display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-4); margin: var(--space-1) 0 0; font-size: var(--text-sm); }
    .lp-usage a { text-decoration: none; }
    /* The Zyklus switch hides stufen and competences outside the cycle. */
    .lp-tree[data-zyklus-filter="1"] .lp-stufen li:not([data-zyklus="1"]),
    .lp-tree[data-zyklus-filter="2"] .lp-stufen li:not([data-zyklus="2"]),
    .lp-tree[data-zyklus-filter="3"] .lp-stufen li:not([data-zyklus="3"]),
    .lp-tree[data-zyklus-filter="1"] .lp-k:not([data-zyklen~="1"]),
    .lp-tree[data-zyklus-filter="2"] .lp-k:not([data-zyklen~="2"]),
    .lp-tree[data-zyklus-filter="3"] .lp-k:not([data-zyklen~="3"]) { display: none; }
    /* A competence or stufe reached through a link flashes once. */
    @keyframes lp-flash { from { background: color-mix(in srgb, var(--accent) 35%, transparent); } to { background: transparent; } }
    .lp-flash { animation: lp-flash 2.4s ease-out; }
}
