/* بانک سؤال: overview, subject and references. Shares chips and skeletons with exams.css. */

.b-head {
    margin-bottom: var(--space-5);
}

.b-head h1 {
    margin: 0 0 var(--space-1);
}

/* The search and the references link share one row, at every width. */
.b-head__tools {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-4);
}

.b-search {
    flex: 1 1 0;
    min-width: 0;
}

.b-head__tools .f-btn {
    flex: none;
    white-space: nowrap;
}

@media (max-width: 420px) {
    .b-head__tools .f-btn {
        padding-inline: var(--space-3);
    }
}

.b-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

/*
 * The overview's steps: the exam as four cards (residency, national,
 * promotion, board), then the view with its search, then the view's own
 * narrowing -- a strip of years or a row of subjects.
 */
.b-step {
    margin-bottom: var(--space-5);
}

.b-step__label {
    margin: 0 0 var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
}

.b-exams {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-2);
}

@media (max-width: 720px) {
    .b-exams {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.b-exam {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-1);
    min-height: 88px;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg, 16px);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    text-align: start;
    cursor: pointer;
    transition: border-color var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease);
}

.b-exam:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-soft);
}

.b-exam:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.b-exam.is-active {
    border-color: transparent;
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-accent);
}

.b-exam__name {
    font-size: var(--text-lg, 1.125rem);
}

.b-exam__count,
.b-exam__years {
    font-size: var(--text-sm);
    opacity: 0.85;
}

.b-step__row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
}

.b-step__row .b-tabs {
    margin-bottom: 0;
}

.b-step__row .b-head__tools {
    flex: 1 1 320px;
    margin-top: 0;
}

.b-subnav:not(:empty) {
    margin-top: var(--space-3);
}

.b-subnav .r-years {
    margin-bottom: 0;
}

.b-subnav__chips {
    display: flex;
    gap: var(--space-2);
    padding-bottom: var(--space-1);
    overflow-x: auto;
    scrollbar-width: thin;
}

.b-subnav__chips .x-chip {
    flex: none;
}

.r-year__meta {
    font-size: var(--text-xs, 0.75rem);
    opacity: 0.8;
}

@media (prefers-reduced-motion: reduce) {
    .b-exam { transition: none; }
}

.b-note {
    margin: 0 0 var(--space-4);
}

.b-pad {
    padding: var(--space-4) var(--space-5);
}

/* One sheet, one row per subject / sitting / topic. */
.b-sheet {
    display: grid;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.b-row,
.b-topic {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border);
    color: inherit;
    text-decoration: none;
}

.b-row:last-child,
.b-topic:last-child {
    border-bottom: 0;
}

a.b-row:hover {
    background: var(--surface-muted);
}

.b-row.is-empty {
    opacity: 0.6;
}

.b-row__body {
    position: relative;
    flex: 1;
    min-width: 0;
}

.b-row__title {
    display: block;
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
    color: var(--text-primary);
}

/* A chapter's English title, under its Persian one. */
.b-row__en {
    display: block;
    margin: calc(-1 * var(--space-1)) 0 var(--space-1);
    direction: ltr;
    text-align: right;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

.b-row__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.b-row__go {
    color: var(--text-tertiary);
}

.b-old {
    color: var(--warning);
}

/* A topic row carries a faint bar the width of its share of the subject. */
.b-topic::before {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: var(--share, 0%);
    background: var(--accent-soft);
    opacity: 0.55;
}

.b-start {
    position: relative;
    min-height: 36px;
    padding-inline: var(--space-4);
    font-size: var(--text-sm);
    flex: none;
}

/* ------------------------------------------------------- course cards */

/*
 * The overview as a grid of cards, like MedoFast's bank: each course a white
 * card with its own colour mark, its name, and how many questions it has.
 */
.b-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: var(--space-3);
}

.b-card {
    --hue: var(--accent);
    --hue-soft: var(--accent-soft);
    position: relative;
    display: grid;
    align-content: start;
    gap: 4px;
    min-height: 150px;
    padding: var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-soft);
    color: var(--text-primary);
    text-decoration: none;
    transition: transform var(--motion-fast) var(--ease), box-shadow var(--motion-fast) var(--ease), border-color var(--motion-fast) var(--ease);
}

a.b-card:hover,
a.b-card:focus-visible {
    border-color: var(--hue);
    box-shadow: var(--shadow-lift);
    transform: translateY(-2px);
}

