.materials-page {
    padding-top: 26px;
}

.materials-container {
    max-width: 1380px;
}

.materials-hero {
    overflow: hidden;
    margin-bottom: 24px;
    border-radius: 32px;
    background:
        radial-gradient(circle at top right, rgba(124, 121, 184, 0.16), transparent 28%),
        radial-gradient(circle at bottom left, rgba(124, 121, 184, 0.08), transparent 24%),
        linear-gradient(180deg, #ffffff 0%, #f9fafe 100%);
}

.materials-hero-body {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(260px, 0.7fr);
    gap: 28px;
    align-items: end;
    padding: 30px 32px;
}

.materials-header {
    margin-bottom: 0;
}

.materials-kicker {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--primary-dark);
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 14px;
}

.materials-header h1 {
    margin: 0 0 12px;
    font-size: clamp(2.7rem, 4vw, 4rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
}

.materials-header p {
    margin: 0;
    max-width: 760px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.72;
}

.materials-hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.materials-hero-stat {
    padding: 18px 18px 16px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(34, 42, 70, 0.05);
}

.materials-hero-stat span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.materials-hero-stat strong {
    color: var(--text);
    font-size: 1.9rem;
    line-height: 1;
}

.materials-toolbar-shell {
    margin-bottom: 22px;
}

.materials-toolbar {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 18px;
    padding: 14px;
    border: 1px solid rgba(226, 230, 240, 0.92);
    border-radius: 30px;
    background: rgba(245, 247, 252, 0.88);
    box-shadow: 0 14px 32px rgba(34, 42, 70, 0.08);
}

.materials-filter-card,
.materials-search-card,
.materials-summary-card,
.materials-card,
.materials-featured-card {
    border-radius: 26px;
}

.materials-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.materials-chip {
    appearance: none;
    border: 1px solid #d8dbeb;
    background: #f4f5fb;
    color: #5f6488;
    border-radius: 999px;
    padding: 10px 16px;
    font-weight: 700;
    font-size: 0.94rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.18s ease;
}

.materials-chip.active,
.materials-chip:hover {
    background: #817cc5;
    color: #ffffff;
    border-color: #817cc5;
}

.materials-summary-card {
    margin-bottom: 28px;
}

.materials-search-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.materials-summary-card .pronunciation-results-body {
    gap: 16px;
}

.materials-summary-card .pronunciation-results-left strong {
    font-size: 1.35rem;
    line-height: 1;
}

.materials-summary-card .pronunciation-results-left span {
    color: var(--muted);
    font-size: 0.96rem;
}

.materials-subheader {
    margin-bottom: 18px;
}

.materials-featured-section {
    margin-bottom: 34px;
}

.materials-featured-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.materials-featured-card-body {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 22px;
    padding: 22px;
}

.materials-featured-preview,
.materials-card-preview {
    border-radius: 20px;
    overflow: hidden;
    background: linear-gradient(135deg, #eef1f8, #f7f8fc);
    border: 1px solid #e4e8f2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.materials-featured-preview {
    min-height: 180px;
}

.materials-card-preview {
    min-height: 160px;
    margin-bottom: 16px;
}

.materials-featured-preview img,
.materials-card-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.materials-preview-placeholder {
    font-size: 2.8rem;
    color: #7b81a4;
}

.materials-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.materials-type-pill {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #f1f2fb;
    border: 1px solid #d9ddea;
    color: #5f63a5;
    font-size: 0.88rem;
    font-weight: 700;
}

.materials-badge {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 5px 11px;
    border-radius: 999px;
    background: #e9f6ee;
    color: #2f7d57;
    font-size: 0.84rem;
    font-weight: 800;
}

.materials-card h3,
.materials-featured-card h3 {
    margin: 0 0 8px;
    font-size: 1.28rem;
    line-height: 1.15;
    color: #232435;
}

.materials-topic-label {
    margin: 0 0 8px;
    color: #7c80a0;
    font-weight: 700;
    font-size: 0.95rem;
}

.materials-card-description {
    margin: 0 0 14px;
    color: #697089;
    line-height: 1.6;
    font-size: 0.97rem;
}

.materials-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.materials-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.materials-library-section {
    margin-bottom: 20px;
}

.materials-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}

/* Same cards on a session page, where there are only ever a handful of decks
   for one topic — keep them from stretching across the full row. */
.session-materials-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 260px));
}

