/* Speaker notes - hidden from slide display */
aside.speaker-notes,
.speaker-notes {
    display: none !important;
}

/* Base specific overrides for presentation structure using Brand Tokens */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    /* Using brand variables */
    font-family: var(--font-sans, 'Albert Sans', sans-serif);
    background-color: var(--bg);
    color: var(--primary);
    overflow: hidden; /* Hide scrollbars, managed via JS scrollTo */
    width: 100vw;
    height: 100vh;
}

#presentation-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    scroll-snap-type: none;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, transform-origin;
    transform-origin: 0 0;
}

/* Grid Mode Styles */
body.grid-mode {
    overflow: auto !important;
    background-color: var(--bg) !important;
}

body.grid-mode #presentation-container {
    transform: scale(0.15);
    /* width/height fit-content should be avoided during transition or moved to a separate state */
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-wrap: nowrap;
    gap: 80px;
    padding: calc(var(--space-3xl) * 2);
    overflow: visible;
    margin: 0;
}

body.grid-mode .column {
    min-width: auto;
    width: auto;
    height: auto;
    overflow: visible;
    gap: 80px;
}

body.grid-mode .slide {
    min-width: 100vw;
    width: 100vw;
    height: 100vh;
    border: 10px solid var(--border);
    border-radius: 20px;
    background: var(--bg-alt);
    cursor: pointer;
    pointer-events: all;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

body.grid-mode .slide:hover {
    transform: scale(1.05);
    border-color: var(--accent);
}

body.grid-mode .slide .content {
    opacity: 1;
    pointer-events: none;
}

body.grid-mode .slide.active {
    border-color: var(--accent);
    border-width: 20px;
}

body.grid-mode #bottom-nav,
body.grid-mode #global-logo {
    display: none !important;
}

.column {
    display: flex;
    flex-direction: column;
    min-width: 100vw;
    height: 100vh;
    overflow: hidden;
    scroll-snap-type: none;
    scroll-snap-align: none;
}

.slide {
    min-width: 100vw;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: none;
    position: relative;
    cursor: none;
    flex-shrink: 0;
}

.slide-logo-container {
    position: fixed;
    top: clamp(var(--space-sm), 3vw, var(--space-md));
    right: clamp(var(--space-sm), 3vw, var(--space-md));
    display: flex;
    gap: clamp(var(--space-xs), 1vw, var(--space-sm));
    align-items: center;
    justify-content: center;
    background-color: var(--card);
    padding: clamp(var(--space-xs), 1vw, var(--space-sm));
    border-radius: var(--border-radius);
    box-shadow: 0 4px 6px var(--shadow);
    border: 1px solid var(--border);
    z-index: 50;
}

.slide-logo-img {
    height: clamp(30px, 4vw, 50px);
    width: auto;
    object-fit: contain;
}

.content {
    width: 100%;
    height: 100%;
    padding: clamp(var(--space-md), 4vw, var(--space-2xl)) clamp(var(--space-sm), 4vw, var(--space-xl));
    padding-bottom: var(--space-3xl);
    opacity: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow-y: auto;
}

.slide.active .content {
    opacity: 1;
    animation: slideIn 0.6s ease forwards;
}

/* Poster slide specific styles */
.poster-slide {
    padding: 0;
    background-color: var(--bg);
}

.poster-slide .content {
    padding: 0;
    opacity: 1; /* Always visible if active */
    animation: none;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.fullscreen-poster {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

h1 {
    /* Brand fonts already mapped to standard headings */
    font-size: clamp(2rem, 6vw, 4.5rem);
    margin-bottom: clamp(var(--space-sm), 2vw, var(--space-md));
    letter-spacing: -0.02em;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}

h2 {
    font-size: clamp(1.5rem, 5vw, 3rem);
    margin-bottom: clamp(var(--space-xs), 1.5vw, var(--space-sm));
    color: var(--secondary);
    font-weight: 600;
    line-height: 1.3;
}

blockquote {
    font-size: clamp(2rem, 6vw, 4.5rem);
    margin: clamp(var(--space-sm), 2vw, var(--space-md)) 0;
    padding-left: clamp(var(--space-md), 3vw, var(--space-lg));
    border-left: 6px solid var(--accent);
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
    letter-spacing: -0.02em;
    font-style: italic;
}

.slide-subtitle {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--accent) !important;
}

p {
    font-size: clamp(1.1rem, 2.5vw, 1.75rem);
    color: var(--secondary);
    margin-bottom: clamp(var(--space-sm), 2vw, var(--space-lg));
    line-height: 1.6;
}

ul {
    margin-bottom: clamp(var(--space-md), 2vw, var(--space-xl));
    padding-left: clamp(var(--space-md), 3vw, var(--space-lg));
    color: var(--secondary);
    font-size: clamp(1.1rem, 2.5vw, 1.75rem);
    line-height: 1.6;
    text-align: left;
    max-width: 90%;
}

li {
    margin-bottom: clamp(var(--space-xs), 1vw, var(--space-sm));
}

code {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    background: var(--bg-alt);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-size: 0.95em;
}

pre {
    overflow-x: auto;
    margin: clamp(var(--space-sm), 2vw, var(--space-lg)) 0;
    text-align: left;
    width: fit-content;
    max-width: 100%;
}

pre code {
    font-size: clamp(0.9rem, 2vw, 1.25rem);
    line-height: 1.5;
    background: none;
    padding: 0;
}

.qr-container {
    display: flex;
    justify-content: center;
    gap: clamp(var(--space-xl), 8vw, var(--space-3xl));
    margin-top: var(--space-2xl);
    width: 100%;
}

.qr-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
    flex: 1;
    max-width: 400px;
}