.b-card[data-hue="subject"] { --hue: var(--hue-subject); --hue-soft: var(--hue-subject-soft); }
.b-card[data-hue="tag"] { --hue: var(--hue-tag); --hue-soft: var(--hue-tag-soft); }
.b-card[data-hue="difficulty"] { --hue: var(--hue-difficulty); --hue-soft: var(--hue-difficulty-soft); }
.b-card[data-hue="source"] { --hue: var(--hue-source); --hue-soft: var(--hue-source-soft); }
.b-card[data-hue="success"] { --hue: var(--success); --hue-soft: var(--success-soft); }
.b-card[data-hue="info"] { --hue: var(--info); --hue-soft: var(--info-soft); }

.b-card.is-empty {
    box-shadow: none;
    background: var(--surface-muted);
}

.b-card.is-empty .b-card__mark {
    filter: grayscale(1);
    opacity: 0.6;
}

.b-card__mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-bottom: var(--space-2);
    border-radius: 14px;
    background: var(--hue-soft);
    color: var(--hue);
    font-size: var(--text-xl);
    font-weight: var(--weight-strong);
}

.b-card__title {
    font-size: var(--text-base);
    line-height: 1.6;
}

.b-card__count {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--hue);
}

.b-card.is-empty .b-card__count {
    color: var(--text-tertiary);
}

.b-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    margin-top: 4px;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}

@media (max-width: 560px) {
    .b-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .b-card {
        min-height: 0;
        padding: 14px;
    }

    .b-card__mark {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        font-size: var(--text-lg);
    }

    .b-card__title {
        font-size: var(--text-sm);
    }

    .b-card__meta {
        display: none;
    }
}

/* ------------------------------------------------------------- subject */

.b-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1px;
    margin: var(--space-4) 0 0;
    padding: 0;
    list-style: none;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.b-facts li {
    display: grid;
    gap: var(--space-1);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
}

.b-facts span {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.b-facts strong {
    font-size: var(--text-lg);
}

.b-panel {
    margin-bottom: var(--space-5);
}

.b-panel h2 {
    margin: 0 0 var(--space-1);
    font-size: var(--text-lg);
}

.b-panel > .f-muted {
    margin: 0 0 var(--space-4);
}

.b-actions,
.b-years {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.b-years {
    margin-top: var(--space-2);
}

.b-empty {
    margin-bottom: var(--space-5);
}

.b-empty h2 {
    margin: 0 0 var(--space-1);
    font-size: var(--text-lg);
}

/* ---------------------------------------------------------- references */

/*
 * منابع آزمون: a hero with the year's numbers, a strip of years that stays
 * under the header, and one card per subject holding its books. Every colour
 * is a token; a book's spine takes one of the information hues.
 */

.r-hero {
    position: relative;
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
    gap: var(--space-5);
    align-items: center;
    margin-bottom: var(--space-5);
    padding: var(--space-6);
    overflow: hidden;
    background:
        radial-gradient(120% 140% at 100% 0%, var(--accent-soft), transparent 55%),
        radial-gradient(90% 120% at 0% 100%, var(--info-soft), transparent 60%),
        var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.r-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
    padding: 2px var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    color: var(--accent-strong);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.r-hero h1 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-3xl);
}

.r-hero__lead {
    margin: 0;
    max-width: 52ch;
    color: var(--text-secondary);
    line-height: 1.9;
}

.r-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
    margin: 0;
}

.r-stat {
    position: relative;
    display: flex;
    flex-direction: column-reverse;
    gap: 2px;
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.r-stat::before {
    content: "";
    position: absolute;
    inset-block: var(--space-3);
    inset-inline-start: 0;
    inline-size: 3px;
    border-radius: var(--radius-pill);
    background: var(--tone);
}

.r-stat--accent { --tone: var(--accent); }
.r-stat--info { --tone: var(--info); }
.r-stat--subject { --tone: var(--hue-subject); }
.r-stat--difficulty { --tone: var(--hue-difficulty); }

.r-stat__value {
    margin: 0;
    font-size: var(--text-2xl);
    font-weight: var(--weight-strong);
    line-height: 1.3;
}

.r-stat__label {
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

/* The exam types: a segmented switch above the years. */
.r-types {
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-2);
    overflow-x: auto;
    scrollbar-width: none;
}

.r-types[hidden] {
    display: none;
}

.r-type {
    flex: none;
    min-height: 38px;
    padding: 0 var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    cursor: pointer;
}

.r-type:hover {
    color: var(--text-primary);
}

.r-type[aria-pressed="true"] {
    border-color: var(--text-primary);
    background: var(--text-primary);
    color: var(--surface);
}

/* The strip of years: scrolls sideways on a phone, stays under the header. */
.r-years {
    position: sticky;
    top: calc(var(--header-height) + var(--space-2));
    z-index: 5;
    display: flex;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
    padding: var(--space-1);
    overflow-x: auto;
    scrollbar-width: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-soft);
}

