/**
 * Notas de Aula — CSS compartilhado
 * Usado por /ensino/index.html e /ensino/esp-unidadeN.html
 */

/* ===== VARIABLES ===== */
:root {
    --bg: #FAFAF7;
    --surface: #FFFFFF;
    --text: #1D1D1B;
    --text-secondary: #6E6E6E;
    --text-muted: #9A9A9A;
    --accent: #1A3A5C;
    --accent-bg: #EDF2F7;
    --accent-light: #EDF2F7;
    --accent-warm: #8B4513;
    --accent-warm-bg: #FAF3EB;
    --border: #E8E5DF;
    --border-light: #F2F0EB;
    --gold: #B8963E;
    --callout-bg: #F7F5F0;
    --unit1: #1A3A5C;
    --unit2: #8B4513;
    --unit3: #2D6A4F;
    --unit4: #6B2D5B;
    --macro-u1: #E65100;
    --macro-u2: #1565C0;
    --macro-u3: #2E7D32;
    --macro-u4: #6A1B9A;
    --macro-accent: #E65100;
    --macro-accent-bg: #FFF3E0;
    --serif: 'Source Serif 4', 'Georgia', serif;
    --display: 'Playfair Display', 'Georgia', serif;
    --mono: 'JetBrains Mono', 'Consolas', monospace;
    --sans: 'Source Sans 3', -apple-system, sans-serif;
    --transition: 0.25s ease;
    --content-width: 660px;
}

/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
    font-family: var(--serif);
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: var(--accent);
    z-index: 200;
    transition: width 0.1s linear;
    width: 0%;
}

/* ===== HEADER ===== */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(250, 250, 247, 0.92);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0.85rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-logo {
    font-family: var(--display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.header-nav {
    display: flex;
    gap: 0.2rem;
}
.header-nav a {
    font-family: var(--serif);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    transition: var(--transition);
}
.header-nav a:hover { color: var(--text); background: var(--accent-light); }
.header-nav a.active { color: var(--accent); background: var(--accent-light); font-weight: 600; }

/* ===== INDEX PAGE — HERO ===== */
.index-hero {
    max-width: 680px;
    margin: 0 auto;
    padding: 4.5rem 2rem 2rem;
    text-align: left;
}
.index-hero .label {
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.index-hero h1 {
    font-family: var(--display);
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.03em;
    margin-bottom: 1rem;
}
.index-hero .intro {
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--text-secondary);
}

/* ===== INDEX PAGE — COURSE BLOCKS ===== */
.courses-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 2rem 2rem 5rem;
}
.course-block {
    margin-bottom: 3.5rem;
}
.course-block-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--text);
}
.course-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.course-block-header h2 {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: -0.015em;
}
.course-block-header .course-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    letter-spacing: 0.04em;
}

/* Unit cards */
.unit-card {
    display: block;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.4rem 1.6rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}
