/**
 * Shared Presentation Styles
 * MSP430 Assembly Course - Dr. Santiago Scagliusi
 * University of Seville
 */

/* === i18n: dual-language visibility === */
html[lang="es"] [lang="en"]:not(html) { display: none; }
html[lang="en"] [lang="es"]:not(html) { display: none; }
html:not([lang]) [lang="es"]:not(html) { display: none; }

/* Language toggle in nav */
#lang-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    padding-left: 1rem;
    flex-shrink: 0;
}
.lang-btn {
    padding: 3px 8px;
    border: 1px solid rgba(100, 116, 139, 0.3);
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    letter-spacing: 0.05em;
}
.lang-btn:first-child {
    border-radius: 4px 0 0 4px;
}
.lang-btn:last-child {
    border-radius: 0 4px 4px 0;
}
.lang-btn:hover {
    color: #e2e8f0;
    border-color: rgba(148, 163, 184, 0.5);
}
.lang-btn-active {
    background: rgba(220, 38, 38, 0.8);
    border-color: rgba(239, 68, 68, 0.5);
    color: white;
}

@media (max-width: 768px) {
    #lang-toggle {
        padding-left: 0.5rem;
    }
    .lang-btn {
        padding: 2px 6px;
        font-size: 11px;
    }
}

/* === Base === */
body {
    background-color: #020617;
}

/* ========================================
   FULLSCREEN SLIDE MODE
   Each section = one full-screen slide
   Small sections expand, large sections scroll naturally
   ======================================== */

/* Enable scroll snapping - proximity allows large sections to scroll */
html.slide-mode {
    scroll-snap-type: y proximity;
    scroll-behavior: smooth;
}

html.slide-mode body {
    overflow-y: scroll;
}

/* Each section has minimum full height, but can grow */
html.slide-mode section {
    min-height: 100vh;
    min-height: 100dvh; /* Dynamic viewport height for mobile */
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    box-sizing: border-box;
    padding-top: 5rem;  /* Space for fixed nav */
    padding-bottom: 3rem;
    /* NO overflow:hidden - content flows naturally */
    /* NO max-height - large sections keep their full height */
}

html.slide-mode section.section-compact {
    padding-top: 4rem;
    padding-bottom: 2rem;
}

html.slide-mode section.section-tight {
    padding-top: 3.5rem;
    padding-bottom: 2rem;
}

/* Footer exception - doesn't need full height */
html.slide-mode footer {
    min-height: auto;
    scroll-snap-align: start;
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Prevent mx-auto shrink-wrap in flex sections: force full width */
html.slide-mode section > div {
    width: 100%;
}

/* Slide mode toggle button */
#slide-mode-toggle {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(100, 116, 139, 0.3);
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    z-index: 100;
    font-size: 12px;
    font-weight: bold;
}

#slide-mode-toggle:hover {
    background: rgba(30, 41, 59, 0.95);
    color: white;
    border-color: rgba(148, 163, 184, 0.5);
    transform: scale(1.1);
}

#slide-mode-toggle.active {
    background: rgba(220, 38, 38, 0.9);
    border-color: rgba(239, 68, 68, 0.5);
    color: white;
}

@media (max-width: 768px) {
    #slide-mode-toggle {
        bottom: 1rem;
        left: 1rem;
        width: 40px;
        height: 40px;
    }

    html.slide-mode section {
        padding-top: 4rem;
    }
}

/* === Animations === */
.bus-path {
    fill: none;
    stroke: #334155;
    stroke-width: 4;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: all 0.3s ease;
}

.bus-active {
    stroke: #3b82f6;
    filter: drop-shadow(0 0 4px #3b82f6);
}

.packet {
    position: absolute;
    z-index: 50;
    background: #ef4444;
    color: white;
    font-family: 'Fira Code', monospace;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    pointer-events: none;
}

/* Fan Spin */
@keyframes spin { 100% { transform: rotate(360deg); } }
.animate-spin-fast { animation: spin 0.6s linear infinite; }

/* ALU Pulse */
@keyframes pulse-alu {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
    100% { transform: scale(1); box-shadow: 0 0 0 rgba(239, 68, 68, 0); }
}
.alu-active {
    animation: pulse-alu 0.5s ease-out;
    border-color: #ef4444 !important;
}

/* === LED States === */
.led-on-red {
    background: #ef4444;
    box-shadow: 0 0 15px #ef4444;
    border-color: #fee2e2;
}
.led-on-green {
    background: #22c55e;
    box-shadow: 0 0 15px #22c55e;
    border-color: #dcfce7;
}
.led-off {
    background: #331111;
    opacity: 0.4;
    border-color: #451a1a;
}

/* === Progress Bar === */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(to right, #cc0000, #ef4444);
    transform-origin: left;
    transform: scaleX(0);
    z-index: 100;
    transition: transform 0.1s ease-out;
}

/* === Diagram Boxes === */
.diagram-box {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    border: 1px solid #334155;
}

/* === Code Blocks === */
.code-block {
    font-family: 'Fira Code', monospace;
    background: #0f172a;
    border: 1px solid #1e293b;
    border-radius: 0.5rem;
    padding: 1rem;
}

/* === ALU Shape === */
.alu-shape {
    clip-path: polygon(20% 0%, 80% 0%, 100% 100%, 50% 85%, 0% 100%);
}
