/* ==========================================================================
   ALSADIQEEN — "MODERN SCHOLARLY HERITAGE" HOMEPAGE, BENTO, LIBRARY & TOPICS
   ========================================================================== */
:root,
html[data-theme="dark"] {
    --heritage-paper: var(--bg-primary);
    --heritage-surface: var(--bg-surface);
    --heritage-ink: var(--text-primary);
    --heritage-muted: var(--text-secondary);
    --heritage-line: var(--border-standard);
    --heritage-gold: var(--accent-gold);
    --heritage-night: #070B12;
}

html[data-theme="light"] {
    --heritage-paper: var(--bg-primary);
    --heritage-surface: var(--bg-surface);
    --heritage-ink: var(--text-primary);
    --heritage-muted: var(--text-secondary);
    --heritage-line: var(--border-standard);
    --heritage-gold: var(--accent-gold);
    --heritage-night: #090D16;
}

.heritage-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.heritage-skip-link {
    position: fixed;
    left: 16px;
    top: 12px;
    z-index: 999;
    background: var(--bg-surface);
    color: var(--accent-gold);
    padding: 10px 18px;
    border: 2px solid var(--accent-gold);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 13px;
    box-shadow: var(--shadow-card);
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}

.heritage-skip-link:focus-visible {
    clip: auto;
    clip-path: none;
    width: auto;
    height: auto;
    overflow: visible;
    opacity: 1;
    pointer-events: auto;
}

.heritage-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font: 800 11px/1.6 var(--font-sans);
    letter-spacing: 2px;
    color: var(--accent-gold);
    text-transform: uppercase;
}

/* ==========================================================================
   A. HERO & COMMAND-CENTER SEARCH
   ========================================================================== */
.heritage-hero {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    align-items: center;
    padding: 28px 0 44px;
    border-bottom: 1px solid var(--border-featured);
}

@media (min-width: 1024px) {
    .heritage-hero {
        grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr);
        gap: 44px;
        padding: 48px 0 60px;
    }
}

/* Ultra-subtle geometric arabesque SVG background pattern (opacity: 0.03) */
.heritage-hero::before {
    content: "";
    position: absolute;
    inset: -24px -16px 0;
    z-index: -1;
    opacity: 0.035;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='none' stroke='%23D4AF37' stroke-width='1.2'%3E%3Cpolygon points='40,4 50,26 74,26 55,40 62,64 40,50 18,64 25,40 6,26 30,26'/%3E%3Ccircle cx='40' cy='40' r='16'/%3E%3Cpath d='M0 40h80M40 0v80' opacity='0.35'/%3E%3C/g%3E%3C/svg%3E");
    background-size: 80px 80px;
}

.heritage-hero__copy {
    min-width: 0;
}

.quranic-motto-pill {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    margin-bottom: 16px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-featured);
    background: var(--accent-gold-soft);
    box-shadow: var(--shadow-glow-gold);
}

.quranic-motto-pill__ar {
    font-family: var(--font-arabic);
    font-size: 1.18rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--accent-gold);
}

.quranic-motto-pill__en {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.quranic-motto-pill__ref {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: var(--accent-emerald);
    text-transform: uppercase;
}

.heritage-hero h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(32px, 5vw, 58px);
    line-height: 1.1;
    letter-spacing: -0.8px;
    margin: 12px 0 16px;
    color: var(--text-primary);
}

.heritage-hero h1 em {
    font-family: var(--font-arabic);
    font-style: italic;
    font-weight: 400;
    color: var(--accent-gold);
}

.heritage-hero__copy > p {
    max-width: 620px;
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 16.5px;
    margin: 0 0 24px;
}

/* Command-Center Search Box */
.command-search-shell {
    background: var(--bg-surface);
    border: 1px solid var(--border-featured);
    border-top: 2px solid var(--accent-gold);
    border-radius: var(--radius-lg);
    padding: 14px;
    box-shadow: var(--shadow-glow-gold);
    max-width: 720px;
    min-width: 0;
    width: 100%;
}

@media (min-width: 640px) {
    .command-search-shell {
        padding: 20px;
    }
}

.command-search-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding-bottom: 12px;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-standard);
    min-width: 0;
}

.command-scope-tabs {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    min-width: 0;
    max-width: 100%;
    flex: 1 1 100%;
}