.unit-card:hover {
    border-color: #ccc;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    transform: translateY(-2px);
}
.unit-card:hover .unit-card-arrow {
    transform: translateX(4px);
    opacity: 1;
}
.unit-card-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 12px 0 0 12px;
}
.unit-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}
.unit-card-number {
    font-family: var(--mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}
.unit-card h3 {
    font-family: var(--display);
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -0.01em;
    margin-bottom: 0.5rem;
}
.unit-card .unit-card-desc {
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--text-secondary);
}
.unit-card .unit-card-question {
    font-style: italic;
    font-size: 0.88rem;
    color: var(--gold);
    margin-top: 0.6rem;
    line-height: 1.55;
}
.unit-card-arrow {
    flex-shrink: 0;
    margin-top: 0.2rem;
    opacity: 0.4;
    transition: all 0.3s ease;
    color: var(--text-secondary);
}
.unit-card-arrow svg {
    width: 20px;
    height: 20px;
}
/* Expandable unit card (accordion trigger) */
.unit-toggle {
    cursor: pointer;
    user-select: none;
}
.unit-toggle .unit-card-arrow {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
.unit-toggle:hover .unit-card-arrow {
    transform: none;
}
.unit-toggle.is-open .unit-card-arrow {
    transform: rotate(180deg);
    opacity: 0.7;
}
.unit-card-count {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Chapter drawer (accordion panel) */
.chapter-drawer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.chapter-drawer.is-open {
    grid-template-rows: 1fr;
}
.chapter-drawer-inner {
    overflow: hidden;
    min-height: 0;
}
.chapter-drawer-inner > .chapter-card {
    margin-bottom: 0.4rem;
}
.chapter-drawer-inner > .chapter-card:first-child {
    margin-top: 0.4rem;
}
.chapter-drawer-inner > .chapter-card:last-child {
    margin-bottom: 0.75rem;
}

/* Individual chapter card */
.chapter-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.9rem 1.3rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.chapter-card-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--c);
    opacity: 0.35;
    border-radius: 10px 0 0 10px;
}
a.chapter-card:hover {
    border-color: #ccc;
    box-shadow: 0 2px 12px rgba(0,0,0,0.05);
    transform: translateY(-1px);
}
a.chapter-card:hover .chapter-card-bar {
    opacity: 1;
}
a.chapter-card:hover .chapter-card-title {
    color: var(--c);
}
.chapter-card-body {
    flex: 1;
    min-width: 0;
}
.chapter-card-number {
    font-family: var(--mono);
    font-size: 0.62rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}
.chapter-card-title {
    font-family: var(--display);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.35;
    transition: color 0.25s ease;
}
.chapter-card-desc {
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.chapter-card-arrow {
    flex-shrink: 0;
    opacity: 0.3;
    transition: all 0.3s ease;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}
.chapter-card-arrow svg {
    width: 16px;
    height: 16px;
}
a.chapter-card:hover .chapter-card-arrow {
    opacity: 1;
    transform: translateX(3px);
    color: var(--c);
}
.chapter-card--soon {
    opacity: 0.5;
    pointer-events: none;
}
.chapter-card--soon .coming-badge {
    font-family: var(--mono);
    font-size: 0.6rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--border-light);
    color: var(--text-muted);
    padding: 0.15rem 0.45rem;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.unit-card.coming-soon {
    opacity: 0.5;
    pointer-events: none;
}
.unit-card.coming-soon .coming-badge {
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: var(--border-light);
    color: var(--text-muted);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    margin-top: 0.4rem;
}

/* ===== ARTICLE HERO ===== */
.article-hero {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 4rem 2rem 2.5rem;
}

.article-hero .back-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 2rem;
    transition: var(--transition);
}
.article-hero .back-link:hover { color: var(--accent-warm); }
.article-hero .back-link svg { width: 14px; height: 14px; }

.article-hero .unit-label {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-warm);
    font-weight: 500;
    margin-bottom: 0.8rem;
}

.article-hero h1 {
    font-family: var(--display);
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.03em;
    margin-bottom: 1.2rem;
}

.article-hero .lead {
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1.65;
    color: var(--text-secondary);
    border-left: 3px solid var(--accent-warm);
    padding-left: 1.2rem;
    margin-bottom: 1.5rem;
}

.article-meta {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.article-meta .divider {
    width: 3px;
    height: 3px;
    background: var(--text-muted);
    border-radius: 50%;
}

/* ===== SHARE BUTTONS ===== */
.share-buttons {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-left: auto;
}
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--mono);
    font-size: 0.65rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    padding: 0.3rem 0.65rem;
    border-radius: 5px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.share-btn:hover {
    color: var(--accent-warm);
    border-color: var(--accent-warm);
}
.share-btn svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}
.share-btn.copied {
    color: #2e7d32;
    border-color: #2e7d32;
}

