/* ═══════════════════════════════════════════════════════════
   DLO Survey — Main Stylesheet
   Clean, academic, navigable design
   ═══════════════════════════════════════════════════════════ */

/* ─── Reset & Variables ──────────────────────────────────── */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    --color-text: #1e293b;
    --color-text-secondary: #475569;
    --color-text-light: #64748b;
    --color-primary: #0369a1;
    --color-primary-light: #e0f2fe;
    --color-primary-dark: #0c4a6e;
    --color-accent: #0284c7;
    --color-border: #e2e8f0;
    --color-border-light: #f1f5f9;

    --sidebar-width: 280px;
    --content-max-width: 860px;
    --nav-height: 56px;
    --radius: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --transition: 0.2s ease;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
    font-family: var(--font-serif);
    font-size: 17px;
    line-height: 1.75;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

/* ─── Top Navigation ─────────────────────────────────────── */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 1000;
    transition: box-shadow var(--transition);
}

.top-nav.scrolled {
    box-shadow: var(--shadow-sm);
}

.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-title {
    font-family: var(--font-sans);
    font-weight: 700;
    font-size: 18px;
    color: var(--color-primary);
    text-decoration: none;
    letter-spacing: -0.3px;
}

.nav-section-select {
    flex: 1;
    max-width: 320px;
    margin: 0 24px;
}

.nav-section-select select {
    width: 100%;
    padding: 6px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: border-color var(--transition);
}

.nav-section-select select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.nav-links {
    display: flex;
    gap: 24px;
}

.nav-links a {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.nav-links a:hover {
    color: var(--color-primary);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text);
    margin: 5px 0;
    transition: var(--transition);
}

/* ─── Hero Section ───────────────────────────────────────── */
.hero {
    margin-top: var(--nav-height);
    background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 50%, #0284c7 100%);
    color: white;
    padding: 80px 24px 60px;
    text-align: center;
}

.hero-inner {
    max-width: 900px;
    margin: 0 auto;
}

.hero-journal {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
    margin-bottom: 20px;
}

.hero-title {
    font-family: var(--font-serif);
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 24px;
}

.hero-authors {
    font-family: var(--font-sans);
    font-size: 16px;
    font-weight: 400;
    opacity: 0.95;
    margin-bottom: 12px;
}

.hero-affiliations {
    font-family: var(--font-sans);
    font-size: 13px;
    opacity: 0.75;
    line-height: 1.6;
    max-width: 750px;
    margin: 0 auto;
}

.hero.hidden {
    display: none;
}

/* ─── Layout ─────────────────────────────────────────────── */
.layout {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 32px;
}

/* Content area needs top margin when hero is hidden */
.hero.hidden + .layout {
    padding-top: calc(var(--nav-height) + 24px);
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
    position: sticky;
    top: calc(var(--nav-height) + 16px);
    width: var(--sidebar-width);
    height: calc(100vh - var(--nav-height) - 32px);
    flex-shrink: 0;
    padding: 0 16px;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-inner {
    padding-bottom: 40px;
}

.sidebar-title {
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--color-text-light);
    margin-bottom: 16px;
    padding-left: 12px;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list ul {
    list-style: none;
    padding: 0;
}

.toc-list li {
    margin: 0;
}

.toc-list li a {
    display: block;
    padding: 5px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
    transition: all var(--transition);
    line-height: 1.5;
}

.toc-list li a:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.toc-list li a.active {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    font-weight: 500;
    background: var(--color-primary-light);
}

.toc-section a { font-weight: 500; }
.toc-subsection a { padding-left: 24px; font-size: 12.5px; }
.toc-subsubsection a { padding-left: 36px; font-size: 12px; color: var(--color-text-light); }

/* ─── Main Content ───────────────────────────────────────── */
.content {
    flex: 1;
    max-width: var(--content-max-width);
    padding: 0 32px 80px;
    min-width: 0;
}

/* ─── Abstract ───────────────────────────────────────────── */
.abstract-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.abstract-text {
    font-size: 16px;
    color: var(--color-text-secondary);
    text-align: justify;
}

/* ─── Section Headings ───────────────────────────────────── */
.section-heading {
    font-family: var(--font-sans);
    color: var(--color-text);
    margin-top: 48px;
    margin-bottom: 20px;
    scroll-margin-top: calc(var(--nav-height) + 20px);
}

h2.section-heading {
    font-size: 28px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-primary);
    margin-top: 56px;
}