@media (min-width: 640px) {
    .command-scope-tabs {
        flex: 1 1 auto;
    }
}

.command-scope-tabs::-webkit-scrollbar {
    display: none;
}

.command-scope-tab {
    flex: 0 0 auto;
    scroll-snap-align: start;
    padding: 6px 12px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-standard);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    transition: all 0.16s ease;
}

.command-scope-tab:hover,
.command-scope-tab.is-active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.command-mode-pills {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: var(--radius-pill);
    background: var(--bg-inset);
    border: 1px solid var(--border-standard);
    transition: opacity 0.2s ease;
}

.command-mode-pill {
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 700;
    transition: all 0.16s ease;
}

.command-mode-pill.is-active {
    background: var(--accent-emerald-soft);
    color: var(--accent-emerald);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.35);
}

.heritage-search {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--bg-inset);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    padding: 8px;
}

@media (min-width: 560px) {
    .heritage-search {
        flex-direction: row;
        align-items: center;
    }
}

.heritage-search__input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding-inline: 10px;
}

.heritage-search__icon,
.heritage-search__svg {
    width: 20px;
    height: 20px;
    font-size: 20px;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.heritage-search input {
    min-width: 0;
    width: 100%;
    flex: 1;
    background: transparent;
    color: var(--text-primary);
    border: 0;
    padding: 11px 4px;
    font-size: 15.5px;
    outline: none;
}

.heritage-search input::placeholder {
    color: var(--text-muted);
}

.heritage-search__controls {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.heritage-search__mode {
    flex: 1 1 auto;
}

.heritage-search__mode select {
    width: 100%;
    padding: 11px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-standard);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
}

@media (min-width: 560px) {
    .heritage-search__controls {
        width: auto;
    }

    .heritage-search__mode {
        flex: 0 0 auto;
    }

    .heritage-search__mode select {
        width: auto;
    }
}

.heritage-search__mode select:focus {
    border-color: var(--accent-gold);
    color: var(--text-primary);
    outline: none;
}

.heritage-search button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent-gold), var(--accent-gold-bright));
    color: var(--text-on-gold);
    padding: 12px 22px;
    font-size: 13.5px;
    font-weight: 800;
    white-space: nowrap;
}

.command-search-quick {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--border-standard);
}

.command-search-quick__label {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-secondary);
}

.command-search-quick a {
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    background: var(--bg-elevated);
    border: 1px solid var(--border-standard);
    color: var(--text-primary);
    font-family: var(--font-arabic);
    font-size: 14.5px;
    line-height: 1.5;
}

.command-search-quick a:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.heritage-hero__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 22px;
}

/* Archival Mihrab Exhibit with Covers & Manuscript Folios */
.heritage-exhibit {
    position: relative;
    isolation: isolate;
    min-width: 0;
    min-height: 500px;
    width: 100%;
    max-width: 500px;
    justify-self: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 54px 20px 20px;
    background: radial-gradient(circle at 50% 25%, #132A24 0%, #0B1422 62%, #070B12 100%);
    overflow: hidden;
    border-radius: 230px 230px 18px 18px;
    border: 1px solid var(--border-featured);
    color: #F8FAFC;
    box-shadow: var(--shadow-glow-gold);
}

@media (min-width: 768px) {
    .heritage-exhibit {
        min-height: 550px;
        padding: 62px 24px 22px;
    }
}

.heritage-exhibit::before {
    content: "";
    position: absolute;
    inset: 12px;
    border: 1px solid rgba(212, 175, 55, 0.26);
    border-radius: 220px 220px 12px 12px;
    z-index: -1;
    pointer-events: none;
}

.heritage-exhibit__arch {
    position: absolute;
    inset: 34px 34px 120px;
    border: 1px solid rgba(16, 185, 129, 0.22);
    border-radius: 200px 200px 0 0;
    z-index: -1;
    pointer-events: none;
}

.heritage-exhibit__header {
    text-align: center;
    margin-bottom: 10px;
}

.heritage-exhibit__caption {
    display: inline-block;
    letter-spacing: 1.8px;
    font-size: 10px;
    font-weight: 800;
    color: var(--accent-gold);
}

.heritage-exhibit__books {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 230px;
    margin: 8px 0 12px;
}

.heritage-exhibit__book {
    display: block;
    width: 40%;
    max-width: 162px;
    filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.65));
    transition: transform 0.25s ease;
}