.r-years::-webkit-scrollbar {
    display: none;
}

.r-year {
    flex: 1 0 auto;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-inline-size: 64px;
    min-height: 40px;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-secondary);
    font: inherit;
    font-weight: var(--weight-medium);
    cursor: pointer;
    transition: background var(--motion-fast) var(--ease), color var(--motion-fast) var(--ease);
}

.r-year:hover {
    background: var(--surface-muted);
    color: var(--text-primary);
}

.r-year:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.r-year.is-active {
    background: var(--accent-gradient);
    color: var(--text-on-accent);
    box-shadow: var(--shadow-accent);
}


.r-tools {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.r-tools[hidden] {
    display: none;
}

.r-search {
    flex: 1 1 0;
    min-width: 0;
}

.r-filter {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 42px;
    padding: 0 var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    cursor: pointer;
}

.r-filter::before {
    content: "";
    inline-size: 8px;
    block-size: 8px;
    border-radius: 50%;
    background: var(--hue-difficulty);
}

.r-filter[aria-pressed="true"] {
    border-color: var(--hue-difficulty);
    background: var(--hue-difficulty-soft);
    color: var(--text-primary);
}

.r-filter:disabled {
    opacity: 0.45;
    cursor: default;
}

/* One card per subject, two across where there is room. */
.r-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr));
    gap: var(--space-4);
    align-items: start;
    animation: r-in var(--motion-base) var(--ease);
}

@keyframes r-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .r-grid { animation: none; }
    .r-year { transition: none; }
}

.r-subject {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    min-width: 0;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
}

.r-subject__head {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-inline: var(--space-1);
}

.r-subject__name {
    margin: 0;
    font-size: var(--text-lg);
}

.r-subject__count {
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--surface-muted);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    line-height: 1.8;
}

.r-subject__link {
    margin-inline-start: auto;
    color: var(--accent);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    text-decoration: none;
    white-space: nowrap;
}

.r-subject__link::after {
    content: " ←";
}

.r-subject__link:hover {
    text-decoration: underline;
}

.r-books {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-2);
}

/* A book: a coloured spine and what is printed on its cover. */
.r-book {
    --spine: var(--accent);
    --spine-soft: var(--accent-soft);
    display: grid;
    grid-template-columns: 6px minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--surface-muted);
    border-radius: var(--radius-md);
}

.r-book--info { --spine: var(--info); --spine-soft: var(--info-soft); }
.r-book--subject { --spine: var(--hue-subject); --spine-soft: var(--hue-subject-soft); }
.r-book--tag { --spine: var(--hue-tag); --spine-soft: var(--hue-tag-soft); }
.r-book--source { --spine: var(--hue-source); --spine-soft: var(--hue-source-soft); }
.r-book--difficulty { --spine: var(--hue-difficulty); --spine-soft: var(--hue-difficulty-soft); }
.r-book--articles { --spine: var(--border-strong); --spine-soft: var(--surface-strong); }

.r-book--articles .r-book__spine {
    background: repeating-linear-gradient(180deg, var(--spine) 0 6px, transparent 6px 10px);
}

.r-book__spine {
    border-radius: var(--radius-pill);
    background: var(--spine);
}

.r-book__body {
    display: grid;
    gap: var(--space-2);
    min-width: 0;
}

/* The page is right-to-left; an English title keeps its own order but lines up with the Persian. */
.r-book__title,
.r-book__authors {
    text-align: right;
}

.r-book__title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: var(--weight-strong);
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.r-book__authors {
    margin: -4px 0 0;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    overflow-wrap: anywhere;
}

.r-book__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
}

.r-tag,
.r-badge {
    display: inline-flex;
    align-items: center;
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    line-height: 1.9;
    white-space: nowrap;
}