/* ===== ARTICLE LAYOUT ===== */
.article-layout {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem 5rem;
    display: grid;
    grid-template-columns: 1fr var(--content-width) 220px;
    gap: 0;
}

.article-spacer { }

/* ===== TABLE OF CONTENTS ===== */
.toc {
    position: sticky;
    top: 80px;
    align-self: start;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    padding-left: 2rem;
    padding-top: 0.5rem;
}

.toc-title {
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
    font-weight: 500;
}

/* TOC toggle (mobile only) */
.toc-toggle {
    display: none;
}

.toc a {
    display: block;
    font-family: var(--serif);
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--text-muted);
    text-decoration: none;
    padding: 0.3rem 0;
    padding-left: 0.7rem;
    border-left: 1.5px solid transparent;
    transition: var(--transition);
}
.toc a:hover {
    color: var(--text-secondary);
}
.toc a.active {
    color: var(--accent-warm);
    border-left-color: var(--accent-warm);
    font-weight: 500;
}

/* ===== ARTICLE CONTENT ===== */
.article-content {
    max-width: var(--content-width);
    font-size: 1.05rem;
    line-height: 1.82;
}

.article-content h2 {
    font-family: var(--display);
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    margin-top: 3.5rem;
    margin-bottom: 1rem;
    scroll-margin-top: 90px;
    color: var(--text);
}

.article-content h3 {
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.35;
    margin-top: 2.5rem;
    margin-bottom: 0.8rem;
    scroll-margin-top: 90px;
    color: var(--text);
}

.article-content p {
    margin-bottom: 1.2rem;
}

.article-content em {
    font-style: italic;
}

.article-content strong {
    font-weight: 600;
}

/* Section separator */
.article-content .section-break {
    display: block;
    text-align: center;
    margin: 2.5rem 0;
    color: var(--text-muted);
    font-size: 1.2rem;
    letter-spacing: 0.5em;
}

/* Concept callout */
.concept-box {
    background: var(--callout-bg);
    border-radius: 10px;
    padding: 1.3rem 1.5rem;
    margin: 1.5rem 0 1.8rem;
    border-left: 3px solid var(--accent-warm);
}
.concept-box .concept-label {
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-warm);
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.concept-box p {
    font-size: 0.93rem;
    line-height: 1.7;
    margin-bottom: 0;
    color: var(--text-secondary);
}
.concept-box p strong {
    color: var(--text);
}

/* Opening question */
.opening-question {
    font-family: var(--display);
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
}

/* Formula display */
.formula {
    font-family: var(--mono);
    font-size: 1rem;
    text-align: center;
    padding: 0.9rem 1.2rem;
    margin: 1.4rem 0;
    background: var(--callout-bg);
    border-radius: 8px;
    color: var(--text);
    letter-spacing: 0.03em;
}

