/**
 * Slide Presentation Styles
 *
 * UVA-branded styles for interactive presentations.
 * Uses CSS variables from main.css for theme support.
 */

/* ==================== Slide Variables ==================== */

:root {
    --slide-accent: #e57200;
    --slide-navy: #232D4B;
    --slide-muted: #555555;
}

/* Citation styling — use class="cite" on [Author Year] spans */
.slide .cite {
    color: var(--slide-muted);
    font-weight: 600;
}

/* ==================== Accessibility ==================== */

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus indicators */
.slide-nav button:focus-visible,
.slide-jump-item:focus-visible,
.slide-jump-input:focus-visible,
.simulation-controls button:focus-visible {
    outline: 3px solid var(--slide-accent);
    outline-offset: 2px;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .fragment {
        transition: none;
    }

    .slide-progress-bar {
        transition: none;
    }

    .slide-jump-item {
        transition: none;
    }
}

/* ==================== Base Presentation ==================== */

.slide-presentation {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #ffffff;
}

.slides-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* ==================== Individual Slides ==================== */

/* Footer bar height */
:root {
    --footer-height: 24px;
}

.slide {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: calc(100vh - var(--footer-height));
    padding: clamp(1rem, 4vw, 4rem) clamp(1.5rem, 5vw, 6rem);
    box-sizing: border-box;
    background: #ffffff;
    color: #212529;
    overflow-x: hidden;
    overflow-y: auto;
}

.slide.active {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: clamp(2rem, 8vh, 6rem);
}

/* Center content by default */
.slide-center {
    align-items: center;
    text-align: center;
}

/* Top-aligned content */
.slide-top {
    justify-content: flex-start;
    padding-top: 6rem;
}

/* ==================== Typography ==================== */

.slide h1 {
    font-family: "franklingothic-demi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--slide-navy);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.slide h2 {
    font-family: "franklingothic-demi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(1.4rem, 3.5vw, 2.5rem);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--slide-navy);
    margin-bottom: 1.5rem;
    line-height: 1.3;
}

/* Slide title in upper left corner */
.slide h2.slide-title {
    position: absolute;
    top: 2vh;
    left: 2vw;
    font-size: clamp(2rem, 3.1vw, 3.5rem);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--slide-navy);
    font-weight: 600;
    margin: 0;
    text-align: left;
}

/* Responsive slide utilities */
.slide figcaption {
    font-size: clamp(0.9rem, 1.4vw, 1.3rem);
    color: var(--slide-muted);
    margin-top: 0.5vh;
}

.slide h3 {
    font-family: "franklingothic-demi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: #212529;
    margin-bottom: 1rem;
}

.slide p, .slide li {
    font-family: "franklingothic-book", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.slide ul, .slide ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.slide li {
    margin-bottom: 0.5rem;
}

.slide a {
    color: var(--slide-accent);
    text-decoration: none;
}

.slide a:hover {
    text-decoration: underline;
}

.slide strong {
    font-family: "franklingothic-demi", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Subtitle styling */
.slide .subtitle {
    font-family: 'Unna', serif;
    font-style: italic;
    font-size: 1.8rem;
    color: var(--slide-muted);
    margin-top: -0.5rem;
    margin-bottom: 2rem;
}

/* Author styling */
.slide .author {
    font-size: 1.3rem;
    color: var(--slide-muted);
    margin-top: 2rem;
}

/* ==================== Top Navigation Bar ==================== */

.slide-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--footer-height);
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0 12px;
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    z-index: 1000;
}

/* ==================== Progress Bar ==================== */

.slide-progress {
    position: fixed;
    top: var(--footer-height);
    left: 0;
    right: 0;
    height: 4px;
    background: var(--progress-bg);
    z-index: 1000;
}

.slide-progress-bar {
    height: 100%;
    background: var(--slide-accent);
    transition: width 0.3s ease;
    width: 0;
}

/* Hide dots */
.slide-dots {
    display: none;
}

/* Navigation arrows */
.slide-prev-direct,
.slide-next-direct,
.slide-prev-step,
.slide-next-step {
    background: transparent;
    border: none;
    color: #666;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
}

.slide-prev-direct:hover,
.slide-next-direct:hover,
.slide-prev-step:hover,
.slide-next-step:hover {
    color: var(--slide-accent);
}

/* Double arrows slightly larger */
.slide-prev-direct,
.slide-next-direct {
    font-size: 14px;
}

/* Slide counter */
.slide-counter {
    color: #555;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
    margin: 0 4px;
}

/* Menu button */
.slide-nav .slide-menu {
    background: transparent;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 2px 6px;
    margin-left: 4px;
}

.slide-nav .slide-menu:hover {
    color: var(--slide-accent);
}

/* Speaker clock (minutes only) */
.slide-clock {
    color: #999;
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 11px;
    margin-left: 8px;
}

/* ==================== Jump Menu ==================== */

.slide-jump-menu {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    padding: 2rem 3rem;
    overflow-y: auto;
}

.slide-jump-menu[hidden] {
    display: none;
}

/* Number input at top */
.slide-jump-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.slide-jump-input-wrapper label {
    color: white;
    font-size: 1.2rem;
}

.slide-jump-input {
    width: 100px;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    border: 2px solid var(--slide-accent);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #212529;
    text-align: center;
}

.slide-jump-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(229, 114, 0, 0.4);
}

/* Grid of slides */
.slide-jump-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    align-content: start;
}

.slide-jump-item {
    background: #ffffff;
    border-radius: 8px;
    padding: 1rem;
    cursor: pointer;
    text-align: center;
    transition: transform 0.2s, outline-color 0.2s;
    outline: 2px solid transparent;
}