.heritage-exhibit__book .catalogue-cover {
    width: 100%;
    max-width: none;
    aspect-ratio: 3 / 4;
    min-height: 0;
}

.heritage-exhibit__book:nth-child(1) {
    transform: rotate(-9deg) translate(14px, 8px);
    z-index: 1;
}

.heritage-exhibit__book:nth-child(2) {
    transform: translateY(-10px) scale(1.04);
    z-index: 3;
    margin-inline: -38px;
}

.heritage-exhibit__book:nth-child(3) {
    transform: rotate(9deg) translate(-14px, 8px);
    z-index: 2;
}

.heritage-exhibit__book:hover {
    transform: translateY(-18px) scale(1.05);
    z-index: 4;
}

.heritage-exhibit__manuscript-strip {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 10px;
    z-index: 5;
}

@media (min-width: 480px) {
    .heritage-exhibit__manuscript-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.manuscript-mini-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: rgba(12, 28, 41, 0.88);
    border: 1px solid rgba(212, 172, 98, 0.26);
    backdrop-filter: blur(8px);
    transition: border-color 0.18s ease, transform 0.18s ease;
}

.manuscript-mini-card:hover {
    border-color: var(--accent-gold);
    transform: translateY(-2px);
}

.manuscript-mini-card img {
    width: 42px;
    height: 56px;
    object-fit: cover;
    object-position: top center;
    border-radius: 4px;
    border: 1px solid rgba(212, 172, 98, 0.4);
    background: #F8F4EB;
    flex-shrink: 0;
}

.manuscript-mini-card__text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.manuscript-mini-card__tag {
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--accent-emerald);
}

.manuscript-mini-card__text strong {
    font-size: 12px;
    font-weight: 700;
    color: #F8F4EB;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.manuscript-mini-card__text small {
    font-size: 10.5px;
    color: #98ABB7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.heritage-exhibit__folio-card {
    position: relative;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: rgba(7, 20, 29, 0.92);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-featured);
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
    z-index: 5;
}

.heritage-exhibit__folio-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

.heritage-exhibit__folio-card strong {
    font-family: var(--font-arabic);
    font-size: 18px;
    color: #F8F4EB;
    line-height: 1.55;
}

.heritage-exhibit__folio-card small {
    font-size: 11.5px;
    color: #98ABB7;
}

.heritage-exhibit__empty {
    text-align: center;
    padding: 20px;
}

.heritage-exhibit__empty > span {
    font: 44px var(--font-arabic);
    color: var(--accent-gold);
}

/* ==========================================================================
   LEDGER & DYNAMIC 6-PILLAR BENTO GRID
   ========================================================================== */
.heritage-ledger-section {
    padding: 26px 0;
    border-bottom: 1px solid var(--border-standard);
}

.heritage-ledger-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

@media (min-width: 768px) {
    .heritage-ledger-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .heritage-ledger-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.heritage-ledger-item {
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    border-left: 3px solid var(--accent-gold);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.heritage-ledger-item b {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(22px, 2.4vw, 28px);
    color: var(--text-primary);
    line-height: 1.2;
}

.heritage-ledger-item span {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-gold);
}

.heritage-ledger-item small {
    font-size: 11px;
    color: var(--text-secondary);
}

/* 6 Core Platform Pillars Bento Grid */
.pillars-bento {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

@media (min-width: 640px) {
    .pillars-bento {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .pillars-bento {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .pillars-bento--dynamic {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .pillars-bento--dynamic .pillar-card--featured {
        grid-column: span 2;
        background: linear-gradient(145deg, var(--bg-surface), var(--bg-elevated));
        border-color: var(--border-featured);
    }
}

.pillar-card {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 14px;
    padding: 22px;
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    border-top: 2px solid var(--accent-gold);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.pillar-card[data-pillar-accent="emerald"] {
    border-top-color: var(--accent-emerald);
}

.pillar-card[data-pillar-accent="cyan"] {
    border-top-color: var(--accent-cyan);
}

.pillar-card:hover {
    transform: translateY(-3px);
    background: var(--bg-surface-hover);
    border-color: var(--border-featured);
}

.pillar-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pillar-card__icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--accent-gold-soft);
    border: 1px solid var(--border-featured);
    color: var(--accent-gold);
    font-size: 18px;
    font-weight: 800;
}

.pillar-card[data-pillar-accent="emerald"] .pillar-card__icon {
    background: var(--accent-emerald-soft);
    border-color: rgba(16, 185, 129, 0.32);
    color: var(--accent-emerald);
}

.pillar-card[data-pillar-accent="cyan"] .pillar-card__icon {
    background: var(--accent-cyan-soft);
    border-color: rgba(56, 189, 248, 0.32);
    color: var(--accent-cyan);
}

.pillar-card__ar {
    font-family: var(--font-arabic);
    font-size: 18px;
    color: var(--accent-gold);
}

.pillar-card h3 {
    font-family: var(--font-display);
    font-size: 18px;
    margin: 4px 0 6px;
    color: var(--text-primary);
}

.pillar-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
}

.pillar-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 12px;
    border-top: 1px solid var(--border-standard);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--accent-gold);
}

/* ==========================================================================
   SECTIONS & CURATED LIBRARY BOOK CARDS
   ========================================================================== */
.heritage-section {
    padding: 56px 0 0;
}

.heritage-section__heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 26px;
}