/* Synthesis / summary table */
.table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0 1.8rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}
.note-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.note-table th {
    background: var(--callout-bg);
    padding: 0.65rem 0.9rem;
    text-align: left;
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.note-table td {
    padding: 0.75rem 0.9rem;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
    line-height: 1.55;
}
.note-table td:first-child {
    font-family: var(--mono);
    font-size: 0.78rem;
    font-weight: 500;
    white-space: nowrap;
    color: var(--text);
}
.note-table tr:last-child td {
    border-bottom: none;
}

/* Reference footer */
.article-reference {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.88rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Navigation between units */
.unit-nav {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 1rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.unit-nav a {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    text-decoration: none;
    color: var(--text);
    padding: 1rem 1.2rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    transition: all 0.25s ease;
    flex: 1;
    max-width: 48%;
}
.unit-nav a:hover {
    border-color: var(--accent-warm);
    background: var(--accent-warm-bg);
}
.unit-nav a.disabled {
    opacity: 0.4;
    pointer-events: none;
}
.unit-nav a .nav-label {
    font-family: var(--mono);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}
.unit-nav a .nav-title {
    font-family: var(--display);
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.35;
}
.unit-nav .next { text-align: right; margin-left: auto; }

/* ===== MATERIAL TOGGLE (accordion trigger) ===== */
.material-toggle {
    display: block;
    background: var(--surface);
    border: 1px solid rgba(184, 150, 62, 0.4);
    border-radius: 12px;
    padding: 1.2rem 1.4rem;
    margin-top: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text);
    user-select: none;
    position: relative;
    overflow: hidden;
}
.material-toggle:hover {
    border-color: var(--gold);
    box-shadow: 0 4px 20px rgba(184, 150, 62, 0.1);
    transform: translateY(-2px);
}
.material-toggle-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gold);
    border-radius: 12px 0 0 12px;
}
.material-toggle-top {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}
.material-toggle-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #FBF5E6;
    color: var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 0.1rem;
}
.material-toggle-label {
    font-family: var(--mono);
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gold);
    font-weight: 500;
    margin-bottom: 0.25rem;
}
.material-toggle h3 {
    font-family: var(--display);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.3rem;
}
.material-toggle-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.4;
}
.material-toggle-arrow {
    flex-shrink: 0;
    margin-top: 0.3rem;
    margin-left: auto;
    opacity: 0.4;
    color: var(--gold);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}
.material-toggle:hover .material-toggle-arrow {
    opacity: 0.7;
}
.material-toggle.is-open .material-toggle-arrow {
    transform: rotate(180deg);
    opacity: 0.8;
}
.material-toggle.is-open {
    border-color: var(--gold);
    background: #FFFDF7;
}

/* Material drawer (accordion panel) */
.material-drawer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.material-drawer.is-open {
    grid-template-rows: 1fr;
}
.material-drawer-inner {
    overflow: hidden;
    min-height: 0;
}
.material-drawer-inner > .material-item:first-child {
    margin-top: 0.4rem;
}
.material-drawer-inner > .material-item:last-child {
    margin-bottom: 0.75rem;
}

/* Individual PDF item */
.material-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0.7rem 1rem;
    margin-bottom: 0.35rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.2s ease;
    position: relative;
}
.material-item:hover {
    border-color: var(--gold);
    background: #FFFDF7;
    box-shadow: 0 2px 10px rgba(184, 150, 62, 0.08);
}
.material-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    background: #FDF2F2;
    color: #C0392B;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.material-item-body {
    flex: 1;
    min-width: 0;
}
.material-item-title {
    font-family: var(--display);
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text);
}
.material-item:hover .material-item-title {
    color: var(--gold);
}
.material-item-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
    line-height: 1.3;
}
.material-item-dl {
    flex-shrink: 0;
    opacity: 0;
    color: var(--gold);
    transition: opacity 0.2s ease;
}
.material-item:hover .material-item-dl {
    opacity: 1;
}

/* ===== DOWNLOAD MODAL ===== */
.download-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(29, 29, 27, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.download-modal-overlay.is-open {
    opacity: 1;
    pointer-events: all;
}
.download-modal {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    width: 100%;
    max-width: 360px;
    margin: 1rem;
    box-shadow: 0 24px 64px rgba(0,0,0,0.14);
    transform: translateY(14px) scale(0.98);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.download-modal-overlay.is-open .download-modal {
    transform: translateY(0) scale(1);
}
.download-modal-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    font-size: 1.1rem;
    line-height: 1;
}
.download-modal-close:hover {
    background: var(--border-light);
    color: var(--text);
}
.download-modal-icon {
    width: 48px;
    height: 48px;
    background: #FBF5E6;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    margin-bottom: 1.2rem;
}
.download-modal h3 {
    font-family: var(--display);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text);
}
.download-modal-subtitle {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 1.4rem;
    line-height: 1.5;
}
.download-modal-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-family: var(--mono);
    font-size: 1rem;
    color: var(--text);
    background: var(--bg);
    outline: none;
    transition: border-color 0.2s ease;
    margin-bottom: 0.5rem;
    letter-spacing: 0.12em;
}
.download-modal-input:focus {
    border-color: var(--gold);
}
.download-modal-input.has-error {
    border-color: #c0392b;
}
.download-modal-error {
    font-family: var(--mono);
    font-size: 0.7rem;
    color: #c0392b;
    margin-bottom: 1rem;
    min-height: 1rem;
    letter-spacing: 0.02em;
}
.download-modal-submit {
    width: 100%;
    padding: 0.8rem;
    background: var(--gold);
    color: white;
    border: none;
    border-radius: 8px;
    font-family: var(--display);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
}
.download-modal-submit:hover {
    background: #a07c2e;
    transform: translateY(-1px);
}