.r-tag {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.r-tag--edition {
    border-color: transparent;
    background: var(--spine-soft);
    color: var(--text-primary);
    font-weight: var(--weight-medium);
}

.r-badge {
    font-weight: var(--weight-medium);
}

.r-badge::before {
    content: "";
    inline-size: 6px;
    block-size: 6px;
    margin-inline-end: 6px;
    border-radius: 50%;
    background: currentColor;
}

.r-badge--new { background: var(--success-soft); color: var(--success); }
.r-badge--edition { background: var(--info-soft); color: var(--info); }
.r-badge--scope { background: var(--warning-soft); color: var(--text-primary); }
.r-badge--unofficial { background: var(--danger-soft); color: var(--danger); }

.r-scope {
    display: grid;
    gap: 2px;
    padding: var(--space-2) var(--space-3);
    border-inline-start: 2px solid var(--spine);
    border-radius: var(--radius-sm);
    background: var(--surface);
}

.r-scope__label {
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

.r-scope__text {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: var(--text-sm);
    line-height: 1.8;
}

.r-meter {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.r-meter__bar {
    flex: 1 1 auto;
    block-size: 6px;
    border-radius: var(--radius-pill);
    background: var(--surface-strong);
    overflow: hidden;
}

.r-meter__fill {
    display: block;
    block-size: 100%;
    border-radius: inherit;
    background: var(--spine);
}

.r-meter__label {
    flex: none;
    color: var(--text-secondary);
    font-size: var(--text-xs);
}

.r-chapters__toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    justify-self: start;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    cursor: pointer;
}

.r-chevron {
    inline-size: 7px;
    block-size: 7px;
    margin-top: -3px;
    border-inline-end: 1.5px solid currentColor;
    border-block-end: 1.5px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--motion-fast) var(--ease);
}

.r-chapters.is-open .r-chevron {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.r-chapters__panel {
    margin-top: var(--space-2);
    padding: var(--space-2);
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.r-chapters__list {
    display: grid;
    margin: 0;
    padding: 0;
    list-style: none;
}

.r-ch {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: var(--space-2);
    align-items: start;
    padding: var(--space-2) var(--space-1);
    border-bottom: 1px solid var(--border);
}

.r-chapters__list > .r-ch:last-child {
    border-bottom: 0;
}

.r-ch__number {
    display: inline-grid;
    place-items: center;
    inline-size: 26px;
    block-size: 26px;
    border-radius: 50%;
    background: var(--spine-soft);
    color: var(--text-primary);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.r-ch__text {
    display: grid;
    gap: 2px;
    min-width: 0;
    font-size: var(--text-sm);
}

.r-ch__fa {
    overflow-wrap: anywhere;
}

.r-ch__en {
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    text-align: end;
    overflow-wrap: anywhere;
}

.r-ch__partial {
    justify-self: start;
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--warning-soft);
    font-size: var(--text-xs);
}

.r-ch.is-out .r-ch__number {
    background: var(--surface-muted);
    color: var(--text-tertiary);
}

.r-ch.is-out .r-ch__fa,
.r-ch.is-out .r-ch__en {
    color: var(--text-tertiary);
}

.r-chapters__more {
    inline-size: 100%;
    margin-top: var(--space-1);
    padding: var(--space-2);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    background: none;
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-xs);
    cursor: pointer;
}

.r-chapters__more:hover {
    color: var(--text-primary);
    background: var(--surface-muted);
}

.r-chapters__note {
    margin: var(--space-2) 0 0;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
    line-height: 1.8;
}

.r-dropped {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-1) var(--space-2);
    margin: 0;
    padding: var(--space-2) var(--space-3);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

.r-dropped__title {
    text-decoration: line-through;
}

/* On a subject's page the books sit under each year's heading. */
.b-ref__year {
    margin: var(--space-4) 0 var(--space-2);
    font-size: var(--text-base);
}

@media (max-width: 860px) {
    .r-hero {
        grid-template-columns: 1fr;
        padding: var(--space-5);
    }

    .r-summary {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .r-hero {
        padding: var(--space-4);
    }

    .r-hero h1 {
        font-size: var(--text-2xl);
    }

    .r-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--space-2);
    }

    .r-stat__value {
        font-size: var(--text-xl);
    }

    .r-subject {
        padding: var(--space-3);
    }

    .r-filter {
        padding: 0 var(--space-3);
    }
}

@media (max-width: 560px) {
    .b-topic {
        flex-wrap: wrap;
    }

    .b-topic .b-start {
        width: 100%;
    }
}

/* سرفصل‌ها: one chapter's headings, opened on demand */

.b-outline__toggle {
    justify-self: start;
    padding: 0;
    border: 0;
    background: none;
    color: var(--accent);
    font: inherit;
    font-size: var(--text-xs);
    cursor: pointer;
}

.b-outline__list,
.b-outline__sublist {
    display: grid;
    gap: var(--space-1);
    margin: var(--space-1) 0 0;
    padding-inline-start: var(--space-3);
}

.b-outline__section,
.b-outline__subsection {
    display: grid;
    gap: 1px;
}

.b-outline__fa {
    font-size: var(--text-sm);
}

.b-outline__subsection .b-outline__fa {
    font-size: var(--text-xs);
}

.b-outline__en {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    text-align: end;
    overflow-wrap: anywhere;
}

/* ------------------------------------------------------ «آزمون من» */

.g-goal {
    position: relative;
    display: inline-block;
    margin-top: var(--space-3);
}

.g-goal__chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 38px;
    padding: 0 var(--space-3) 0 var(--space-4);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-primary);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
}

