/* ========================================================================= */
/* ===         MODERN STYLESHEET FOR RADAR AUTOMATION (SOLUTIONS)        === */
/* ========================================================================= */

/*
 * TABLE OF CONTENTS
 * -----------------
 * 1. DESIGN SYSTEM & GLOBAL STYLES
 *    - Root Variables (Colors, Typography, Effects)
 *    - Global Resets & Base Styling
 *    - Accessibility Enhancements
 *
 * 2. REUSABLE COMPONENTS
 *    - Buttons, Containers
 *
 * 3. SITE HEADER & NAVIGATION
 *    - Header Layout
 *    - Desktop Navigation
 *    - Mobile Navigation & Hamburger Menu
 *
 * 4. PAGE-SPECIFIC SECTIONS
 *    - Solutions Hero
 *    - Solutions Toggles & Grid
 *    - Feature Showcase Section
 *    - Call-to-Action (CTA) Section
 *
 * 5. SITE FOOTER
 *    - Footer Layout & Links
 *    - Scroll to Top Button
 *
 * 6. COMPLEX ANIMATIONS
 *    - Feature Showcase Animation Keyframes
 *    - Shared Animation Utility Keyframes
 *
 * 7. RESPONSIVENESS
 *    - Media Queries (Mobile-First Approach)
*/

/* === 1. DESIGN SYSTEM & GLOBAL STYLES === */
:root {
    /* Colors */
    --color-primary: #34a953;
    --color-primary-dark: #2c9447;
    --color-primary-light: #eaf6ed;
    --color-accent: #42f5b0;
    --color-dark: #1a202c;
    --color-dark-muted: #2d3748;
    --color-text-light: #f7fafc;
    --color-text-body: #4a5568;
    --color-bg-light: #ffffff;
    --color-bg-grey: #f8f9fa;
    --color-border: #e2e8f0;
    --color-off-state: #d1d5db;

    /* Typography */
    --font-main: 'Manrope', sans-serif;
    --fs-base: 1rem;
    --lh-base: 1.7;

    /* Spacing & Sizing */
    --container-width: 1100px;
    --container-padding: 1.25rem; /* 20px */
    
    /* Effects */
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.04), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-primary: 0 10px 25px -5px hsla(140, 52%, 53%, 0.3);
    --border-radius: 12px;
    --transition-fast: all 0.2s ease-in-out;
    --transition-smooth: all 0.4s cubic-bezier(.25,.8,.25,1);
}