.materials-card-body {
    padding: 18px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.materials-card-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.materials-card .materials-actions {
    margin-top: auto;
}

@media (max-width: 1200px) {
    .materials-hero-body,
    .materials-toolbar {
        grid-template-columns: 1fr;
    }

    .materials-featured-grid {
        grid-template-columns: 1fr;
    }

    .materials-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .materials-hero-stats {
        grid-template-columns: 1fr;
    }

    .materials-featured-card-body {
        grid-template-columns: 1fr;
    }

    .materials-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .materials-hero-body {
        padding: 22px 20px;
    }

    .materials-grid {
        grid-template-columns: 1fr;
    }

    .materials-card h3,
    .materials-featured-card h3 {
        font-size: 1.15rem;
    }
}
.materials-preview-word-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

/* ============================================================
   Flashcard-set cards: pastel top + white card-stack graphic +
   serif title + Print/Download. The live look for /materials/
   (not Aurora-gated). Replaces the old grey .materials-card tiles.
   ============================================================ */
.mat-card {
    display: flex;
    flex-direction: column;
    border-radius: 24px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 14px 34px rgba(34, 42, 70, 0.07);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 48px rgba(34, 42, 70, 0.12);
}

.mat-card-top {
    display: grid;
    place-items: center;
    min-height: 168px;
    padding: 26px 20px;
}

/* Cycled pastel tops (match the artifact palette). */
.mat-top-1 { background: linear-gradient(180deg, #dbe5fb 0%, #ccd9f6 100%); }
.mat-top-2 { background: linear-gradient(180deg, #d5efe1 0%, #c4e8d3 100%); }
.mat-top-3 { background: linear-gradient(180deg, #fadfc6 0%, #f6d1b2 100%); }
.mat-top-4 { background: linear-gradient(180deg, #e5def8 0%, #d7cdf3 100%); }
.mat-top-5 { background: linear-gradient(180deg, #fbe6bd 0%, #f7daa5 100%); }
.mat-top-6 { background: linear-gradient(180deg, #fbdce8 0%, #f6c9da 100%); }

/* White flashcard-stack graphic with the topic emoji on the front card. */
.mat-card-stack {
    position: relative;
    width: 104px;
    height: 78px;
}

.mat-card-stack::before,
.mat-card-stack::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 18px rgba(40, 44, 80, 0.10);
}

.mat-card-stack::before { transform: rotate(-7deg) translate(-5px, 3px); }
.mat-card-stack::after { transform: rotate(6deg) translate(5px, -2px); }

.mat-card-stack-face {
    position: absolute;
    inset: 0;
    /* Sit ABOVE the ::before/::after stack cards — without this the ::after
       card paints on top and hides the icon (and the old emoji). */
    z-index: 1;
    display: grid;
    place-items: center;
    background: #ffffff;
    border-radius: 14px;
    font-size: 2.2rem;
    line-height: 1;
    box-shadow: 0 12px 26px rgba(40, 44, 80, 0.16);
}
/* Topic icon centred on the white card-stack face (replaces the old emoji). */
.mat-card-icon { color: var(--primary); }

.mat-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 20px 20px;
    flex: 1;
}

.mat-card-title {
    margin: 0;
    font-family: "Fraunces", Georgia, "Times New Roman", serif;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1.15;
    color: var(--text);
}

.mat-card-meta {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.mat-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.mat-card-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.96rem;
    text-decoration: none;
    border: 1px solid var(--border);
    background: #ffffff;
    color: var(--text);
    transition: background 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.mat-card-btn:hover { transform: translateY(-1px); border-color: #c9cce4; }

.mat-card-btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.mat-card-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.mat-card-btn:focus-visible {
    outline: 3px solid rgba(124, 121, 184, 0.45);
    outline-offset: 2px;
}