.qr-item img {
    width: 100%;
    height: auto;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--card); /* QRs usually need white background for better scanning */
    padding: var(--space-sm);
    transition: filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.qr-container:has(.qr-item img:hover) .qr-item img:not(:hover) {
    filter: blur(12px);
    opacity: 0.25;
}

.qr-item img:hover {
    filter: none;
    opacity: 1;
}

.qr-item a {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: 1.5rem;
    color: var(--accent);
    text-decoration: none;
    text-align: center;
    word-break: break-all;
}

.qr-caption {
    font-family: var(--font-sans, 'Albert Sans', sans-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}

.qr-item a:hover {
    text-decoration: underline;
}

.slide-actions {
    margin-top: var(--space-xl);
    display: none;
    gap: var(--space-md);
    align-items: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.slide-actions.show {
    display: flex;
}

.slide-actions.visible {
    opacity: 1;
    transform: translateY(0);
}

#bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: clamp(50px, 8vh, 60px);
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(var(--space-md), 4vw, var(--space-xl));
    z-index: 1000;
    padding: 0 var(--space-sm);
}

.nav-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--primary);
    width: clamp(36px, 8vw, 40px);
    height: clamp(36px, 8vw, 40px);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.nav-btn .material-symbols-outlined {
    font-size: clamp(18px, 4vw, 24px);
}