.slide-jump-item:hover {
    transform: scale(1.03);
    outline-color: var(--slide-accent);
}

.slide-jump-item.current {
    outline: 3px solid var(--slide-accent);
}

.slide-jump-number {
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--slide-accent);
    margin-bottom: 0.25rem;
}

.slide-jump-title {
    font-size: 0.9rem;
    color: #212529;
    line-height: 1.3;
}

/* ==================== Build Order Overlay ==================== */

.slide-build-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
}

.slide-build-overlay[hidden] {
    display: none;
}

.slide-build-content {
    max-width: 900px;
    width: 100%;
}

.slide-build-content h2 {
    color: white;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.slide-build-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 0.75rem;
    padding: 0.75rem 1rem;
    border-left: 3px solid transparent;
}

.slide-build-item.current {
    background: rgba(229, 114, 0, 0.15);
    border-left-color: var(--slide-accent);
}

.slide-build-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0;
}

.slide-build-header:hover {
    opacity: 0.8;
}

.slide-build-num {
    background: var(--slide-accent);
    color: white;
    font-weight: bold;
    font-size: 0.85rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    min-width: 2rem;
    text-align: center;
}

.slide-build-title {
    color: white;
    font-weight: 500;
    flex: 1;
}

.slide-build-id {
    color: rgba(255, 255, 255, 0.4);
    font-family: 'SF Mono', Monaco, monospace;
    font-size: 0.8rem;
}

.slide-build-steps {
    list-style: none;
    margin: 0.5rem 0 0 2.5rem;
    padding: 0;
    font-size: 0.85rem;
}

.slide-build-steps li {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.2rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.slide-build-steps .step-icon {
    font-size: 0.7rem;
    opacity: 0.6;
}

.slide-build-steps .fragment-step {
    color: #8be9fd;
}

.slide-build-steps .sim-step {
    color: #50fa7b;
}

.slide-build-empty {
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.85rem;
    margin-left: 2.5rem;
    font-style: italic;
}

/* ==================== Simulation Slides ==================== */

.slide.slide-simulation {
    padding: 2rem 3rem;
}

.slide.slide-simulation h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.simulation-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.simulation-container canvas {
    max-width: 100%;
    max-height: 100%;
    border: 2px solid var(--slide-navy);
    border-radius: 8px;
    background: #ffffff;
}

.simulation-controls {
    background: #F1F1EF;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-top: 1rem;
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.simulation-controls button {
    background: var(--slide-accent);
    border: none;
    color: white;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.simulation-controls button:hover {
    background: #c45f00;
}

.simulation-controls button.btn-secondary {
    background: var(--slide-muted);
}

.simulation-controls button.btn-secondary:hover {
    background: #5a6268;
}

.simulation-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    color: #212529;
}

.simulation-controls input[type="range"] {
    width: 150px;
}

/* ==================== Two-Column Layout ==================== */

.slide-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
    width: 100%;
}

.slide-columns > * {
    min-width: 0;
}

/* ==================== Images ==================== */

.slide img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
}

.slide figure {
    margin: 0;
    text-align: center;
}

.slide figcaption {
    font-size: clamp(0.9rem, 1.4vw, 1.3rem);
    color: var(--slide-muted);
    margin-top: 0.5vh;
    font-style: italic;
}

/* ==================== Code Blocks ==================== */

.slide pre {
    background: var(--code-bg, #f5f5f5);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    font-size: 1.1rem;
    line-height: 1.4;
}

.slide code {
    font-family: 'SF Mono', Monaco, 'Consolas', monospace;
}

/* ==================== Responsive ==================== */

@media (max-width: 1024px) {
    .slide {
        padding: 3rem 4rem;
    }

    .slide h1 {
        font-size: 2.8rem;
    }

    .slide h2 {
        font-size: 2rem;
    }

    .slide p, .slide li {
        font-size: 1.3rem;
    }

    .slide-columns {
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .slide-columns {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .slide-nav {
        top: 0.5rem;
        padding: 0.3rem 0.75rem;
        font-size: 0.9rem;
    }

    .slide-jump-menu {
        padding: 1rem;
    }

    .slide-jump-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.5rem;
    }

    .slide-jump-item {
        padding: 0.5rem;
    }

    .simulation-controls {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

/* ==================== Fragments (PowerPoint-style builds) ==================== */

.fragment {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.fragment.visible {
    opacity: 1;
    visibility: visible;
}

/* Fragment animation variants */
.fragment.fade-up {
    transform: translateY(20px);
}

.fragment.fade-up.visible {
    transform: translateY(0);
}

.fragment.fade-down {
    transform: translateY(-20px);
}

.fragment.fade-down.visible {
    transform: translateY(0);
}

.fragment.fade-left {
    transform: translateX(20px);
}

.fragment.fade-left.visible {
    transform: translateX(0);
}

.fragment.fade-right {
    transform: translateX(-20px);
}

.fragment.fade-right.visible {
    transform: translateX(0);
}

.fragment.zoom-in {
    transform: scale(0.9);
}

.fragment.zoom-in.visible {
    transform: scale(1);
}

/* Highlight fragment - dims then brightens */
.fragment.highlight {
    opacity: 0.4;
    visibility: visible;
}

.fragment.highlight.visible {
    opacity: 1;
}

/* ==================== Print Styles ==================== */

@media print {
    .slide-progress,
    .slide-nav,
    .slide-jump-menu {
        display: none !important;
    }

    .slide {
        display: block !important;
        position: relative;
        page-break-after: always;
        height: auto;
        min-height: 100vh;
    }
}