@media (min-width: 768px) {
    .heritage-section__heading {
        flex-direction: row;
        align-items: flex-end;
        gap: 28px;
    }
}

.heritage-section h2,
.heritage-workspace h2,
.heritage-contribute h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(26px, 3.3vw, 42px);
    line-height: 1.18;
    letter-spacing: -0.6px;
    margin: 10px 0;
    color: var(--text-primary);
}

.heritage-section h2 em,
.heritage-workspace h2 em,
.heritage-contribute h2 em {
    font-family: var(--font-arabic);
    font-weight: 400;
    color: var(--accent-gold);
}

.heritage-section__heading p {
    max-width: 600px;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.75;
    margin: 0;
}

.heritage-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-gold);
    white-space: nowrap;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--accent-gold);
}

.heritage-section__aside {
    font: 700 26px var(--font-arabic);
    color: var(--accent-gold);
}

/* Prestigious Digital Volume Book Cards */
.heritage-bookshelf {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}

@media (min-width: 560px) {
    .heritage-bookshelf {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 960px) {
    .heritage-bookshelf {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1360px) {
    .heritage-bookshelf--featured {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.heritage-book {
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: transform 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

.heritage-book:hover {
    transform: translateY(-4px);
    border-color: var(--border-featured);
    background: var(--bg-surface-hover);
    box-shadow: var(--shadow-glow-gold);
}

.heritage-book__cover {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 22px 18px;
    background: radial-gradient(circle at 50% 25%, rgba(212, 172, 98, 0.09), var(--bg-inset) 78%);
    border-bottom: 1px solid var(--border-standard);
    min-height: 248px;
}

.heritage-book__cover .catalogue-cover {
    width: 100%;
    max-width: 162px;
    aspect-ratio: 3 / 4;
    min-height: 0;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.heritage-book:hover .heritage-book__cover .catalogue-cover {
    transform: translateY(-4px) scale(1.02);
}

.heritage-book__cover .catalogue-cover__frame {
    padding: 11px 9px;
}

.heritage-book__cover .catalogue-cover__title {
    font-size: 15px;
}

.heritage-book__cover .catalogue-cover__series,
.heritage-book__cover .catalogue-cover__notice {
    font-size: 6px;
}

.heritage-book__cover .catalogue-cover__author {
    font-size: 8px;
}

.heritage-book__cover .catalogue-cover__secondary {
    font-size: 8px;
}

.heritage-book__metadata {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 18px 20px 20px;
    min-width: 0;
}

.heritage-book__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 10px;
}

.heritage-book__category {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: var(--accent-gold);
    margin-bottom: 4px;
}

.heritage-book h3,
.heritage-book__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
    font: 700 18px/1.45 var(--font-sans);
    margin: 4px 0 6px;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}

.heritage-book h3:lang(ar),
.heritage-book h3:lang(fa),
.heritage-book__title:lang(ar),
.heritage-book__title:lang(fa) {
    font: 700 21px/1.68 var(--font-arabic);
}

.heritage-book h3:lang(ur),
.heritage-book__title:lang(ur) {
    font: 400 19px/2.05 var(--font-urdu);
}

.heritage-book h3 a:hover,
.heritage-book__title a:hover {
    color: var(--accent-gold);
}

.heritage-book__translation {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 6px;
}

.heritage-book__author {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 2px 0 14px;
}

.heritage-book__facts {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    border-top: 1px solid var(--border-standard);
    padding-top: 12px;
}

.heritage-book__facts span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-standard);
}

.heritage-book__facts span.heritage-book__fact--highlight {
    color: var(--accent-emerald);
    border-color: rgba(16, 185, 129, 0.3);
    background: var(--accent-emerald-soft);
}

.heritage-book__actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.heritage-book__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 7px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    transition: all 0.16s ease;
}

.heritage-book__btn--primary {
    background: var(--accent-gold-soft);
    border: 1px solid var(--border-featured);
    color: var(--accent-gold);
}

.heritage-book__btn--primary:hover {
    background: var(--accent-gold);
    color: var(--text-on-gold);
}

.heritage-book__btn--secondary {
    background: var(--bg-elevated);
    border: 1px solid var(--border-standard);
    color: var(--text-primary);
}

.heritage-book__btn--secondary:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
    background: var(--bg-surface-hover);
}

