:root {
    /* Colors */
    --bg-light: #F8F9FA;
    --bg-dark: #050505;
    --text-charcoal: #121317;
    --text-white: #FFFFFF;
    --accent-blue: #4285F4;
    --accent-purple: #A142F4;

    /* Typography */
    --font-main: 'Inter', system-ui, sans-serif;

    /* Layout */
    --page-padding: 24px;
    --max-width: 1200px;
}

html {
    scroll-behavior: smooth;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-light);
    color: var(--text-charcoal);
    transition: background-color 1s ease, color 1s ease;
    overflow-x: hidden;
    min-height: 200vh;
    /* Ensure overlap space */
}

/* Theme Classes */
body.light-theme {
    background-color: var(--bg-light);
    color: var(--text-charcoal);
}

body.dark-theme {
    background-color: var(--bg-dark);
    color: var(--text-white);
}

/* Canvas Background */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Header */
.sticky-header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 24px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    transition: transform 0.3s;
}

.logo {
    font-family: 'MuseoModerno', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.03em;
}

/* Buttons */
.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 32px;
    border-radius: 9999px;
    /* Pill shape */
    text-decoration: none;
    font-weight: 500;
    transition: transform 0.2s ease, background-color 0.3s;
    font-size: 1rem;
    border: none;
    cursor: pointer;
}

.cta-button:hover {
    transform: scale(1.05);
}

.cta-button.small {
    padding: 10px 24px;
    font-size: 0.9rem;
    background-color: var(--text-charcoal);
    color: var(--text-white);
}

/* Theme-dependent button styles */
body.light-theme .cta-button.primary {
    background-color: var(--text-charcoal);
    color: var(--text-white);
}

body.light-theme .cta-button.secondary {
    background-color: transparent;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-charcoal);
    margin-left: 12px;
}

body.dark-theme .cta-button.primary {
    background-color: var(--text-white);
    color: var(--text-charcoal);
}

body.dark-theme .cta-button.secondary {
    border-color: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
}

body.dark-theme .logo {
    color: var(--text-white);
}

/* Hero Section */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-content {
    max-width: 800px;
    padding: 0 20px;
    animation: fadeUp 1s ease-out;
}

.hero-headline {
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1;
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 24px;
}

.hero-sub {
    font-size: 1.25rem;
    line-height: 1.6;
    opacity: 0.8;
    margin-bottom: 48px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* Scroll Spacer */
.scroll-spacer {
    height: 20vh;
    /* Gap before dark mode kicks in */
}

/* Features (Dark Section) */
.dark-section {
    padding: 120px 24px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 3rem;
    text-align: center;
    margin-bottom: 80px;
    letter-spacing: -0.03em;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.card {
    background: rgba(255, 255, 255, 0.05);
    /* Glass in dark mode */
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 40px;
    border-radius: 24px;
    backdrop-filter: blur(10px);
    transition: transform 0.3s;
}

.card:hover {
    transform: translateY(-10px);
    background: rgba(255, 255, 255, 0.08);
}

.card-icon {
    font-size: 2.5rem;
    margin-bottom: 24px;
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.card p {
    opacity: 0.7;
    line-height: 1.6;
}

/* =========================================
   VIDEO DEMO SECTION
   ========================================= */
.video-demo-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 40px;
}

.video-container {
    width: 100%;
    width: 100%;
    max-width: 800px;
    /* Reduced for better fit */
    /* aspect-ratio removed to adapt to video size */
    background: #000;
    border-radius: 24px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 40px 80px rgba(0, 0, 0, 0.6);
    /* Deep shadow */
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.video-container:hover {
    transform: scale(1.01);
}

.video-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Gradient Placeholder in case video fails or is loading */
.video-placeholder-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    z-index: 0;
}

video {
    width: 100%;
    width: 100%;
    height: auto;
    max-height: 70vh;
    /* Prevents it from taking over the screen vertically */
    display: block;
    object-fit: contain;
    position: relative;
    z-index: 1;
    opacity: 0.7;
    /* Dim idle state */
    transition: opacity 0.8s;
}

#tavus-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    z-index: 20;
    /* Above video */
    background: #000;
}

/* Overlay State */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 10;
    transition: all 0.5s ease;
}

.overlay-sub {
    margin-top: 16px;
    font-size: 0.9rem;
    opacity: 0.7;
}

.pulse-glow {
    animation: pulseGlow 2s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 255, 255, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

/* Connection Status */
.connection-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.connection-status.visible {
    opacity: 1;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Active Connectivity State */
.video-container.active video {
    opacity: 1;
    /* Brighten up */
}

.video-container.active .video-overlay {
    opacity: 0;
    pointer-events: none;
}

.video-container.connecting .connection-status {
    opacity: 1;
}

.video-container.connecting .video-overlay {
    opacity: 0;
    pointer-events: none;
}


/* Footer */
footer {
    text-align: center;
    padding: 60px 0;
    opacity: 0.5;
    font-size: 0.9rem;
}

/* Utils */
.hidden {
    display: none !important;
}

.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}