h3.section-heading {
    font-size: 22px;
    font-weight: 600;
    margin-top: 40px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border);
}

h4.section-heading {
    font-size: 18px;
    font-weight: 600;
    margin-top: 32px;
    color: var(--color-text-secondary);
}

h5.section-heading {
    font-size: 16px;
    font-weight: 600;
    margin-top: 24px;
}

.sec-num {
    color: var(--color-primary);
    margin-right: 4px;
}

.section-divider {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: 48px 0;
}

/* ─── Body text ──────────────────────────────────────────── */
.section-body {
    margin-bottom: 16px;
}

.section-body p {
    margin-bottom: 14px;
    text-align: justify;
    hyphens: auto;
}

.section-body ul, .section-body ol {
    margin: 12px 0 12px 24px;
}

.section-body li {
    margin-bottom: 8px;
}

/* ─── Drop Cap ───────────────────────────────────────────── */
.dropcap {
    float: left;
    font-size: 3.2em;
    line-height: 0.85;
    padding-right: 0.08em;
    padding-top: 0.05em;
    font-weight: 600;
    color: var(--color-primary);
    font-family: var(--font-serif);
}

/* ─── Citations ──────────────────────────────────────────── */
.citation {
    color: var(--color-primary);
    text-decoration: none;
    font-family: var(--font-sans);
    font-size: 14px;
    cursor: pointer;
    transition: color var(--transition);
}

.citation:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

.citation.missing {
    color: #e74c3c;
    font-style: italic;
}

/* ─── Figures ────────────────────────────────────────────── */
.survey-figure {
    margin: 20px 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    text-align: center;
}

/* Place figures near the top of sections when possible */
.section-heading + .section-body > .survey-figure:first-child,
.section-body > .survey-figure:first-child {
    margin-top: 8px;
}

.survey-figure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin-bottom: 12px;
}

.survey-figure figcaption {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    text-align: left;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}

.figure-placeholder {
    padding: 40px 20px;
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text-secondary);
    font-style: italic;
    font-size: 14px;
}

.subfigures {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 12px;
}

.subfigure {
    flex: 1 1 200px;
    max-width: 350px;
    text-align: center;
}

.subfigure img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

.subfig-caption {
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--color-text-light);
    margin-top: 4px;
}

/* Figure grid layout (from LaTeX tabular environments) */
.figure-grid {
    display: grid;
    gap: 4px;
    margin-bottom: 4px;
    justify-items: center;
    align-items: center;
}

.figure-grid-1 { grid-template-columns: 1fr; }
.figure-grid-2 { grid-template-columns: repeat(2, 1fr); }
.figure-grid-3 { grid-template-columns: repeat(3, 1fr); }
.figure-grid-4 { grid-template-columns: repeat(4, 1fr); }
.figure-grid-5 { grid-template-columns: repeat(5, 1fr); }
.figure-grid-6 { grid-template-columns: repeat(6, 1fr); }

.figure-grid img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ─── Tables ─────────────────────────────────────────────── */
.table-container {
    margin: 32px 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.table-caption {
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    line-height: 1.6;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.survey-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
}

.survey-table thead {
    background: var(--color-primary);
    color: white;
}

.survey-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

.survey-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--color-border-light);
}

.survey-table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.survey-table tbody tr:hover {
    background: var(--color-primary-light);
}

/* ─── Math ───────────────────────────────────────────────── */
.math.display {
    margin: 20px 0;
    overflow-x: auto;
    padding: 8px 0;
}

.math.inline {
    font-size: 0.95em;
}

/* Equation numbering via KaTeX \tag{} */
.katex-display {
    position: relative;
}
.katex-display > .katex > .katex-html > .tag {
    position: absolute;
    right: 0;
}

