/* --- 1. CORE VARIABLES & RESET --- */
:root {
    --bg-color: #050505;
    --accent-color: #FFB000;
    --text-color: #FFFFFF;
    --grid-color: rgba(255, 176, 0, 0.08);
    --scanline-color: rgba(0, 0, 0, 0.5);
    --font-main: 'Space Grotesk', sans-serif;
    --font-mono: 'Space Mono', monospace;
    
    /* Responsive Text Scaling Variables */
    --text-scale-mobile: 0.85;
    --text-scale-desktop: 1.0;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    overflow-x: hidden;
    line-height: 1.6;
}

/* --- 2. BACKGROUND EFFECTS --- */
.grid-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background-image: 
        linear-gradient(var(--grid-color) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-color) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -2; pointer-events: none;
}

.scanline-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100vh;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), 
                linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 0, 0.06));
    background-size: 100% 4px, 3px 100%;
    z-index: -1; pointer-events: none;
}

/* --- 3. LAYOUT UTILITIES --- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

.btn {
    display: inline-block;
    background-color: var(--accent-color);
    color: #000;
    font-family: var(--font-mono); font-weight: 700; 
    padding: 12px 30px; text-decoration: none; border-radius: 2px;
    transition: all 0.3s ease; text-transform: uppercase;
    letter-spacing: 1px; border: none; cursor: pointer;
}
.btn:hover { box-shadow: 0 0 20px rgba(255, 176, 0, 0.4); transform: translateY(-2px); }

/* --- 4. HEADER & NAVIGATION --- */
header {
    position: fixed; top: 0; width: 100%;
    padding: 20px 0; z-index: 100;
    background: rgba(5, 5, 5, 0.8); backdrop-filter: blur(10px);
}

nav { display: flex; justify-content: space-between; align-items: center; }

.logo {
    font-family: var(--font-mono); font-weight: 700;
    color: var(--accent-color); font-size: 1.2rem; letter-spacing: -0.5px;
}

.nav-links a {
    color: var(--text-color); text-decoration: none; margin-left: 30px;
    font-size: 0.9rem; opacity: 0.7; transition: opacity 0.3s;
}
.nav-links a:hover { opacity: 1; color: var(--accent-color); }

/* --- 5. HERO SECTION (FIXED) --- */
.hero { height: 100vh; display: flex; align-items: center; justify-content: center; text-align: center; position: relative; }

/* Wrapper to constrain width and prevent overflow */
.hero-content-wrapper {
    max-width: 900px; /* Prevents lines from getting too long on large screens */
    width: 100%;
    padding: 20px;
}

.clock-scale-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
}

.clock-scale {
    transform: scale(0.75);
    transform-origin: top center;
}

.clock-container {
    display: flex;
    gap: 12px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 15px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 176, 0, 0.15);
    
    /* Responsive variables based on viewport sizing */
    --card-w: 65px;
    --card-h: 85px;
    --font-sz: 45px;
}

/* Responsive Breakpoints to adjust structural size seamlessly */
@media (min-width: 480px) {
    .clock-container {
        gap: 16px;
        padding: 25px;
        --card-w: 85px;
        --card-h: 110px;
        --font-sz: 60px;
    }
}

@media (min-width: 768px) {
    .clock-container {
        gap: 20px;
        padding: 30px;
        --card-w: 105px;
        --card-h: 140px;
        --font-sz: 75px;
    }
}

.card {
    position: relative;
    width: var(--card-w);
    height: var(--card-h);
    font-family: var(--font-mono);
    font-size: var(--font-sz);
    font-weight: 700;
    line-height: var(--card-h);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    perspective: 600px;
}

.card__face {
    position: absolute;
    left: 0;
    width: 100%;
    height: 50%;
    overflow: hidden;
    background: #141414;
    color: var(--accent-color);
    backface-visibility: hidden;
}

.card__face--top {
    top: 0;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    border-bottom: 1.5px solid rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.card__face--top::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0));
    pointer-events: none;
}