.heritage-empty {
    grid-column: 1 / -1;
    border: 1px dashed var(--border-featured);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    padding: 44px 24px;
    text-align: center;
}

.heritage-empty h3 {
    font-family: var(--font-display);
    font-size: 22px;
    margin: 10px 0 8px;
    color: var(--text-primary);
}

.heritage-empty p {
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 520px;
    margin: 0 auto 20px;
}

/* ==========================================================================
   VERIFIED RESEARCH SHOWCASE, CATEGORIES, MULTILINGUAL & COMPACT SOURCES
   ========================================================================== */
.showcase-proof-stack {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
}

.showcase-proof-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    border-left: 4px solid var(--accent-emerald);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    min-width: 0;
}

.showcase-proof-card[data-tradition="sunni"] {
    border-left-color: var(--accent-cyan);
}

@media (min-width: 640px) {
    .showcase-proof-card {
        gap: 24px;
        padding: 24px;
    }
}

@media (min-width: 1024px) {
    .showcase-proof-card {
        grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.65fr);
        gap: 32px;
        padding: 30px 32px;
        align-items: start;
    }
}

.showcase-proof-card__main {
    min-width: 0;
}

.showcase-proof-card__ar {
    margin: 18px 0 16px;
    padding: 20px 24px;
    background: var(--bg-inset);
    border: 1px solid var(--border-featured);
    border-right: 4px solid var(--accent-gold);
    border-radius: var(--radius-md);
    font-family: var(--font-arabic);
    font-size: clamp(1.32rem, 2.2vw, 1.62rem);
    line-height: 2.15;
    color: var(--text-primary);
}

.showcase-proof-card__tr {
    margin: 0;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-standard);
    border-left: 3px solid var(--accent-emerald);
    border-radius: var(--radius-sm);
    font-size: 15px;
    line-height: 1.8;
    color: var(--text-primary);
}

.showcase-proof-card__meta {
    padding: 20px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-standard);
}

.showcase-proof-card__meta-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-standard);
}

.showcase-proof-card__scan {
    position: relative;
    display: block;
    width: 66px;
    height: 92px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border-featured);
    background: #F8F4EB;
    box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.45);
    flex-shrink: 0;
}

.showcase-proof-card__scan img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
}

.showcase-proof-card__scan span {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    padding: 2px 4px;
    background: rgba(7, 20, 29, 0.88);
    color: var(--accent-gold);
    font-size: 9px;
    font-weight: 800;
    text-align: center;
}

.showcase-proof-card__meta-head h4 {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 15.5px;
    color: var(--accent-gold);
    letter-spacing: 0.3px;
}

.showcase-proof-card__meta-head p {
    margin: 0;
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.showcase-proof-card__meta h4 {
    margin: 0 0 12px;
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--accent-gold);
    letter-spacing: 0.4px;
}

.showcase-proof-card__dl {
    margin: 0 0 16px;
    display: grid;
    gap: 10px;
}

.showcase-proof-card__dl div {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-standard);
    font-size: 13px;
}