/* ===== FOOTER ===== */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== RESPONSIVE — TABLET ===== */
@media (max-width: 1060px) {
    .article-layout {
        grid-template-columns: 1fr;
        padding: 0 2rem 4rem;
    }
    .article-spacer { display: none; }

    /* TOC becomes collapsible on tablet/mobile */
    .toc {
        position: relative;
        top: 0;
        max-height: none;
        padding-left: 0;
        padding-bottom: 0;
        margin-bottom: 1.5rem;
        border-bottom: 1px solid var(--border);
    }
    .toc-title { display: none; }

    .toc-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: none;
        border: none;
        font-family: var(--mono);
        font-size: 0.7rem;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        color: var(--text-muted);
        cursor: pointer;
        padding: 0.6rem 0;
        font-weight: 500;
    }
    .toc-toggle svg {
        width: 14px;
        height: 14px;
        transition: transform 0.2s ease;
    }
    .toc-toggle.open svg {
        transform: rotate(180deg);
    }

    .toc-links {
        display: none;
        flex-wrap: wrap;
        gap: 0;
        padding-bottom: 1rem;
    }
    .toc-links.open {
        display: flex;
    }
    .toc a {
        border-left: none;
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
        border-radius: 4px;
    }
    .toc a.active {
        background: var(--accent-warm-bg);
        border-left: none;
    }

    .article-content {
        max-width: 100%;
    }
}

/* ===== RESPONSIVE — MOBILE ===== */
@media (max-width: 640px) {
    .index-hero { padding: 3rem 1.2rem 1.5rem; }
    .index-hero h1 { font-size: 2rem; }
    .courses-container { padding: 1.5rem 1.2rem 4rem; }
    .unit-card { padding: 1.1rem 1.2rem; }

    .article-hero { padding: 3rem 1.2rem 2rem; }
    .article-hero h1 { font-size: 2rem; }
    .article-hero .lead { font-size: 1.05rem; }
    .article-layout { padding: 0 1.2rem 3rem; }
    .article-content { font-size: 1rem; }
    .article-content h2 { font-size: 1.35rem; }
    .unit-nav { flex-direction: column; }
    .unit-nav a { max-width: 100%; }
    .header-inner { padding: 0.7rem 1rem; }
    .header-nav a { font-size: 0.75rem; padding: 0.35rem 0.5rem; }

    .share-buttons { margin-left: 0; margin-top: 0.5rem; width: 100%; }
    .article-meta { gap: 0.8rem; }

    .chapter-card { padding: 0.75rem 1rem; }
    .chapter-card-title { font-size: 0.88rem; }
    .chapter-card-desc { font-size: 0.78rem; }

    .material-toggle { padding: 1rem 1.1rem; }
    .material-toggle-icon { width: 34px; height: 34px; }
    .material-toggle h3 { font-size: 0.95rem; }
    .material-item { padding: 0.6rem 0.8rem; gap: 0.6rem; }
    .material-item-icon { width: 28px; height: 28px; }
    .material-item-title { font-size: 0.82rem; }
    .material-item-meta { font-size: 0.7rem; }
    .material-item-dl { opacity: 0.5; }
}