.card__face--bottom {
    bottom: 0;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
    line-height: 0;
}

.card__face--bottom::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0));
    pointer-events: none;
}

.card__face span {
    display: block;
    width: 100%;
    text-align: center;
}

/* Animation States */
.card__face--top-flip {
    transform-origin: bottom center;
    animation: flip-top 0.4s ease-in forwards;
}

.card__face--bottom-flip {
    transform-origin: top center;
    transform: rotateX(90deg);
    animation: flip-bottom 0.4s ease-out 0.4s forwards;
    background: #1c1c1c;
}

@keyframes flip-top {
    0% { transform: rotateX(0deg); }
    100% { transform: rotateX(-90deg); }
}

@keyframes flip-bottom {
    0% { transform: rotateX(90deg); }
    100% { transform: rotateX(0deg); }
}

/* Hero Typography Fixes */
.hero h1 { 
    font-size: clamp(2rem, 5vw, 3.5rem); /* Responsive sizing */
    line-height: 1.1; 
    margin-bottom: 20px; 
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.2rem); /* Responsive sizing */
    max-width: 90%; /* Prevents overflow on very wide screens */
    margin: 0 auto 40px; 
    opacity: 0.8;
}

/* --- 6. FEATURES GRID --- */
.features { padding: 100px 0; }
.section-header { margin-bottom: 60px; border-left: 4px solid var(--accent-color); padding-left: 20px;}
.section-header h2 { font-size: 2rem; margin-bottom: 10px;}

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

.card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 30px; border-radius: 4px;
    transition: transform 0.3s, background 0.3s ease;
}
.card:hover { background: rgba(255, 176, 0, 0.05); transform: translateY(-5px); }

.card-icon { font-size: 2rem; color: var(--accent-color); margin-bottom: 20px; }
.card h3 { font-size: 1.2rem; margin-bottom: 10px; color: var(--accent-color); }
.card p { font-size: 0.95rem; opacity: 0.7; }

/* --- 7. GALLERY & LIGHTBOX (UPDATED) --- */
#gallery { padding: 80px 0; }

.gallery-section-header {
    margin-bottom: 40px;
    border-left: 4px solid var(--accent-color); padding-left: 20px;
}
#gallery .section-header h2 { font-size: 2rem; margin-bottom: 10px;}

.gallery-container {
    width: 100%; overflow-x: auto; overflow-y: hidden;
    -ms-overflow-style: none; scrollbar-width: none;
}
.gallery-container::-webkit-scrollbar { display: none; }

.gallery-content {
    display: flex; gap: 30px; padding: 10px;
    width: max-content; animation: scrollGallery 70s linear infinite;
}
@keyframes scrollGallery {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}
.gallery-content:hover { animation-play-state: paused; }

.gallery-item {
    flex-shrink: 0;
    width: 250px; /* FIXED: Shrunk from 380px to perfectly frame your tall screenshots */
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 6px;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 176, 0, 0.15);
    border-color: var(--accent-color);
}

/* IMAGE CONTAINER WITH CALCULATED HEIGHT */
.gallery-img-container {
    width: 100%;
    /* FIXED: Automatically calculates height based on 1320x2868 phone aspect ratio (approx. 543px tall) */
    aspect-ratio: 1320 / 2868; 
    overflow: hidden;
    position: relative;
    background-color: #0a0a0a;
}

.gallery-img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* FIXED: Crisp, full coverage edge-to-edge inside the gray box framework */
    display: block;
    cursor: pointer; 
    transition: transform 0.3s ease;
}

.gallery-item:hover .gallery-img-container img {
    transform: scale(1.05); 
}

.gallery-text-content { padding: 20px; }
.gallery-title {
    color: var(--accent-color);
    font-family: var(--font-mono);
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1rem;
}
.gallery-desc { font-size: 0.85rem; opacity: 0.7; }


