:root {
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
    
    /* Default dark theme variables */
    --bg-primary: #0b0f19;
    --bg-card: rgba(255, 255, 255, 0.03);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --accent-hover: #4f46e5;
    --border-color: rgba(255, 255, 255, 0.08);
    --gradient-h1: linear-gradient(135deg, #ffffff 0%, #a5b4fc 100%);
    --color-h2: #a5b4fc;
    --kbd-bg: rgba(255, 255, 255, 0.1);
    --kbd-border: rgba(255, 255, 255, 0.1);
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.3);
    --input-bg: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] {
    /* Light theme variables */
    --bg-primary: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --accent-hover: #4338ca;
    --border-color: rgba(15, 23, 42, 0.08);
    --gradient-h1: linear-gradient(135deg, #0f172a 0%, #4f46e5 100%);
    --color-h2: #4f46e5;
    --kbd-bg: rgba(15, 23, 42, 0.05);
    --kbd-border: rgba(15, 23, 42, 0.1);
    --shadow-card: 0 10px 30px rgba(15, 23, 42, 0.06);
    --input-bg: rgba(15, 23, 42, 0.02);
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Fullscreen Presentation Container */
#presentation-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Base Slide Container */
.slide {
    width: 100%;
    height: 100%;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    position: absolute;
    top: 0;
    left: 0;
    background-color: var(--bg-primary);
    overflow-y: auto;
}

/* Center-aligned Slide Layout Variant */
.slide.center {
    align-items: center;
    text-align: center;
}

/* Typography Hierarchy */
h1 {
    font-family: var(--font-heading);
    font-size: clamp(3rem, 8vw, 5.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -0.03em;
    background: var(--gradient-h1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

h2 {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    color: var(--color-h2);
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

p {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
    line-height: 1.6;
    color: var(--text-secondary);
    max-width: 800px;
    margin-bottom: 2rem;
}

/* Slide elements layout helper */
.content-wrapper {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    margin-top: auto;
    margin-bottom: auto;
}

.slide.center .content-wrapper {
    align-items: center;
}

/* Glassmorphism Card (Interactive Demo containers) */
.demo-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2.5rem;
    width: 100%;
    max-width: 600px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-card);
}

/* Interactive Components */
button {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 0.8rem 1.6rem;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px var(--accent-glow);
}

button:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

button:active {
    transform: scale(0.98);
}

input[type="text"] {
    font-family: var(--font-body);
    font-size: 1.1rem;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.8rem 1.2rem;
    color: var(--text-primary);
    width: 100%;
    margin-bottom: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Counter demo styling */
.counter-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.counter-value {
    font-family: var(--font-heading);
    font-size: 4rem;
    font-weight: 800;
    color: var(--text-primary);
    transition: transform 0.1s ease;
    display: inline-block;
}

/* Form demo styling */
.form-feedback {
    margin-top: 1rem;
    font-size: 1.1rem;
    color: #34d399; /* emerald-400 */
    opacity: 0;
    transition: opacity 0.3s ease;
}

.form-feedback.visible {
    opacity: 1;
}

/* Keyboard Hints Footer */
.nav-hint {
    position: absolute;
    bottom: 2rem;
    right: 2rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    pointer-events: none;
    letter-spacing: 0.05em;
    font-family: var(--font-heading);
    text-transform: uppercase;
    opacity: 0;
}

.nav-hint span {
    background: var(--kbd-bg);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin: 0 0.2rem;
    border: 1px solid var(--kbd-border);
}

/* Theme Toggle Button Styling */
#theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    padding: 0; /* Reset global button padding to prevent squishing the SVG */
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

#notes-toggle {
    position: fixed;
    top: 2rem;
    right: 5.5rem;
    z-index: 100;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    pointer-events: none;
    transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

/* Animations for Auto-Fade Controls */
@keyframes fadeOutTheme {
    0% { opacity: 1; pointer-events: auto; }
    60% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

@keyframes fadeOutNavHint {
    0% { opacity: 0.6; pointer-events: auto; }
    60% { opacity: 0.6; }
    100% { opacity: 0; pointer-events: none; }
}

/* Run fade-out animations when controls-visible is active */
.controls-visible #theme-toggle,
.controls-visible #notes-toggle {
    animation: fadeOutTheme 5s forwards;
}

.controls-visible .nav-hint {
    animation: fadeOutNavHint 5s forwards;
}

/* Force visible on hover or when notes modal is open */
.modal-open #theme-toggle,
.modal-open #notes-toggle,
#theme-toggle:hover,
#notes-toggle:hover {
    animation: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.modal-open .nav-hint,
.nav-hint:hover {
    animation: none !important;
    opacity: 0.6 !important;
    pointer-events: auto !important;
}

#theme-toggle:hover,
#notes-toggle:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: scale(1.05);
}

[data-theme="light"] #theme-toggle:hover,
[data-theme="light"] #notes-toggle:hover {
    background-color: rgba(0, 0, 0, 0.04);
}

#theme-toggle svg,
#notes-toggle svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    fill: none;
    stroke: currentColor;
}

#theme-toggle .sun-icon {
    display: none;
}

#theme-toggle .moon-icon {
    display: block;
}

