/* ================= HANDOUTS =================
   A row is a paper-stub: the chapter number sits on a tear-off tab to the left, the download
   sits on the right, and the dashed rule between rows is the same tear line the ticket cards
   use elsewhere. */

.mat-group {
    margin-bottom: 44px;
}

.mat-group-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 10px;
    border-bottom: 1.5px solid var(--text);
    margin-bottom: 4px;
}

.mat-group-head h2 {
    margin: 0;
    font-size: 1.45rem;
    display: flex;
    align-items: baseline;
    gap: 12px;
}

/* the subject header is the <summary> of a collapsible group */
summary.mat-group-head {
    cursor: pointer;
    list-style: none;
}

summary.mat-group-head::-webkit-details-marker {
    display: none;
}

.mat-group>.mat-group-head .chev {
    align-self: center;
    color: var(--text-muted);
    flex: none;
    transition: transform .15s ease;
}

.mat-group[open]>.mat-group-head .chev {
    transform: rotate(90deg);
}

.mat-group:not([open]) {
    margin-bottom: 20px;
}

.mat-sub {
    margin: 26px 0 0;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-strong);
    font-family: 'IBM Plex Mono', monospace;
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
}

/* the stub on a study aid carries a two-letter code, not a chapter number */
.mat-row.is-aid .mat-stub {
    border-style: dashed;
}

.mat-code {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .08em;
    color: var(--accent-ink);
    background: var(--accent);
    padding: 3px 7px;
    border-radius: 2px;
    align-self: center;
}

.mat-group-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    white-space: nowrap;
}

.mat-list {
    margin: 0;
    padding: 0;
}

.mat-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 6px 20px;
    align-items: start;
    padding: 20px 0;
    border-bottom: 1px dashed var(--border);
}

.mat-row.is-planned {
    opacity: .62;
}

/* the tear-off tab carrying the chapter number */
.mat-stub {
    font-family: 'IBM Plex Mono', monospace;
    font-variant-numeric: tabular-nums;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 12px 9px;
    text-align: center;
    min-width: 52px;
}

.mat-stub small {
    display: block;
    font-size: .55rem;
    font-weight: 600;
    letter-spacing: .12em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.mat-title {
    margin: 0 0 4px;
    font-size: 1.3rem;
}

.mat-summary {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: .9rem;
    max-width: 68ch;
}

.mat-meta {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-muted);
}

.mat-fmt {
    font-weight: 700;
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 2px;
    padding: 1px 6px;
}

.mat-fmt.is-sample {
    color: var(--gold);
    border-color: var(--gold);
    border-style: dashed;
    font-weight: 600;
}

.mat-fmt.is-access {
    color: var(--accent);
    border-color: var(--accent);
    font-weight: 600;
}

.mat-fmt.is-locked {
    color: var(--text-muted);
    font-weight: 600;
}

.mat-fmt.is-soon {
    color: var(--text-muted);
    border-style: dashed;
    font-weight: 600;
}

/* Reads as a sentence, not a label: it sits in the uppercase mono meta line but it is the one
   thing there that is a phrase rather than a stat, so it opts out of the caps. */
.mat-link {
    font-family: inherit;
    font-size: .72rem;
    text-transform: none;
    letter-spacing: .01em;
    color: var(--accent);
    font-weight: 700;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

/* A chapter row carries two files, the handout and its Concept Notes, stacked to one width. */
.mat-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 2px;
}

.mat-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-decoration: none;
    white-space: nowrap;
}

/* Locked Concept Notes beside an open handout: present, but quieter than the file you can take. */
.mat-actions .mat-notes-lock {
    color: var(--text-muted);
}

.mat-pending {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ---------- chapter objectives on a row ----------
   Borrowed from the roadmap deliberately narrowly: the .status-icon tick and the --pct ring
   come straight over, because they are the vocabulary the reader already learned there. The
   nested .topic-card / .subtopic accordion does not, because five flat lines are a list, not
   a tree. One <details>, no nesting. */
.mat-obj {
    margin: 12px 0 0;
    max-width: 72ch;
    border-top: 1px dashed var(--border);
    padding-top: 10px;
}

.mat-obj>summary {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    list-style: none;
    padding: 3px 0;
}

.mat-obj>summary::-webkit-details-marker {
    display: none;
}

.mat-obj .chev {
    color: var(--text-muted);
    flex: none;
    transition: transform .15s ease;
}

.mat-obj[open] .chev {
    transform: rotate(90deg);
}

.obj-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--text);
}

.mat-obj .ring {
    width: 20px;
    height: 20px;
    margin-left: auto;
}

.mat-obj .ring::after {
    width: 13px;
    height: 13px;
    background: var(--bg);
}

.obj-count {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .66rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
    white-space: nowrap;
}

/* The ring already carries the push to the right edge. Only when there is no ring — a
   chapter whose objectives have no lessons behind them — does the count take that job; a
   second auto margin alongside the ring's would share the slack and drag the ring inward. */
.obj-label+.obj-count {
    margin-left: auto;
}

.obj-blurb {
    margin: 10px 0 0 23px;
    font-size: .85rem;
    color: var(--text-muted);
}

.obj-list {
    margin: 10px 0 0;
    padding: 0 0 0 23px;
    list-style: none;
}

.obj {
    display: flex;
    gap: 11px;
    align-items: flex-start;
    padding: 9px 0;
    border-top: 1px dashed var(--border);
}

.obj:first-child {
    border-top: none;
}

.obj .status-icon {
    width: 17px;
    height: 17px;
    margin-top: 2px;
}

/* the stand-in for a tick where there is nothing yet to tick */
.obj-num {
    font-family: 'IBM Plex Mono', monospace;
    font-size: .7rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 17px;
    margin-top: 1px;
    flex: none;
    text-align: center;
}

.obj-section {
    display: block;
    font-weight: 700;
    font-size: .88rem;
    color: var(--text);
}

.obj-text {
    margin: 2px 0 0;
    font-size: .86rem;
    color: var(--text-muted);
}

.obj.is-met .obj-section {
    color: var(--success);
}

.obj-state {
    margin: 4px 0 0;
    font-family: 'IBM Plex Mono', monospace;
    font-size: .63rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-muted);
}

.obj-note {
    margin: 12px 0 0 23px;
    font-size: .78rem;
    color: var(--text-muted);
    border-left: 2px solid var(--border-strong);
    padding-left: 10px;
}

/* the note under the page intro about what a handout is */
.mat-note {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin: 0 0 32px;
    max-width: 72ch;
    color: var(--text-muted);
    font-size: .88rem;
}

.mat-note svg {
    color: var(--gold);
    margin-top: 2px;
}

.mat-note strong {
    color: var(--text);
}

@media (max-width: 720px) {
    .mat-row {
        grid-template-columns: auto 1fr;
    }

    .mat-actions {
        grid-column: 2;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding-top: 6px;
    }

    .mat-group-head {
        flex-wrap: wrap;
    }
}