/* MODERN NATIVE DIALOG LIGHTBOX STYLES */
/* SCOPED FIX: Explicitly target dialog#lightbox to isolate from regular section layouts */
dialog#lightbox {
    border: none;
    background: transparent;
    padding: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    outline: none;
    overflow: hidden;
    position: fixed; /* Binds positioning context to the viewport screen root layer */
}

/* SCOPED FIX: Applies centering flex layout ONLY when the native dialog is opened */
dialog#lightbox[open] {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* NATIVE OVERLAY BACKDROP */
dialog#lightbox::backdrop {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px);
}

/* FIXED CONTAINER FRAME: Locks to 1320x2868 proportion */
#lightbox-img {
    display: block;
    height: auto;
    width: auto;
    max-height: 75vh; 
    aspect-ratio: 1320 / 2868; 
    max-width: 90vw; 
    object-fit: contain;
    border-radius: 12px; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    border: 1px solid var(--accent-color);
    background: #0a0a0a; 
}

/* THE LIGHTBOX CAPTION */
#lightbox .lightbox-caption {
    width: auto;
    max-width: 90vw;
    color: white;
    text-align: center;
    margin-top: 15px;
    font-family: var(--font-mono);
    opacity: 0.8;
    font-size: 0.95rem;
}

/* THE CLOSE BUTTON */
/* SCOPED FIX: Target button#lightbox-close explicitly to stop clashing with 'Live Terminal Demo' elements */
button#lightbox-close {
    position: absolute;
    top: 30px;
    right: 40px;
    background: transparent;
    border: none;
    color: white;
    font-size: 40px;
    cursor: pointer;
    line-height: 1;
    transition: color 0.3s ease, transform 0.2s ease;
    z-index: 9999;
}
button#lightbox-close:hover {
    color: var(--accent-color);
    transform: rotate(90deg);
}

/* Mobile responsive optimization */
@media (max-width: 768px) {
    dialog#lightbox-img {
        max-height: 70vh; 
    }
    button#lightbox-close {
        top: 20px;
        right: 25px;
        font-size: 35px;
    }
}



/* --- 8. CONTACT / PRICING --- */
.pricing { padding: 100px 0; background: linear-gradient(to bottom, transparent, rgba(0,0,0,0.8)); }

.price-card { border: 1px solid var(--accent-color); padding: 40px; text-align: center; position: relative; overflow: hidden; }
.price-card::before { content: "LIVE WEATHER"; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: var(--accent-color); }
.price { font-size: 3rem; font-weight: 700; margin: 20px 0; color: var(--text-color); }
.price span { font-size: 1rem; color: var(--accent-color); }

.feature-list { list-style: none; margin-bottom: 30px; text-align: left; display: inline-block;}
.feature-list li { margin-bottom: 10px; font-family: var(--font-mono); font-size: 0.9rem;}
.feature-list li::before { content: "►"; color: var(--accent-color); margin-right: 10px; }

.contact-terminal {
    max-width: 800px; margin: 0 auto;
    background: rgba(255,255,255,0.03); border: 1px solid rgba(255,176,0,0.25);
    border-radius: 4px; overflow: hidden; backdrop-filter: blur(8px);
}

.terminal-header {
    background: rgba(255,176,0,0.08);
    border-bottom: 1px solid rgba(255,176,0,0.2);
    color: var(--accent-color); padding: 15px 25px;
    font-family: var(--font-mono); font-size: 0.9rem; letter-spacing: 2px;
}

.terminal-form { padding: 35px; }
.input-group { margin-bottom: 25px; }
.input-group label {
    display:block; margin-bottom:8px;
    color:var(--accent-color); font-family:var(--font-mono);
    font-size:0.85rem; letter-spacing:1px;
}
.input-group input, .input-group textarea {
    width:100%; background:rgba(0,0,0,0.45);
    border:1px solid rgba(255,255,255,0.12); color:white; padding:14px 16px;
    font-family:var(--font-mono);
}
.input-group input:focus, .input-group textarea:focus {
    outline:none; border-color:var(--accent-color);
    box-shadow:0 0 12px rgba(255,176,0,0.25);
}
.input-group textarea { resize:vertical; min-height:180px; }
.terminal-form .btn { width:100%; margin-top:10px; }