[data-theme="light"] #theme-toggle .sun-icon {
    display: block;
}

[data-theme="light"] #theme-toggle .moon-icon {
    display: none;
}

/* Slide Notes Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 6, 10, 0.7); /* Darker backdrop overlay for focus and contrast */
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: #0f172a; /* Solid Slate 900 for dark mode, highly readable */
    border: 1px solid var(--border-color);
    border-radius: 16px;
    width: 66vw; /* Around 2/3 of presentation width */
    max-width: 1000px;
    max-height: 80vh;
    padding: 2.5rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    color: var(--text-primary);
}

[data-theme="light"] .modal-container {
    background: #ffffff; /* Solid white for light mode */
}

.modal-overlay.open .modal-container {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    background-color: var(--border-color);
    box-shadow: none;
}

.modal-close svg {
    width: 20px;
    height: 20px;
}

/* Modal Markdown Content Typography */
.notes-body {
    font-family: var(--font-body);
    font-size: 1.1rem;
    line-height: 1.6;
}

.notes-body h1,
.notes-body h2,
.notes-body h3,
.notes-body h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-family: var(--font-heading);
    color: var(--text-primary);
}

.notes-body h1 {
    font-size: 2rem;
    background: var(--gradient-h1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.notes-body h2 {
    font-size: 1.6rem;
    color: var(--color-h2);
}

.notes-body h3 {
    font-size: 1.3rem;
}

.notes-body p {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
    max-width: 100%;
}

.notes-body ul,
.notes-body ol {
    margin-bottom: 1.25rem;
    padding-left: 1.5rem;
}

.notes-body li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.notes-body li strong {
    color: var(--text-primary);
}

.notes-body code {
    background-color: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: var(--accent);
}

.notes-body pre {
    background-color: var(--kbd-bg);
    border: 1px solid var(--kbd-border);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin-bottom: 1.25rem;
}

.notes-body pre code {
    background: none;
    border: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85em;
    color: var(--text-primary);
}

.notes-body blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1rem;
    margin-bottom: 1.25rem;
    color: var(--text-secondary);
    font-style: italic;
}

.notes-body hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* Responsive Grid Helper */
.interactive-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    width: 100%;
}

/* Hide mobile navigation hint by default */
.nav-hint .mobile-hint-container {
    display: none !important;
}

.nav-hint .desktop-hint {
    display: inline-block !important;
}

/* Mobile Media Queries */
@media (max-width: 768px) {
    .slide {
        padding: 1.5rem;
    }
    
    #theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 36px;
        height: 36px;
    }

    #notes-toggle {
        top: 1rem;
        right: 3.75rem;
        width: 36px;
        height: 36px;
    }
    
    .nav-hint {
        bottom: 1rem;
        right: 1rem;
        font-size: 0.75rem;
    }
    
    .nav-hint .desktop-hint {
        display: none !important;
    }
    
    .nav-hint .mobile-hint-container {
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
    }
    
    .interactive-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .modal-container {
        padding: 1.5rem;
        width: 95%;
    }
}

/* Print optimizations */
@media print {
    h1 {
        background: none !important;
        -webkit-background-clip: initial !important;
        -webkit-text-fill-color: initial !important;
        color: var(--text-primary) !important;
    }
}