/* ─── Algorithm ──────────────────────────────────────────── */
.algorithm-block {
    margin: 24px 0;
    padding: 16px 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    font-family: var(--font-sans);
    font-size: 0.92em;
    overflow-x: auto;
}
.algo-caption {
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--color-border-light);
    font-size: 0.95em;
}
.algo-body {
    line-height: 2;
}
.algo-line {
    white-space: nowrap;
}
.algo-keyword {
    color: var(--color-primary-dark);
    font-weight: 600;
}
.algo-comment {
    color: var(--color-text-light);
    font-style: italic;
    margin-left: 1em;
}

/* ─── Theorem-like Blocks ────────────────────────────────── */
.theorem-block {
    margin: 24px 0;
    padding: 16px 20px;
    border-left: 4px solid var(--color-primary);
    background: var(--color-primary-light);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.theorem-block.definition {
    border-left-color: #059669;
    background: #ecfdf5;
}
.theorem-block.assumption {
    border-left-color: #d97706;
    background: #fffbeb;
}
.theorem-block.theorem,
.theorem-block.lemma,
.theorem-block.proposition,
.theorem-block.corollary {
    border-left-color: #7c3aed;
    background: #f5f3ff;
}
.theorem-block.remark,
.theorem-block.example {
    border-left-color: #6b7280;
    background: #f9fafb;
}
.theorem-block.proof {
    border-left-color: #94a3b8;
    background: #f8fafc;
}
.theorem-block.proof .theorem-body {
    font-style: normal;
}
.theorem-header {
    margin: 0 0 8px 0;
    font-family: var(--font-sans);
    font-size: 0.95em;
}
.theorem-body {
    font-style: italic;
}
.theorem-body p:last-child {
    margin-bottom: 0;
}
.qed {
    float: right;
    font-size: 1.2em;
    line-height: 1;
    margin-top: 0.5em;
}

/* ─── References ─────────────────────────────────────────── */
.references-section {
    margin-top: 48px;
}

.references-search {
    margin-bottom: 20px;
}

.ref-search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 16px;
    font-family: var(--font-sans);
    font-size: 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    transition: border-color var(--transition);
}

.ref-search-input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-light);
}

.references-list {
    counter-reset: ref-counter;
}

.reference-entry {
    counter-increment: ref-counter;
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.7;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    scroll-margin-top: calc(var(--nav-height) + 20px);
    transition: background var(--transition);
}

.reference-entry::before {
    content: counter(ref-counter) ". ";
    font-weight: 600;
    color: var(--color-primary);
}

.reference-entry:target,
.reference-entry:hover {
    background: var(--color-primary-light);
}

.ref-link {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-primary);
    text-decoration: none;
}

.ref-link:hover {
    text-decoration: underline;
}

/* ─── Footnotes ──────────────────────────────────────────── */
.footnote {
    font-family: var(--font-sans);
    font-size: 11px;
    color: var(--color-primary);
    cursor: help;
}

/* ─── Back to Top ────────────────────────────────────────── */
.back-to-top {
    position: fixed;
    bottom: 32px;
    right: 32px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 20px;
    box-shadow: var(--shadow-md);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
    z-index: 100;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
}

/* ─── Section Cross-ref links ─────────────────────────────── */
.secref, .figref, .tabref, .ref, .eqref {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.secref:hover, .figref:hover, .tabref:hover, .ref:hover, .eqref:hover {
    text-decoration: underline;
}

/* ─── Sidebar References Link ─────────────────────────────── */
.sidebar-refs {
    margin-top: 20px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border-light);
}

.sidebar-refs-link {
    display: block;
    padding: 8px 12px;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-secondary);
    text-decoration: none;
    border-radius: 4px;
    transition: all var(--transition);
}

.sidebar-refs-link:hover {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

/* ─── Page Navigation (Prev/Next) ─────────────────────────── */
.page-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 60px;
    padding-top: 24px;
    border-top: 2px solid var(--color-border);
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 20px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-primary);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: all var(--transition);
    max-width: 50%;
}

.nav-btn:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.prev-btn {
    margin-right: auto;
}

.next-btn {
    margin-left: auto;
    text-align: right;
}

/* ─── Overview / Sections List (index page) ───────────────── */
.overview-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
}

