/* Academic theme shared styles */
.reveal {
    font-size: 32px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --media-max-width: 92%;
}

.reveal h1 {
    color: #1a252f;
    border-bottom: 3px solid #2980b9;
    padding-bottom: 0.3em;
    font-size: 2.2em;
    font-weight: 600;
    margin-top: 25%;
}

.reveal h2 {
    color: #1a252f;
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: left;
    text-transform: none;
}

.reveal h3 {
    margin-top: 30px;
    color: #1a252f;
    font-size: 1.3em;
    font-weight: 600;
    text-transform: none;
}

.reveal p {
    font-size: 0.85em;
}

.reveal li {
    font-size: 0.85em;
}

.reveal .slides {
    text-align: left;
}

.reveal section {
    height: 100%;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    overflow-y: auto;
    overflow-x: hidden;
}

.reveal a {
    color: #2980b9;
}

/* Preserve side-by-side layout when printing */
.reveal .side-by-side {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-start !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    width: 100% !important;
}

.reveal .side-by-side>* {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.reveal .side-by-side pre,
.reveal .side-by-side .mermaid {
    width: fit-content !important;
    max-width: 100% !important;
}

.reveal a:hover {
    color: #1a5a8a;
}

/* Auto-fit and center markdown images without per-slide HTML tweaks */
.reveal section img {
    display: block;
    max-width: min(100%, var(--media-max-width));
    max-height: 70vh;
    height: auto;
    margin: 0.4em auto;
    object-fit: contain;
}

.reveal :not(pre)>code {
    color: rgba(0, 0, 0, 0.6);
}

.reveal .warning,
.reveal .info,
.reveal .success,
.reveal .danger {
    padding: 1em;
    margin: 1em 0;
    border-radius: 5px;
    border-left: 5px solid;
    text-align: left;
}

.reveal .warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.reveal .info {
    background: #d1ecf1;
    border-color: #17a2b8;
    color: #0c5460;
}

.reveal .success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.reveal .danger {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* Avoid extra spacing created by first/last paragraph margins inside callout blocks */
.reveal .warning> :first-child,
.reveal .info> :first-child,
.reveal .success> :first-child,
.reveal .danger> :first-child {
    margin-top: 0;
}

.reveal .warning> :last-child,
.reveal .info> :last-child,
.reveal .success> :last-child,
.reveal .danger> :last-child {
    margin-bottom: 0;
}

.reveal .side-by-side {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: nowrap;
    gap: 6px;
    width: 100%;
}

.reveal .side-by-side>* {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.reveal .side-by-side pre {
    width: fit-content;
    max-width: 100%;
}

.reveal .side-by-side .mermaid {
    width: fit-content;
    max-width: 100%;
}

.reveal .mermaid,
.reveal .mermaid svg {
    padding: 0 !important;
}

.reveal pre {
    width: fit-content;
    max-width: 100%;
}

.reveal .mermaid {
    display: inline-block;
    width: fit-content;
    max-width: 100%;
}

.reveal .mermaid svg {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
}


.reveal pre code {
    max-height: 550px;
}

.reveal ul,
.reveal ol {
    padding-left: 1.5em;
}


.reveal .slides section table,
.reveal .slides section table th,
.reveal .slides section table td {
    font-size: 22px;
}

@media print {

    /* Use the full printable area of the page */
    @page {
        margin: 0;
        size: auto;
    }

    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        height: auto !important;
    }

    .reveal,
    .reveal .slides {
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Preserve colored callout blocks in print */
    .reveal,
    .reveal .warning,
    .reveal .info,
    .reveal .success,
    .reveal .danger {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .reveal .warning,
    .reveal .info,
    .reveal .success,
    .reveal .danger {
        border-left-width: 5px !important;
        border-left-style: solid !important;
        display: block !important;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
    }

    /* One slide per page */
    .reveal .slides section {
        page-break-after: always;
        break-after: page;
        display: flex !important;
        flex-direction: column;
        justify-content: flex-start;
        align-items: flex-start;
        width: 100% !important;
        min-height: 100vh;
        height: auto;
        padding: 10mm !important;
        box-sizing: border-box;
        overflow: hidden;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }

    /* Avoid trailing blank page after the final slide */
    .reveal .slides section:last-of-type {
        page-break-after: auto;
        break-after: auto;
    }

    /* Show all slides, including hidden ones */
    .reveal .slides {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        transform: none !important;
        position: static !important;
    }

    .reveal {
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        font-size: 32px !important;
    }

    /* Fragments: show all steps */
    .reveal .fragment {
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
    }

    .reveal h1,
    .reveal h2,
    .reveal h3 {
        margin-top: 0 !important;
    }

    .reveal p {
        margin-bottom: 1em !important;
    }

    /* Mermaid labels are rendered in foreignObject (p/div/span), not <label> */
    .reveal .mermaid svg foreignObject p,
    .reveal .mermaid svg foreignObject div,
    .reveal .mermaid svg foreignObject span {
        font-size: 15px !important;
        line-height: 1 !important;
        margin: 0 !important;
    }

    .reveal .slides section .mermaid {
        transform: none !important;
        break-inside: avoid-page;
        page-break-inside: avoid;
    }


    .reveal pre {
        transform: none;
        break-inside: avoid-page;
        page-break-inside: avoid;
    }

    .reveal .slides section table,
    .reveal .slides section table th,
    .reveal .slides section table td {
        font-size: 20px !important;
    }


    /* --- 4. Optional: center only non-text blocks automatically --- */
    .reveal .slides section> :not(p):not(ul):not(ol):not(h1):not(h2):not(h3) {
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .reveal .slides section img {
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}