/* --- 9. LEGAL SECTION --- */
.legal-section { padding: 100px 0; border-top: 1px solid rgba(255,176,0,.2); }
.legal-container { max-width: 1000px; margin: 0 auto; }
.legal-card { background: rgba(255,255,255,.03); border: 1px solid rgba(255,176,0,.15); padding: 40px; border-radius: 6px; margin-bottom: 40px;}
.legal-card h2 { color: var(--accent-color); font-family: var(--font-mono); }
.legal-card ol { padding-left: 24px; }
.legal-card li { margin-bottom: 18px; }
.legal-card strong { color: var(--accent-color); }
.legal-card a { color: var(--accent-color); }

/* --- 10. FOOTER & APP STORE BADGE --- */
footer { padding: 60px 0; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.9rem; opacity: 0.6;}
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px;}
.footer-col h4 { color: var(--accent-color); margin-bottom: 20px; font-family: var(--font-mono);}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 10px; cursor: pointer;}

.app-store-container {
    display: inline-flex; align-items: center; justify-content: center;
    background-color: #111111; padding: 2px 4px;
    border: 1px solid #333333; border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.15); text-decoration: none;
    transition: background-color 0.2s ease, transform 0.1s ease; cursor: pointer;
}
.app-store-container:hover { background-color: #222222; transform: translateY(-1px); box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); }
.app-store-container img { height: 32px; display: block; }

/* Gallery Wrapper for Iframe */
.gallery-wrapper { width: 100%; overflow-x: hidden; }

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.5rem; }
    .split-flap-container { font-size: 2.5rem; }
    nav { flex-direction: column; gap: 15px;}
    .nav-links a { margin: 0 10px; }
    .gallery-item { width: 280px; }
    .gallery-img-container { height: 350px; }
}

/* --- iOS/Android LEGAL SECTIONS FIX --- */
.legal-card {
    cursor: pointer; /* Crucial for iOS to recognize click area */
}

/* Ensure the summary (the header) looks and acts like a button */
.legal-card summary {
    cursor: pointer;
    display: block; /* Forces it to behave correctly */
    -webkit-tap-highlight-color: transparent; /* Removes grey highlight on tap */
}

/* Remove default arrow for a cleaner look (optional) */
.legal-card summary::-webkit-details-marker {
    display: none;
}

/* Add a custom arrow or indicator if desired */
.legal-card summary::after {
    content: '▼'; /* Open state arrow */
    float: right;
    font-size: 0.8rem;
    color: var(--accent-color);
    transition: transform 0.3s ease;
}

/* Close state arrow rotation */
details[open] .legal-card summary::after {
    transform: rotate(180deg);
}

/* Ensure the content inside is readable */
.legal-card .content {
    padding-top: 20px;
    line-height: 1.6;
}

/* --- DEMO SECTION SPECIFIC STYLES --- */
#demo { padding: 80px 0; background: rgba(255, 176, 0, 0.02); }

.demo-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 60px; margin-top: 50px;}

.demo-card {
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255, 176, 0, 0.3);
    border-radius: 8px;
    padding: 25px;
    position: relative;
    overflow: hidden;
}

.demo-card::before {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px;
    background: linear-gradient(90deg, transparent, var(--accent-color), transparent);
}

.demo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px;}
.demo-badge { font-family: var(--font-mono); color: var(--accent-color); background: rgba(255, 176, 0, 0.1); padding: 4px 8px; border-radius: 4px; font-size: 0.7rem;}