.showcase-proof-card__dl dt {
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.showcase-proof-card__dl dd {
    margin: 0;
    text-align: right;
    font-weight: 700;
    color: var(--text-primary);
}

.text-emerald {
    color: var(--accent-emerald);
}

.showcase-proof-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Research Categories Showcase */
.categories-showcase {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
}

@media (min-width: 640px) {
    .categories-showcase {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .categories-showcase {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .categories-showcase .category-card--featured {
        grid-column: span 2;
        background: linear-gradient(145deg, var(--bg-surface), var(--bg-elevated));
        border-color: var(--border-featured);
    }
}

.category-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    border-top: 2px solid var(--accent-gold);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.category-card[data-cat-accent="emerald"] {
    border-top-color: var(--accent-emerald);
}

.category-card[data-cat-accent="cyan"] {
    border-top-color: var(--accent-cyan);
}

.category-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-gold);
    background: var(--bg-surface-hover);
}

.category-card__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.category-card__icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--accent-gold-soft);
    border: 1px solid var(--border-featured);
    color: var(--accent-gold);
    font-size: 18px;
}

.category-card[data-cat-accent="emerald"] .category-card__icon {
    background: var(--accent-emerald-soft);
    border-color: rgba(16, 185, 129, 0.32);
    color: var(--accent-emerald);
}

.category-card[data-cat-accent="cyan"] .category-card__icon {
    background: var(--accent-cyan-soft);
    border-color: rgba(56, 189, 248, 0.32);
    color: var(--accent-cyan);
}

.category-card__ar {
    display: block;
    font: 700 24px/1.75 var(--font-arabic);
    color: var(--accent-emerald);
    margin: 14px 0 4px;
}

.category-card h3 {
    font-family: var(--font-display);
    font-size: 20px;
    margin: 4px 0 8px;
    color: var(--text-primary);
}

.category-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
    margin: 0;
}

.category-card__footer {
    margin-top: 18px;
}

.category-card__bar {
    height: 4px;
    width: 100%;
    border-radius: var(--radius-pill);
    background: var(--bg-inset);
    overflow: hidden;
    margin-bottom: 12px;
}

.category-card__bar span {
    display: block;
    height: 100%;
    border-radius: var(--radius-pill);
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-emerald));
}

.category-card__cta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-standard);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--accent-gold);
}

/* Multilingual Experience & Interactive Workbench */
.multilingual-showcase {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 22px 18px;
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, var(--bg-surface), var(--bg-elevated));
    border: 1px solid var(--border-featured);
    box-shadow: var(--shadow-card);
    min-width: 0;
}

@media (min-width: 640px) {
    .multilingual-showcase {
        gap: 28px;
        padding: 30px 24px;
    }
}

@media (min-width: 1024px) {
    .multilingual-showcase {
        grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.25fr);
        gap: 36px;
        padding: 38px;
        align-items: start;
    }
}

.multilingual-showcase__copy {
    min-width: 0;
}

.multilingual-showcase__copy p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.8;
    margin: 12px 0 18px;
}

.script-workbench {
    padding: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-inset);
    border: 1px solid var(--border-featured);
    display: grid;
    gap: 12px;
}

.script-workbench__header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.script-workbench__header strong {
    font-size: 13.5px;
    color: var(--accent-gold);
}

.script-workbench__header span {
    font-size: 12px;
    color: var(--text-secondary);
}

.script-workbench__tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.script-workbench__tab {
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--border-standard);
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    transition: all 0.16s ease;
}

.script-workbench__tab:hover,
.script-workbench__tab.is-active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.script-workbench__normalizer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    min-width: 0;
}