.overview-list li {
    margin-bottom: 0;
}

.overview-list li a {
    display: block;
    padding: 14px 20px;
    font-family: var(--font-sans);
    font-size: 15px;
    color: var(--color-text);
    text-decoration: none;
    border-radius: var(--radius);
    border: 1px solid var(--color-border-light);
    margin-bottom: 8px;
    transition: all var(--transition);
}

.overview-list li a:hover {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.overview-list li a strong {
    color: var(--color-primary);
}

/* ─── Responsive Design ──────────────────────────────────── */
@media (max-width: 1100px) {
    .sidebar {
        display: none;
    }

    .layout {
        padding-top: 16px;
    }

    .content {
        max-width: 100%;
        padding: 0 20px 60px;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 60px 16px 40px;
    }

    .hero-title {
        font-size: 24px;
    }

    .nav-links {
        display: none;
    }

    .nav-links.open {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: white;
        padding: 16px 24px;
        border-bottom: 1px solid var(--color-border);
        box-shadow: var(--shadow-md);
    }

    .nav-section-select {
        max-width: 180px;
        margin: 0 8px;
    }

    .nav-toggle {
        display: block;
    }

    h2.section-heading { font-size: 22px; }
    h3.section-heading { font-size: 18px; }
    h4.section-heading { font-size: 16px; }

    .survey-figure { padding: 12px; }

    .subfigures {
        flex-direction: column;
        align-items: center;
    }

    .subfigure {
        max-width: 100%;
    }

    .table-container { padding: 12px; }

    .abstract-section { padding: 20px; }

    .page-nav {
        flex-direction: column;
    }

    .nav-btn {
        max-width: 100%;
        text-align: center;
        justify-content: center;
    }
}

/* ─── Print Styles ───────────────────────────────────────── */
@media print {
    .top-nav, .sidebar, .back-to-top, .references-search { display: none; }
    .hero { padding: 20px; }
    .content { max-width: 100%; padding: 0; }
    .survey-figure, .table-container { break-inside: avoid; }
}

/* ─── Scrollbar styling ──────────────────────────────────── */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-text-light);
}

/* ─── Author Biographies ─────────────────────────────────── */
.author-bios {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 2px solid var(--color-border);
}

.author-bio {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.author-photo {
    width: 90px;
    height: 112px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid var(--color-border);
}

.author-bio-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.6;
}

.author-bio-name {
    display: block;
    font-size: 1.05rem;
    margin-bottom: 0.3rem;
    color: var(--color-text);
}

/* ─── Citation block ────────────────────────────────────── */

.cite-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem 1rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.cite-block-title {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-secondary);
    margin-bottom: 0.75rem;
}

.cite-tab-row {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 0.85rem;
}

.cite-tab {
    font-family: var(--font-sans);
    font-size: 0.82rem;
    font-weight: 500;
    padding: 0.4rem 1rem;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    color: var(--color-text-light);
    transition: color var(--transition), border-color var(--transition);
}

.cite-tab:hover {
    color: var(--color-text);
}

.cite-tab.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.cite-panel {
    position: relative;
}

.cite-text-content {
    font-family: var(--font-serif);
    font-size: 0.92rem;
    line-height: 1.65;
    color: var(--color-text);
    margin: 0;
    padding-right: 3.5rem;
}

.cite-bibtex-content {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    line-height: 1.55;
    color: var(--color-text);
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    padding: 0.85rem 1rem;
    margin: 0;
    overflow-x: auto;
    white-space: pre;
}

.cite-copy-btn {
    position: absolute;
    top: 0;
    right: 0;
    font-family: var(--font-sans);
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.3rem 0.65rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: background var(--transition), color var(--transition);
}

.cite-copy-btn:hover {
    background: var(--color-border-light);
    color: var(--color-text);
}

.cite-copy-btn.copied {
    color: #16a34a;
    border-color: #16a34a;
}

/* ─── Video embed ───────────────────────────────────────── */

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    box-shadow: var(--shadow-sm);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-ext-link {
    display: inline-block;
    font-family: var(--font-sans);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-primary);
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color var(--transition);
}

.video-ext-link:hover {
    color: var(--color-accent);
}