.terminal-window { background: #0a0a0a; border-radius: 4px; padding: 15px; font-family: var(--font-mono); color: #ccc; min-height: 120px; max-height: 200px; overflow-y: auto; margin-bottom: 15px; border: 1px solid #333;}

.demo-btn { background: var(--accent-color); color: #000; border: none; padding: 10px 20px; font-weight: bold; cursor: pointer; border-radius: 4px; transition: all 0.2s;}
.demo-btn:hover { background: #fff; box-shadow: 0 0 15px var(--accent-color); }

.decoded-output { margin-top: 20px; font-family: var(--font-mono); color: #fff;}
.decoded-item { margin-bottom: 8px; font-size: 0.9rem;}
.decoded-label { color: var(--accent-color); font-weight: bold; margin-right: 5px;}


/* NATIVE OVERLAY BACKDROP (Replaces your old background configs) */
#lightbox::backdrop {
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(5px); /* Optional: modern subtle blur */
}

/* THE LIGHTBOX DIALOG wrapper */
#lightbox {
    border: none;
    background: transparent;
    padding: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    outline: none;
    overflow: hidden;
    
    /* Center the phone viewport cleanly on screen */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

        /* ==========================================
           The Flip Clock Architecture (Responsive)
           ========================================== */

        /* ==========================================
           The Flip Clock Architecture (Responsive)
           ========================================== */
        .clock-scale-wrapper {
            display: flex;
            justify-content: center;
            align-items: center;
            width: 100%;
            margin-bottom: 30px;
        }

/* 50% size reduction */
.clock-scale {
    transform: scale(0.75);
    transform-origin: top center;
}

        .clock-container {
            display: flex;
            gap: 12px;
            padding: 20px;
            background: rgba(0, 0, 0, 0.5);
            border-radius: 15px;
            box-shadow: 0 15px 35px rgba(0,0,0,0.7);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 176, 0, 0.15);
            
            /* Responsive variables based on viewport sizing */
            --card-w: 65px;
            --card-h: 85px;
            --font-sz: 45px;
        }

        /* Responsive Breakpoints to adjust structural size seamlessly */
        @media (min-width: 480px) {
            .clock-container {
                gap: 16px;
                padding: 25px;
                --card-w: 85px;
                --card-h: 110px;
                --font-sz: 60px;
            }
        }

        @media (min-width: 768px) {
            .clock-container {
                gap: 20px;
                padding: 30px;
                --card-w: 105px;
                --card-h: 140px;
                --font-sz: 75px;
            }
        }

        .card {
            position: relative;
            width: var(--card-w);
            height: var(--card-h);
            font-family: var(--font-mono);
            font-size: var(--font-sz);
            font-weight: 700;
            line-height: var(--card-h);
            border-radius: 10px;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
            perspective: 600px;
        }

        .card__face {
            position: absolute;
            left: 0;
            width: 100%;
            height: 50%;
            overflow: hidden;
            background: #141414;
            color: var(--accent-color);
            backface-visibility: hidden;
        }

        .card__face--top {
            top: 0;
            border-top-left-radius: 10px;
            border-top-right-radius: 10px;
            border-bottom: 1.5px solid rgba(0, 0, 0, 0.5);
            z-index: 2;
        }

        .card__face--top::after {
            content: "";
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to top, rgba(0,0,0,0.6), rgba(0,0,0,0));
            pointer-events: none;
        }

        .card__face--bottom {
            bottom: 0;
            border-bottom-left-radius: 10px;
            border-bottom-right-radius: 10px;
            line-height: 0;
        }

        .card__face--bottom::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to bottom, rgba(0,0,0,0.6), rgba(0,0,0,0));
            pointer-events: none;
        }

        .card__face span {
            display: block;
            width: 100%;
            text-align: center;
        }

        /* Animation States */
        .card__face--top-flip {
            transform-origin: bottom center;
            animation: flip-top 0.4s ease-in forwards;
        }

        .card__face--bottom-flip {
            transform-origin: top center;
            transform: rotateX(90deg);
            animation: flip-bottom 0.4s ease-out 0.4s forwards;
            background: #1c1c1c;
        }

        @keyframes flip-top {
            0% { transform: rotateX(0deg); }
            100% { transform: rotateX(-90deg); }
        }

        @keyframes flip-bottom {
            0% { transform: rotateX(90deg); }
            100% { transform: rotateX(0deg); }
        }