.nav-btn:hover:not(:disabled) {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.nav-btn:active:not(:disabled) {
    transform: scale(0.95);
}

#nav-coordinates {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--primary);
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: 600;
    min-width: clamp(60px, 15vw, 80px);
    text-align: center;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
    .content {
        justify-content: flex-start;
        padding-top: clamp(var(--space-lg), 6vh, var(--space-2xl));
    }

    .slide-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .slide-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .qr-container {
        flex-direction: column;
        align-items: center;
        gap: var(--space-xl);
        padding: 0;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .nav-btn {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Centered Slide Styling */
.centered-slide .content {
    text-align: center;
    justify-content: center;
    align-items: center;
}

/* Title Slide Styling */
.title-slide .content {
    text-align: center;
    justify-content: center;
    gap: clamp(var(--space-lg), 5vh, var(--space-2xl));
    padding-top: clamp(var(--space-2xl), 10vh, 120px);
    padding-bottom: clamp(var(--space-2xl), 10vh, 120px);
}

.presentation-title {
    font-size: clamp(2rem, 8vw, 5rem);
    line-height: 1.1;
    margin-bottom: 0;
    font-weight: 700;
    background: linear-gradient(-45deg, var(--primary), var(--accent), var(--secondary), #ff3d00, #ffea00, var(--accent), var(--primary));
    background-size: 400% 400%;
    animation: gradientMove 25s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes gradientMove {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

.credentials {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(var(--space-sm), 2vw, var(--space-md));
    margin-top: auto;
    width: 100%;
}

.credentials > * {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.credential-name {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    font-weight: 600;
    color: var(--primary);
    margin-bottom: clamp(var(--space-sm), 2vw, var(--space-md));
}

.credential-role {
    font-size: clamp(1.15rem, 2.5vw, 1.5rem);
    color: var(--secondary);
    margin-bottom: 0;
}

.credential-badge {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0;
}

.credential-link {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0;
    font-weight: 500;
}

.credential-link:hover {
    opacity: 0.7;
}

/* Joke Slide Styling */
.joke-slide .content {
    text-align: center;
    justify-content: center;
    align-items: center;
    gap: clamp(var(--space-lg), 3vh, var(--space-2xl));
}

.joke-setup {
    font-size: clamp(1.25rem, 3vw, 2rem);
    color: var(--primary);
    font-weight: 600;
    font-style: italic;
    margin-bottom: clamp(var(--space-md), 3vh, var(--space-xl));
}

.joke-punchline {
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    color: var(--accent);
    font-weight: 700;
    line-height: 1.4;
    margin-bottom: clamp(var(--space-lg), 4vh, var(--space-2xl));
}

.joke-footer {
    font-size: clamp(0.9rem, 2vw, 1.15rem);
    color: var(--muted);
    font-style: italic;
    margin-bottom: 0;
}

.title-image {
    max-width: clamp(100px, 15vw, 180px);
    height: auto;
    margin: 0 auto;
}

.poster-slide .content {
    padding: 0;
    justify-content: center;
    align-items: center;
    background-color: var(--bg);
}

.fullscreen-poster {
    width: 100%;
    height: 100%;
    object-fit: contain;
    cursor: pointer;
}

.end-visuals {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(var(--space-md), 4vw, var(--space-2xl));
    margin-bottom: clamp(var(--space-md), 4vw, var(--space-xl));
}

.end-badge {
    max-width: 250px;
    height: auto;
}

.end-qr {
    max-width: 220px;
    height: auto;
    border-radius: 12px;
}

/* End Slide Styling */
.end-slide .content {
    text-align: center;
    justify-content: center;
    gap: clamp(var(--space-md), 2vh, var(--space-lg));
}

.end-title {
    font-size: clamp(2.5rem, 8vw, 5rem);
    margin-bottom: clamp(var(--space-lg), 4vh, var(--space-2xl));
    background: linear-gradient(-45deg, var(--primary), var(--accent), var(--secondary), #ff3d00, #ffea00, var(--accent), var(--primary));
    background-size: 400% 400%;
    animation: gradientMove 25s ease infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.end-contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(var(--space-sm), 2vw, var(--space-md));
    width: 100%;
}

.end-contact > * {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
}

.end-name {
    font-size: clamp(2rem, 4.5vw, 3rem);
    font-weight: 600;
    color: var(--primary);
    margin-bottom: clamp(var(--space-sm), 2vw, var(--space-md));
}

.end-role {
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    color: var(--secondary);
    margin-bottom: 0;
}

.end-badge {
    font-size: clamp(1.25rem, 3vw, 1.8rem);
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0;
}

.end-link {
    font-size: clamp(1.35rem, 3vw, 1.8rem);
    color: var(--accent);
    text-decoration: none;
    transition: opacity 0.2s ease;
    margin-bottom: 0;
    font-weight: 500;
}

.end-link:hover {
    opacity: 0.7;
}

.end-tagline {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--secondary);
    margin-top: clamp(var(--space-lg), 4vh, var(--space-2xl));
    margin-bottom: 0;
    font-weight: 500;
}

.inline-logo {
    height: 1.25em;
    width: 2.5em;
    object-fit: contain;
    background-color: var(--accent);
    padding: 0 var(--space-xs);
    border-radius: var(--border-radius-sm, 4px);
    margin: 0 0.2em;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

.android-logo {
    height: 1em;
    width: auto;
    margin: 0 0.2em;
    display: inline-flex;
    align-self: center;
}

#custom-cursor {
    width: 20px;
    height: 20px;
    background: var(--accent);
    opacity: 0.5;
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    display: none;
}

#custom-cursor.active {
    display: block;
}

#screensaver {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: var(--bg);
    z-index: 10000;
    overflow: hidden;
}

#screensaver-counter {
    position: absolute;
    top: var(--space-lg);
    right: var(--space-lg);
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    color: var(--primary);
    font-size: 2rem;
    z-index: 10001;
}

#screensaver-logo-wrapper {
    position: absolute;
    background: var(--card);
    padding: clamp(var(--space-xs), 2vw, var(--space-sm)) clamp(var(--space-sm), 3vw, var(--space-md));
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    will-change: transform;
    max-width: clamp(200px, 30vw, 400px);
}

#screensaver-logo {
    width: 100%;
    height: auto;
    display: block;
}

/* Screensaver Fireworks */
.firework-rocket {
    position: absolute;
    bottom: 0;
    width: 4px;
    height: 12px;
    background: var(--primary);
    border-radius: 2px;
    z-index: 10002;
    pointer-events: none;
    box-shadow: 0 0 10px var(--primary);
}

.firework-particle {
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    z-index: 10002;
    pointer-events: none;
    opacity: 0;
}

@keyframes sizzle {
    0% { transform: translateY(0); opacity: 1; }
    100% { transform: translateY(var(--target-y)); opacity: 1; }
}

@keyframes explode {
    0% { transform: translate(0, 0) scale(1); opacity: 1; }
    80% { opacity: 1; } /* Stay fully visible longer before starting to fade */
    100% { transform: translate(var(--dx), var(--dy)) scale(0.5); opacity: 0; }
}

.fullscreen-poster {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: var(--bg);
}

.poster-slide {
    cursor: pointer;
}

.step-fade {
    opacity: 0;
    transition: opacity 0.6s ease;
    cursor: pointer;
}

.step-fade.visible {
    opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
    *, ::after, ::before {
        transition: none !important;
        animation: none !important;
    }
}