.g-goal__chip:hover {
    border-color: var(--accent);
}

.g-goal__chip:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 1px;
}

.g-goal__hint {
    color: var(--text-secondary);
}

.g-goal__caret {
    inline-size: 6px;
    block-size: 6px;
    margin-top: -3px;
    border-inline-end: 1.5px solid currentColor;
    border-block-end: 1.5px solid currentColor;
    transform: rotate(45deg);
}

.g-goal__panel {
    position: absolute;
    inset-inline-start: 0;
    top: calc(100% + var(--space-2));
    z-index: 20;
    inline-size: min(420px, calc(100vw - 32px));
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-strong);
}

.g-goal__title {
    margin: 0 0 var(--space-2);
    color: var(--text-secondary);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
}

.g-goal__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1);
    margin-bottom: var(--space-3);
}

.g-goal__option {
    min-height: 34px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text-secondary);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
}

.g-goal__option:hover {
    color: var(--text-primary);
}

.g-goal__option[aria-pressed="true"] {
    border-color: transparent;
    background: var(--accent-gradient);
    color: var(--text-on-accent);
}

.g-goal__note {
    margin: 0;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

/* The bank's papers, one block per exam and year. */
.b-papers + .b-papers {
    margin-top: var(--space-5);
}

.b-papers__title {
    margin: 0 0 var(--space-3);
    font-size: var(--text-lg);
}

.b-card.is-goal {
    border-color: var(--accent);
}

.b-scope {
    margin: var(--space-1) 0 0;
    color: var(--text-secondary);
    font-size: var(--text-sm);
}

.b-card--paper {
    min-height: 0;
}

/* ------------------------------------------- بانک به تفکیک کتاب و فصل */

.k-subject + .k-subject {
    margin-top: var(--space-6);
}

.k-subject__head {
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.k-subject__name {
    margin: 0;
    font-size: var(--text-xl);
}

.k-chapters {
    margin-top: var(--space-1);
    padding: var(--space-1) var(--space-2);
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.k-ch {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    align-items: center;
}

.k-ch__bar {
    display: block;
    block-size: 4px;
    margin-top: 4px;
    border-radius: var(--radius-pill);
    background: var(--surface-strong);
    overflow: hidden;
}

.k-ch__fill {
    display: block;
    block-size: 100%;
    border-radius: inherit;
    background: var(--spine);
}

.k-ch__side {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.k-ch__count {
    color: var(--text-secondary);
    font-size: var(--text-xs);
    white-space: nowrap;
}

.k-ch .b-start {
    min-height: 32px;
    padding-inline: var(--space-3);
}

.r-book__body > .b-start {
    justify-self: start;
}

.r-ch__text > .b-start {
    justify-self: start;
    min-height: 30px;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
}


.k-top {
    margin: var(--space-1) 0 0;
    color: var(--text-tertiary);
    font-size: var(--text-xs);
}

@media (max-width: 560px) {
    .k-ch {
        gap: var(--space-1) var(--space-2);
    }

    .k-ch__side {
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
    }
}

.k-ch__maps {
    padding: 0 var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--hue-tag-soft);
    color: var(--text-primary);
    font-size: var(--text-xs);
    line-height: 1.9;
    white-space: nowrap;
    text-decoration: none;
}

.b-head, .r-hero {
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-strong);
}
.b-exam { border-color: var(--border-strong); }