.script-workbench__norm-box {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.script-workbench__norm-box small {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.script-workbench__norm-box strong {
    font-size: 16px;
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.script-workbench__arrow {
    color: var(--accent-emerald);
    font-weight: 800;
    font-size: 16px;
}

.script-workbench__form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.script-workbench__form input {
    flex: 1;
    min-width: 160px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 14.5px;
    outline: none;
}

.script-workbench__form input:focus {
    border-color: var(--accent-gold);
}

.multilingual-cards {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    min-width: 0;
}

@media (min-width: 640px) {
    .multilingual-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1200px) {
    .multilingual-cards {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.multilingual-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 8px;
    padding: 18px;
    border-radius: var(--radius-md);
    background: var(--bg-inset);
    border: 1px solid var(--border-standard);
    transition: transform 0.18s ease, border-color 0.18s ease;
}

.multilingual-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-gold);
}

.multilingual-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.multilingual-card__script {
    font: 700 24px/1.6 var(--font-arabic);
    color: var(--accent-gold);
}

.multilingual-card__script:lang(ur) {
    font: 400 20px/2.0 var(--font-urdu);
}

.multilingual-card__script:lang(hi) {
    font-family: var(--font-devanagari);
    font-size: 20px;
}

.multilingual-card strong {
    font-size: 15px;
    color: var(--text-primary);
}

.multilingual-card p {
    margin: 0;
    font-size: 12.5px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.multilingual-card__cta {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-gold);
    margin-top: 4px;
}

/* Compact External Sources Directory */
.compact-sources-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

@media (min-width: 560px) {
    .compact-sources-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 960px) {
    .compact-sources-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

.compact-source-item {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 6px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    transition: border-color 0.18s ease, transform 0.18s ease, background-color 0.18s ease;
}

.compact-source-item:hover {
    border-color: var(--accent-gold);
    background: var(--bg-surface-hover);
    transform: translateY(-2px);
}

.compact-source-item__top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.compact-source-item__num {
    font-size: 11px;
    font-weight: 800;
    color: var(--accent-gold);
}

.compact-source-item__type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent-emerald);
}

.compact-source-item__ext {
    margin-left: auto;
    font-size: 13px;
    color: var(--text-secondary);
}

.compact-source-item strong {
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--text-primary);
}

.compact-source-item > span {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-secondary);
}

.heritage-contribute {
    margin: 56px 0 32px;
    padding: 44px 24px;
    text-align: center;
    border: 1px solid var(--border-featured);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, var(--bg-surface), var(--bg-elevated));
    box-shadow: var(--shadow-card);
}

.heritage-contribute p {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.8;
    max-width: 580px;
    margin: 0 auto 22px;
}

.heritage-contribute__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

/* ==========================================================================
   CATALOGUE INDEX VIEW & RESPONSIVE GRID / LIST TOGGLE
   ========================================================================== */
.library-hero,
.heritage-catalogue-header {
    position: relative;
    isolation: isolate;
    padding: 28px 24px;
    margin-bottom: 18px;
    border: 1px solid var(--border-featured);
    border-radius: var(--radius-lg);
    background: linear-gradient(145deg, var(--bg-surface), var(--bg-elevated));
    box-shadow: var(--shadow-card);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (min-width: 768px) {
    .library-hero,
    .heritage-catalogue-header {
        padding: 34px 36px;
        gap: 24px;
    }
}

.library-hero__top {
    display: flex;
    flex-direction: column;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
}

@media (min-width: 768px) {
    .library-hero__top {
        flex-direction: row;
        align-items: flex-end;
        gap: 32px;
    }
}

.library-hero h1,
.heritage-catalogue-header h1 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(30px, 4.2vw, 48px);
    line-height: 1.14;
    letter-spacing: -0.5px;
    margin: 8px 0 10px;
    color: var(--text-primary);
}

.library-hero h1 em,
.heritage-catalogue-header h1 em {
    font-family: var(--font-arabic);
    font-weight: 400;
    color: var(--accent-gold);
}

.library-hero p,
.heritage-catalogue-header p {
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 680px;
    margin: 0;
    font-size: 15px;
}

/* Genuine Database-Driven Statistics Bar */
.library-stats-bar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding-top: 18px;
    border-top: 1px solid var(--border-standard);
}

@media (min-width: 768px) {
    .library-stats-bar {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 16px;
    }
}

.library-stat-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    background: var(--bg-inset);
    border: 1px solid var(--border-standard);
}

.library-stat-item strong {
    font-family: var(--font-display);
    font-size: clamp(20px, 2.5vw, 26px);
    font-weight: 700;
    color: var(--accent-gold);
    line-height: 1.2;
}

.library-stat-item span {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    text-transform: uppercase;
}

/* Intelligent Top Search Bar */
.library-search-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 640px) {
    .library-search-bar {
        flex-direction: row;
        align-items: stretch;
    }
}

.library-search-bar__field {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 14px;
    background: var(--bg-inset);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.library-search-bar__field:focus-within {
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 2px var(--accent-gold-soft);
}

.library-search-bar__icon {
    font-size: 18px;
    color: var(--accent-gold);
    flex-shrink: 0;
}

.library-search-bar__field input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--text-primary);
    padding: 10px 4px;
    font-size: 15px;
    outline: none;
}