/* --- Global Resets & Base Styling --- */
*, *::before, *::after { 
    box-sizing: border-box; 
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--color-bg-light);
    color: var(--color-text-body);
    line-height: var(--lh-base);
    font-size: var(--fs-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.nav-active { 
    overflow: hidden; 
}

/* --- Accessibility Improvements --- */
/* Add a clear focus outline for keyboard navigators, but not for mouse users */
a:focus-visible,
button:focus-visible,
.toggle-btn:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* --- Typography & Container --- */
.container { 
    max-width: var(--container-width); 
    margin-inline: auto;
    padding-inline: var(--container-padding);
}

h1, h2, h3 { 
    font-weight: 800; 
    color: var(--color-dark); 
    margin: 0; 
    line-height: 1.2; 
}

p { 
    margin: 0 0 1rem 0; 
}


/* ========================================================================= */
/* ===                MODERNIZED HEADER & NAVIGATION STYLES              === */
/* ========================================================================= */

.site-header {
    position: sticky; 
    top: 0; 
    z-index: 1000;
    padding-block: 1rem;
    background-color: var(--color-dark);
    box-shadow: var(--shadow-md);
}

.main-nav { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logo img { 
    height: 45px; 
    display: block; 
}

/* --- Mobile Navigation & Hamburger --- */
.mobile-nav-toggle {
    display: block; /* Visible on mobile by default */
    position: relative;
    z-index: 1001;
    width: 40px; 
    height: 40px;
    padding: 0;
    border: none; 
    background: transparent; 
    cursor: pointer;
}

.hamburger-icon {
    position: absolute;
    top: 50%; 
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
}

.hamburger-icon span {
    display: block;
    width: 100%;
    height: 3px;
    background-color: var(--color-text-light);
    border-radius: 3px;
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
}

.hamburger-icon span:nth-child(2) { 
    margin-block: 6px; 
}

/* Active state for hamburger animation */
.mobile-nav-toggle.is-active .hamburger-icon span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.mobile-nav-toggle.is-active .hamburger-icon span:nth-child(2) { opacity: 0; }
.mobile-nav-toggle.is-active .hamburger-icon span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.nav-menu { 
    visibility: hidden; /* Hide by default, allows for animation */
    opacity: 0;
    position: fixed;
    inset: 0;
    background-color: hsla(220, 25%, 10%, 0.85);
    backdrop-filter: blur(10px); 
    -webkit-backdrop-filter: blur(10px);
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.nav-menu.is-active {
    visibility: visible;
    opacity: 1;
    display: flex; 
    justify-content: center; 
    align-items: center;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

/* Staggered animation for mobile menu items */
.nav-menu.is-active .nav-list { 
    display: flex;
    flex-direction: column; 
    text-align: center; 
    gap: 1.5rem; 
}

.nav-menu.is-active .nav-list li {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInSlideUp 0.4s ease forwards;
}

/* Staggered delay for each list item */
.nav-menu.is-active .nav-list li:nth-child(1) { animation-delay: 0.2s; }
.nav-menu.is-active .nav-list li:nth-child(2) { animation-delay: 0.3s; }
.nav-menu.is-active .nav-list li:nth-child(3) { animation-delay: 0.4s; }
.nav-menu.is-active .nav-list li:nth-child(4) { animation-delay: 0.5s; } /* For the button */

@keyframes fadeInSlideUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


.nav-menu.is-active .nav-list a { 
    font-size: 1.5rem; 
    font-weight: 700;
    color: var(--color-text-light);
    text-decoration: none;
    display: inline-block;
    padding: 0.5rem 1rem;
}

.nav-menu.is-active .nav-button { 
    padding: 1rem 2rem; 
    font-size: 1.5rem; 
    background-color: var(--color-primary);
    border-radius: 50px;
}


/* === 3. PAGE SECTIONS & COMPONENTS === */

/* --- Solutions Hero --- */
.solutions-hero {
    background-color: var(--color-bg-grey);
    text-align: center;
    padding: 6rem var(--container-padding);
}

.solutions-hero h1 {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1.5rem;
    perspective: 1000px;
}

.solutions-hero .subtitle { 
    font-size: 1.25rem; 
    max-width: 750px; 
    margin-inline: auto;
}

.word-to-animate span {
    display: inline-block; 
    opacity: 0;
    transform: translateY(50px) rotateX(-90deg);
    animation: LetterIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    /* Animation delay is set individually for a staggered effect */
}

/* Improved: Simplified the long list of selectors */
.word-to-animate span:nth-of-type(1) { animation-delay: 0.1s; } 
.word-to-animate span:nth-of-type(2) { animation-delay: 0.15s; } 
.word-to-animate span:nth-of-type(3) { animation-delay: 0.2s; }
.word-to-animate span:nth-of-type(4) { animation-delay: 0.25s; }
.word-to-animate span:nth-of-type(5) { animation-delay: 0.3s; }
.word-to-animate span:nth-of-type(6) { animation-delay: 0.35s; }
.word-to-animate span:nth-of-type(7) { animation-delay: 0.4s; }
.word-to-animate span:nth-of-type(8) { animation-delay: 0.45s; }
.word-to-animate span:nth-of-type(9) { animation-delay: 0.5s; }
.word-to-animate span:nth-of-type(10) { animation-delay: 0.55s; }

/* --- Solutions Layout --- */
.solutions-layout { 
    padding-block: 5rem; 
}

.solution-toggle {
    display: flex; 
    justify-content: center; 
    margin-inline: auto;
    margin-bottom: 3rem;
    background-color: var(--color-bg-grey); 
    border-radius: 50px;
    padding: 0.5rem; 
    width: fit-content;
}

.toggle-btn {
    border: none; 
    background-color: transparent; 
    color: var(--color-text-body);
    padding: 0.75rem 1.5rem; 
    font-size: 1rem; 
    font-weight: 600;
    border-radius: 50px; 
    cursor: pointer;
    transition: var(--transition-fast);
}

.toggle-btn.active {
    background-color: var(--color-primary); 
    color: var(--color-text-light);
    box-shadow: var(--shadow-primary);
}

.solution-pane { 
    display: none; 
    grid-template-columns: 1fr; /* Default to 1 column on mobile */
    gap: 2rem; 
}

.solution-pane.active { 
    display: grid; 
    animation: fadeInContent 0.5s ease forwards; 
}

.solution-card {
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius); 
    padding: 1.5rem;
    display: flex; 
    align-items: flex-start; 
    gap: 1.25rem;
    transition: var(--transition-fast);
}

.solution-card:hover { 
    transform: translateY(-5px); 
    box-shadow: var(--shadow-md); 
    border-color: var(--color-primary); 
}

.solution-card .solution-icon {
    font-size: 1.75rem; 
    color: var(--color-primary);
    background-color: var(--color-primary-light);
    padding: 1rem; 
    border-radius: 50%;
}

.solution-card h3 { 
    font-size: 1.25rem; 
    margin-bottom: 0.25rem; 
}

.solution-card p { 
    margin: 0; 
    font-size: 0.95rem; 
}

/* --- Feature Showcase --- */
.feature-showcase-section { 
    padding-block: 5rem; 
    background-color: var(--color-bg-grey); 
    border-top: 1px solid var(--color-border); 
}

.section-header { 
    text-align: center; 
    max-width: 800px; 
    margin: 0 auto 4rem; 
}

.section-header h2 { 
    font-size: clamp(2rem, 5vw, 2.8rem); 
    margin-bottom: 1rem; 
}

.section-header .section-intro { 
    font-size: 1.2rem; 
}

.feature-showcase {
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 2.5rem; 
    align-items: center; 
    margin-bottom: 5rem;
    opacity: 0; 
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.feature-showcase:last-child { 
    margin-bottom: 0; 
}

.feature-showcase.in-view { 
    opacity: 1; 
    transform: translateY(0); 
}

.feature-animation {
    display: flex; 
    justify-content: center; 
    align-items: center;
    perspective: 1000px; 
    min-height: 350px;
}

.feature-animation > div,
.feature-animation video {
    width: 100%;
    max-width: 350px; 
    height: 350px; 
    background: var(--color-bg-light);
    border-radius: var(--border-radius); 
    position: relative; 
    overflow: hidden;
    box-shadow: var(--shadow-lg); 
    border: 1px solid var(--color-border);
}

.feature-description h3 { 
    font-size: 1.8rem; 
    color: var(--color-primary); 
    margin-bottom: 1rem; 
}

.feature-description p { 
    font-size: 1.1rem; 
}

/* --- Call to Action (CTA) Section --- */
.cta-section {
    background-color: var(--color-dark-muted); 
    color: var(--color-text-light);
    padding: 5rem var(--container-padding); 
    text-align: center;
}

.cta-content h2 { 
    color: var(--color-text-light); 
    font-size: 2.5rem; 
    margin-bottom: 1.5rem; 
}

.cta-content p { 
    font-size: 1.2rem; 
    max-width: 600px; 
    margin: 0 auto 2rem; 
    color: var(--color-bg-grey); 
}

.unified-cta-button {
    display: inline-block; 
    padding: 1rem 2.5rem;
    font-size: 1.1rem; 
    font-weight: 700;
    color: var(--color-dark); 
    background: var(--color-accent);
    border-radius: 50px; 
    text-decoration: none; 
    box-shadow: var(--shadow-primary);
    transition: var(--transition-fast);
}

.unified-cta-button:hover { 
    transform: translateY(-4px) scale(1.03); 
    box-shadow: 0 15px 30px hsla(158, 89%, 61%, 0.4); 
}

/* --- Use Case Section (Inside Cards) --- */
.use-case-section { 
    margin-top: 1rem; 
    padding-top: 1rem; 
    border-top: 1px solid var(--color-border); 
}

.use-case-section h4 { 
    font-size: 0.95rem; 
    font-weight: 700; 
    margin-bottom: 0.5rem; 
}

.use-case-text { 
    font-size: 0.9rem; 
    line-height: 1.6; 
    margin-bottom: 0; 
}


/* === 4. SITE FOOTER === */
.site-footer-main { 
    background-color: var(--color-dark); 
    padding: 2.5rem 0 1.5rem; 
    color: var(--color-bg-grey); 
}

.footer-content { 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: space-between; 
    align-items: center; 
    gap: 2rem; 
    padding-bottom: 1.5rem; 
}

.footer-nav-links, .footer-contact-group { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 1.5rem; 
}

.footer-contact-group { 
    gap: 2rem; 
}

.footer-nav-links a, 
.footer-contact-item, 
.footer-policy-links a { 
    color: var(--color-bg-grey); 
    text-decoration: none; 
    transition: var(--transition-fast); 
}

.footer-nav-links a:hover, 
.footer-contact-item:hover, 
.footer-policy-links a:hover { 
    color: var(--color-accent); 
}

.footer-contact-item { 
    display: flex; 
    align-items: center; 
    gap: 0.5rem;
}

.footer-contact-item .material-symbols-outlined { 
    font-size: 20px; 
}

.footer-bottom-row {
    display: flex; 
    flex-wrap: wrap; 
    justify-content: space-between; 
    align-items: center; 
    gap: 1rem;
    padding-top: 1.5rem; 
    border-top: 1px solid var(--color-dark-muted);
    font-size: 0.9rem; 
    color: var(--color-text-body);
}

.footer-bottom-row p { 
    margin: 0; 
}

.footer-policy-links { 
    display: flex; 
    gap: 1.5rem; 
}

/* --- Scroll to Top Button --- */
#scrollToTopBtn {
    display: none; 
    position: fixed; 
    bottom: 20px; 
    right: 20px;
    z-index: 999; 
    border: none; 
    outline: none;
    background-color: var(--color-primary); 
    color: var(--color-text-light);
    cursor: pointer; 
    padding: 0.75rem; 
    border-radius: 50%;
    box-shadow: var(--shadow-lg); 
    opacity: 0; 
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

#scrollToTopBtn.visible { 
    display: block; 
    opacity: 1; 
    transform: translateY(0); 
}

#scrollToTopBtn:hover { 
    background-color: var(--color-primary-dark); 
}

#scrollToTopBtn .material-symbols-outlined { 
    font-size: 24px; 
    line-height: 1; 
}

/* === 5. COMPLEX ANIMATIONS & KEYFRAMES === */

/* --- General Purpose Keyframes --- */
@keyframes LetterIn { 
    to { 
        opacity: 1; 
        transform: translateY(0) rotateX(0deg); 
    } 
}

@keyframes fadeInContent { 
    from { 
        opacity: 0; 
        transform: translateY(15px); 
    } 
    to { 
        opacity: 1; 
        transform: translateY(0); 
    } 
}

/* --- Curtain Animation --- */
.feature-animation video { 
    object-fit: cover; 
}

.curtain-bg .sun { 
    width: 80px; 
    height: 80px; 
    background: #ffc107; 
    border-radius: 50%; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    transform: translate(-50%, -50%); 
}

.curtain { 
    position: absolute; 
    top: 0; 
    width: 50%; 
    height: 100%; 
    background-color: var(--color-primary-dark); 
}

.curtain-left { left: 0; } 
.curtain-right { left: 50%; }

.in-view .curtain-left { animation: cycle-curtain-left 5s ease-in-out infinite; }
.in-view .curtain-right { animation: cycle-curtain-right 5s ease-in-out infinite; }

@keyframes cycle-curtain-left { 
    0%, 100% { transform: translateX(0); } 
    50% { transform: translateX(-100%); } 
}

@keyframes cycle-curtain-right { 
    0%, 100% { transform: translateX(0); } 
    50% { transform: translateX(100%); } 
}

/* --- Motion Light Animation --- */
.motion-light-bg { 
    display: flex; 
    align-items: center; 
    justify-content: space-around; 
    padding: 20px; 
}

.motion-trigger { 
    position: absolute; 
    top: 50%; 
    left: -20px; 
    width: 30px; 
    height: 30px; 
    background-color: var(--color-primary); 
    border-radius: 50%; 
    transform: translateY(-50%); 
}

.path-light { 
    width: 25px; 
    height: 100px; 
    background-color: var(--color-off-state); 
    border-radius: 5px; 
    transition: background-color 0.3s; 
}

.in-view .motion-trigger { animation: move-across 4s linear infinite; }
.in-view .path-light { animation: light-up 4s infinite; }

/* Staggered animation delays for the lights */
.in-view .path-light:nth-child(2) { animation-delay: 0s; } 
.in-view .path-light:nth-child(3) { animation-delay: 0.2s; } 
.in-view .path-light:nth-child(4) { animation-delay: 0.4s; } 
.in-view .path-light:nth-child(5) { animation-delay: 0.6s; } 
.in-view .path-light:nth-child(6) { animation-delay: 0.8s; }

@keyframes move-across { 
    to { transform: translate(350px, -50%); } 
}

@keyframes light-up { 
    0%, 100% { background-color: var(--color-off-state); } 
    30%, 60% { background-color: #ffc107; } 
}

/* --- Unified Control Animation --- */
.unified-control-bg { 
    padding: 1.5rem; 
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    height: 100%; 
}

.unified-room { 
    display: flex; 
    justify-content: space-around; 
    align-items: center; 
    background-color: var(--color-bg-grey); 
    padding: 1rem; 
    border-radius: var(--border-radius); 
}

.unified-device { 
    font-size: 2.5rem; 
    color: var(--color-off-state); 
    transition: color 0.3s ease; 
}

#uni-fan { 
    width: 40px; 
    height: 40px; 
    position: relative; 
}

.uni-fan-blade { 
    width: 100%; 
    height: 6px; 
    background: var(--color-off-state); 
    position: absolute; 
    top: 50%; 
    left: 0; 
    transform-origin: center; 
    border-radius: 3px; 
    transition: background-color 0.3s ease; 
}

.uni-fan-blade:last-child { 
    transform: rotate(90deg); 
}

.unified-phone { 
    position: absolute; 
    bottom: 30px; 
    left: 50%; 
    width: 130px; 
    height: 220px; 
    background: var(--color-dark); 
    border-radius: 20px; 
    border: 2px solid var(--color-border); 
    box-shadow: var(--shadow-lg); 
    transform: translateX(-50%) rotateX(45deg); 
    transform-style: preserve-3d; 
}

.unified-screen { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-evenly; 
    height: 100%; 
    padding: 15px 10px; 
}

.uni-app-icon { 
    width: 80%; 
    height: 50px; 
    background-color: var(--color-dark-muted); 
    border-radius: 10px; 
}

.finger-tap { 
    width: 30px; 
    height: 30px; 
    background-color: hsla(158, 89%, 61%, 0.5); 
    border: 2px solid var(--color-accent); 
    border-radius: 50%; 
    position: absolute; 
    top: 0; 
    left: 0; 
    transform-origin: top left; 
    opacity: 0; 
    pointer-events: none; 
}

/* Link animations to the .in-view class */
.in-view .finger-tap { animation: unified-control-sequence 10s ease-in-out infinite; }
.in-view #uni-light { animation: uni-light-flicker 10s step-end infinite; }
.in-view #uni-fan { animation: uni-fan-spin 10s ease-out infinite; }
.in-view .uni-fan-blade { animation: uni-fan-color 10s step-end infinite; }
.in-view #uni-ac { animation: uni-ac-flicker 10s step-end infinite; }

/* Sequence: Tap light -> Tap fan -> Tap AC -> Tap light off */
@keyframes unified-control-sequence {
    /* Initial state */
    0%, 100% { opacity: 0; transform: translate(150px, 300px); }

    /* 1. Finger moves to and taps the LIGHT icon */
    10% { opacity: 1; transform: translate(150px, 200px) scale(1.2); }
    15% { transform: translate(150px, 110px) scale(1.2); } /* Hover over icon */
    18% { transform: translate(150px, 110px) scale(1); }   /* Tap down */
    20% { transform: translate(150px, 110px) scale(1.2); } /* Tap up */

    /* 2. Finger moves to and taps the FAN icon */
    35% { transform: translate(150px, 175px) scale(1.2); }
    38% { transform: translate(150px, 175px) scale(1); }
    40% { transform: translate(150px, 175px) scale(1.2); }

    /* 3. Finger moves to and taps the AC icon */
    55% { transform: translate(150px, 240px) scale(1.2); }
    58% { transform: translate(150px, 240px) scale(1); }
    60% { transform: translate(150px, 240px) scale(1.2); }

    /* 4. Finger moves to LIGHT icon to turn it off */
    75% { transform: translate(150px, 110px) scale(1.2); }
    78% { transform: translate(150px, 110px) scale(1); }
    80% { transform: translate(150px, 110px) scale(1.2); }

    /* Fade out */
    90%, 100% { opacity: 0; transform: translate(150px, 50px); }
}

/* Device state animations timed to the sequence above */
@keyframes uni-light-flicker { 
    0%, 17.9%, 78%, 100% { color: var(--color-off-state); } /* Off */
    18%, 77.9% { color: #ffc107; } /* On */
}

@keyframes uni-ac-flicker { 
    0%, 57.9%, 100% { color: var(--color-off-state); } /* Off */
    58%, 95% { color: #3498db; } /* On */
}

@keyframes uni-fan-color { 
    0%, 37.9%, 100% { background-color: var(--color-off-state); } /* Off */
    38%, 95% { background-color: var(--color-dark); } /* On */
}

@keyframes uni-fan-spin { 
    0%, 38% { transform: rotate(0deg); } /* Static */
    38.1%, 95% { transform: rotate(1440deg); } /* Spinning */
    95.1%, 100% { transform: rotate(1440deg); } /* Stops */
}

/* --- Ambiance Scene Animation --- */
.ambiance-bg { 
    display: grid; 
    grid-template-rows: auto 1fr auto; 
    gap: 1.5rem; 
    padding: 1.5rem; 
    align-items: center; 
}

.ambiance-sensors, .ambiance-devices, .ambiance-mode-toggle { 
    display: flex; 
    justify-content: space-around; 
    align-items: center; 
}

.sensor-display { 
    text-align: center; 
}

.sensor-display .material-symbols-outlined { 
    font-size: 2.5rem; 
    transition: color 0.3s; 
}

.sensor-display p { 
    margin: 0; 
    font-weight: 600; 
}

#motion-sensor p::after { content: 'No Motion'; }

.ambiance-devices .device-icon { 
    font-size: 2.5rem; 
    color: var(--color-off-state); 
    transition: color 0.4s ease; 
}

#ambiance-fan { 
    width: 40px; 
    height: 40px; 
    position: relative; 
}

#ambiance-fan .fan-blade { 
    background: var(--color-off-state); 
    transition: background-color 0.4s ease; 
}

.ambiance-mode-toggle { 
    gap: 0.5rem; 
    font-weight: 700; 
}

.mode-switch { 
    width: 50px; 
    height: 26px; 
    background: var(--color-border); 
    border-radius: 13px; 
    padding: 3px; 
    cursor: pointer; 
}

.switch-knob { 
    width: 20px; 
    height: 20px; 
    background: white; 
    border-radius: 50%; 
    box-shadow: var(--shadow-sm); 
    transition: transform 0.3s ease; 
}

.ambiance-phone { 
    position: absolute; 
    bottom: 20px; 
    right: 20px; 
    width: 60px; 
    height: 100px; 
    border: 4px solid var(--color-dark); 
    border-radius: 8px; 
    background: #fff; 
    opacity: 0; 
    transform: scale(0.8); 
    transition: all 0.4s ease; 
    padding: 5px; 
}

.ambiance-app-button { 
    width: 100%; 
    height: 100%; 
    background-color: var(--color-primary-light); 
    border-radius: 4px; 
    position: relative; 
}

.ambiance-app-button::after { 
    content: ''; 
    position: absolute; 
    top: 50%; 
    left: 50%; 
    width: 10px; 
    height: 10px; 
    background: var(--color-primary); 
    border-radius: 50%; 
    opacity: 0; 
    transform: translate(-50%, -50%) scale(1); 
    transition: all 0.4s ease; 
}

/* This is the main controller for the entire ambiance scene */
.in-view .ambiance-bg { 
    animation: ambiance-sequence 12s infinite; 
}

/*
 * This complex animation uses CSS variables to manage state changes over time.
 * The variables are defined at different keyframe percentages, and the elements
 * below reference these variables to change their styles.
*/
@keyframes ambiance-sequence {
    /* Start State */
    0%, 100% {}

    /* Scene 1: Motion detected, lights and fan turn ON */
    5%, 25% { 
        --motion-color: var(--color-primary); 
        --motion-text: 'Motion Detected'; 
        --light-color: #ffc107; 
        --fan-color: var(--color-dark); 
    }

    /* Scene 2: Motion stops, devices turn OFF */
    26%, 30% {
        --motion-color: var(--color-text-body); 
        --motion-text: 'No Motion'; 
        --light-color: var(--color-off-state); 
        --fan-color: var(--color-off-state);
    }
    
    /* Scene 3: Temperature rises, AC turns ON */
    35%, 50% { 
        --temp-text: '28°C'; 
        --ac-color: #3498db; 
    }
    
    /* Scene 4: Temperature normal, AC turns OFF */
    51%, 55% {
        --temp-text: '22°C'; 
        --ac-color: var(--color-off-state);
    }

    /* Scene 5: User switches to MANUAL mode */
    60%, 90% { 
        --knob-transform: translateX(24px); 
        --phone-opacity: 1; 
        --phone-transform: scale(1); 
    }

    /* Scene 6: User taps phone to turn ON fan */
    65%, 85% {
        --tap-opacity: 1; 
        --tap-transform: translate(-50%, -50%) scale(2); 
        --fan-color-manual: var(--color-dark);
    }
    
    /* Scene 7: Reset tap animation */
    86%, 90% {
        --tap-opacity: 0; 
        --tap-transform: translate(-50%, -50%) scale(1);
    }
    
    /* Scene 8: User switches back to AUTO mode */
    91% {
        --knob-transform: translateX(0); 
        --phone-opacity: 0; 
        --phone-transform: scale(0.8); 
        --fan-color-manual: var(--color-off-state);
    }
}

/* Link element styles to the animation variables defined above */
.in-view #motion-sensor .material-symbols-outlined { color: var(--motion-color, var(--color-text-body)); }
.in-view #motion-sensor p::after { content: var(--motion-text, 'No Motion'); }
.in-view #temp-sensor p::after { content: var(--temp-text, '22°C'); }
.in-view #ambiance-light { color: var(--light-color, var(--color-off-state)); }
.in-view #ambiance-ac { color: var(--ac-color, var(--color-off-state)); }
.in-view #ambiance-fan .fan-blade { background-color: var(--fan-color-manual, var(--fan-color, var(--color-off-state))); }
.in-view .switch-knob { transform: var(--knob-transform, translateX(0)); }
.in-view .ambiance-phone { opacity: var(--phone-opacity, 0); transform: var(--phone-transform, scale(0.8)); }
.in-view .ambiance-app-button::after { opacity: var(--tap-opacity, 0); transform: var(--tap-transform, translate(-50%,-50%) scale(1)); }


/* === 7. RESPONSIVENESS (Mobile-First) === */
/* Base styles are mobile. The query below applies to tablets and desktops. */

@media (min-width: 769px) {
    /* --- MODERNIZED Desktop Navigation --- */
    .mobile-nav-toggle { 
        display: none; 
    }
    
    .nav-menu { 
        display: flex; 
        visibility: visible;
        opacity: 1;
        position: static;
        background: none;
        backdrop-filter: none;
        height: auto;
        width: auto;
    }

    .nav-list { 
        display: flex; 
        flex-direction: row;
        align-items: center; 
        gap: 0.5rem; /* Reduced gap for the new style */
    }

    .nav-list li {
        /* Reset mobile animation properties if any */
        opacity: 1;
        transform: none;
        animation: none;
    }
    
    .nav-list a { 
        display: block;
        color: var(--color-text-light); 
        text-decoration: none; 
        font-weight: 500; 
        position: relative;
        padding: 0.5rem 1rem;
        border-radius: 50px; /* Pill shape */
        transition: color 0.3s ease, background-color 0.3s ease;
        z-index: 1;
        font-size: var(--fs-base); /* Reset mobile font size */
    }
    
    .nav-list a:hover {
        color: var(--color-dark);
        background-color: var(--color-accent);
    }
    
    /* Style for the currently active page link */
    .nav-list a.active-nav { 
        color: var(--color-dark);
        background-color: var(--color-accent);
    }
    
    .nav-button { 
        padding: 0.6rem 1.25rem; 
        background-color: var(--color-primary); 
        color: var(--color-text-light); /* Explicitly set color */
        border-radius: 50px; 
        transition: var(--transition-fast); 
        font-size: var(--fs-base); /* Reset mobile font size */
    }

    .nav-button:hover { 
        background-color: var(--color-accent); 
        color: var(--color-dark); 
        transform: translateY(-2px); 
        box-shadow: 0 4px 10px hsla(158, 89%, 61%, 0.3);
    }

    /* --- Desktop Layout Adjustments --- */
    .solution-pane {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .feature-showcase { 
        grid-template-columns: 1fr 1fr; 
        gap: 4rem; 
    }

    /* Class to reverse the order of grid items */
    .feature-showcase.reverse .feature-animation { 
        grid-column: 2; 
        grid-row: 1; 
    }

    .feature-showcase.reverse .feature-description { 
        grid-column: 1; 
        grid-row: 1; 
    }
}