.library-search-bar__field input::placeholder {
    color: var(--text-muted);
}

.library-search-bar__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-surface);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}

.library-search-bar__clear:hover {
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
}

.chip-rail__divider {
    width: 1px;
    height: 20px;
    background: var(--border-strong);
    margin-inline: 6px;
    flex-shrink: 0;
}

.active-filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    border: 1px solid var(--border-featured);
}

.active-filters-bar__label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--accent-gold);
}

.active-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: var(--accent-gold-soft);
    border: 1px solid var(--border-featured);
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
}

.active-filter-pill:hover {
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.active-filters-bar__clear {
    margin-left: auto;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent-gold);
    text-decoration: underline;
}

/* Main Two-Column Library Layout */
.heritage-catalogue-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    padding-top: 8px;
    align-items: start;
}

@media (min-width: 1024px) {
    .heritage-catalogue-layout {
        grid-template-columns: 280px minmax(0, 1fr);
        gap: 28px;
    }
}

.heritage-filters-aside {
    min-width: 0;
}

@media (min-width: 1024px) {
    .heritage-filters-aside {
        position: sticky;
        top: 92px;
    }
}

.heritage-filters {
    align-self: start;
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-md);
    padding: 20px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-card);
}

.heritage-filters summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-weight: 800;
    font-size: 14px;
    letter-spacing: 0.4px;
    color: var(--accent-gold);
    cursor: pointer;
    list-style: none;
}

.heritage-filters summary::-webkit-details-marker {
    display: none;
}

.heritage-filters[open] summary {
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-standard);
}

.heritage-filters label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.heritage-filters input,
.heritage-filters select {
    display: block;
    width: 100%;
    min-width: 0;
    margin-top: 6px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-inset);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 13px;
}

.heritage-filters input:focus,
.heritage-filters select:focus {
    border-color: var(--accent-gold);
    outline: none;
}

.heritage-filters .btn {
    width: 100%;
    margin-top: 4px;
}

.heritage-filters .heritage-reset {
    display: block;
    margin-top: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: underline;
}

.heritage-filters .heritage-reset:hover {
    color: var(--accent-gold);
}

.heritage-catalogue-results {
    min-width: 0;
}

.heritage-results-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 18px;
    background: var(--bg-surface);
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
}

.heritage-results-toolbar__count strong {
    color: var(--text-primary);
}

.heritage-results-toolbar__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.heritage-per-page {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.heritage-per-page > span {
    margin-right: 4px;
    color: var(--text-secondary);
}

.heritage-per-page__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border-standard);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 700;
}

.heritage-per-page__link:hover,
.heritage-per-page__link.is-active {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.heritage-view-toggle {
    display: flex;
    gap: 6px;
}

.heritage-view-toggle button {
    border: 1px solid var(--border-standard);
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
}

.heritage-view-toggle button[aria-pressed="true"] {
    background: var(--accent-gold-soft);
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

/* Responsive Book Grid: 1 col mobile, 2 cols tablet, 3 cols desktop, 4 cols XL desktop */
.heritage-catalogue .heritage-bookshelf {
    grid-template-columns: 1fr;
    gap: 22px;
}

@media (min-width: 560px) {
    .heritage-catalogue .heritage-bookshelf {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .heritage-catalogue .heritage-bookshelf {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1420px) {
    .heritage-catalogue .heritage-bookshelf {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* List Mode */
.heritage-bookshelf[data-view="list"] {
    grid-template-columns: 1fr !important;
    gap: 16px;
}

.heritage-bookshelf[data-view="list"] .heritage-book {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 0;
}

@media (min-width: 640px) {
    .heritage-bookshelf[data-view="list"] .heritage-book {
        grid-template-columns: 165px minmax(0, 1fr);
    }
}

.heritage-bookshelf[data-view="list"] .heritage-book__cover {
    min-height: 0;
    padding: 14px;
    border-bottom: 0;
    border-right: 1px solid var(--border-standard);
}

.heritage-bookshelf[data-view="list"] .heritage-book__actions {
    max-width: 340px;
}

.heritage-bookshelf[data-view="list"] .catalogue-cover__title {
    font-size: 13px;
}

.heritage-bookshelf[data-view="list"] .catalogue-cover__secondary,
.heritage-bookshelf[data-view="list"] .catalogue-cover__series {
    display: none;
}
