/* --- RESET & VARIABLES --- */
:root {
    --bg-body: #ffffff;
    --bg-secondary: #f5f5f7;
    --bg-panel: #ffffff;
    --bg-panel-soft: #fafafa;
    --bg-hero-lane: #e5e5ea;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --danger: #ff3b30;
    --warning: #ffcc00;
    --success: #34c759;
    --border: #d2d2d7;
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-strong: 0 10px 30px rgba(0, 0, 0, 0.2);
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --nav-height: 60px;
    --section-padding: 120px;
}

/* DARK MODE */
body.dark {
    --bg-body: #05060a;
    --bg-secondary: #0c0d13;
    --bg-panel: #101219;
    --bg-panel-soft: #151823;
    --bg-hero-lane: #20222c;
    --text-main: #f5f5f7;
    --text-muted: #a0a3b1;
    --accent: #4ea8ff;
    --accent-hover: #66b7ff;
    --danger: #ff6b6b;
    --warning: #ffd166;
    --success: #51cf66;
    --border: #252838;
    --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.7);
    --shadow-strong: 0 18px 45px rgba(0, 0, 0, 0.85);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-stack); background-color: var(--bg-body); color: var(--text-main); line-height: 1.5; overflow-x: hidden; }

/* Buttons & Links */
h1, h2, h3, h4 { letter-spacing: -0.02em; font-weight: 600; }
p { color: var(--text-muted); font-size: 1.125rem; }
a { text-decoration: none; color: inherit; transition: opacity 0.2s; }
ul { list-style: none; }
button, .btn { font-family: inherit; cursor: pointer; border: none; outline: none; transition: all 0.3s ease; }
.btn-primary { background-color: var(--accent); color: white; padding: 12px 24px; border-radius: 99px; font-weight: 500; font-size: 1rem; display: inline-block; }
.btn-primary:hover { background-color: var(--accent-hover); transform: scale(1.02); }
.btn-outline { background-color: transparent; color: var(--accent); border: 1px solid var(--accent); padding: 11px 23px; border-radius: 99px; font-weight: 500; font-size: 1rem; display: inline-block; }
.btn-outline:hover { background-color: rgba(0, 113, 227, 0.1); }
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.text-center { text-align: center; }

/* --- HEADER / NAV --- */
header { position: sticky; top: 0; z-index: 1000; background: rgba(255, 255, 255, 0.9); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(0, 0, 0, 0.05); height: var(--nav-height); }
body.dark header { background: rgba(8, 9, 14, 0.9); border-bottom-color: rgba(255, 255, 255, 0.06); }

.nav-container { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.logo { display: inline-flex; align-items: center; gap: 8px; z-index: 2001; margin-right: auto; }
.logo-img { height: 26px; width: auto; display: block; }
.logo-text { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.03em; }

.nav-links { display: flex; gap: 24px; align-items: center; }
.nav-links a:not(.nav-btn) { font-size: 0.9rem; font-weight: 500; color: var(--text-main); }
.nav-links a:hover { color: var(--accent); }
.nav-btn { background: var(--text-main); color: white; padding: 8px 16px; border-radius: 99px; font-size: 0.85rem; }
.nav-btn:hover { background: #333; }
body.dark .nav-btn { background: var(--accent); }

/* Nav Controls (Right Side) */
.nav-controls { display: flex; align-items: center; gap: 16px; margin-left: 24px; }

/* Theme toggle */
.theme-toggle { width: 32px; height: 32px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-secondary); display: inline-flex; align-items: center; justify-content: center; position: relative; padding: 0; color: var(--text-main); }
.theme-toggle-icon { position: absolute; opacity: 0; transform: scale(0.85); transition: opacity 0.2s ease, transform 0.2s ease; font-size: 0.95rem; }
body:not(.dark) .theme-toggle-icon-sun { opacity: 1; transform: scale(1); }
body.dark .theme-toggle-icon-moon { opacity: 1; transform: scale(1); }

/* --- HERO --- */
.hero { padding-top: 80px; padding-bottom: 80px; min-height: 90vh; display: flex; align-items: center; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center; }
.hero-text h1 { font-size: 3.5rem; line-height: 1.1; margin-bottom: 24px; }
.hero-text p { margin-bottom: 32px; max-width: 450px; }
.hero-buttons { display: flex; gap: 16px; }
.hero-visual { position: relative; height: 400px; background: var(--bg-secondary); border-radius: 20px; overflow: hidden; border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; }
.lane { width: 80%; height: 120px; background: var(--bg-hero-lane); position: relative; border-radius: 4px; overflow: hidden; }
.zone { position: absolute; top: 0; bottom: 0; opacity: 0.2; }
.zone-green { left: 0; width: 40%; background: var(--success); }
.zone-yellow { left: 40%; width: 20%; background: var(--warning); }
.zone-red { left: 60%; width: 40%; background: var(--danger); }
.robot { width: 40px; height: 40px; background: #333; border-radius: 8px; position: absolute; top: 50%; left: 10%; transform: translateY(-50%); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); animation: robotLoop 8s infinite ease-in-out; }
.robot::after { content: ""; position: absolute; right: -4px; top: 10px; bottom: 10px; width: 4px; background: var(--accent); border-radius: 2px; }
@keyframes robotLoop { 0% { left: 10%; } 40% { left: 70%; } 50% { left: 70%; } 100% { left: 10%; } }
.hero-alert { position: absolute; top: 30%; left: 55%; background: white; padding: 8px 12px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15); font-size: 0.8rem; font-weight: 600; color: var(--danger); border-left: 4px solid var(--danger); opacity: 0; transform: translateY(10px); transition: all 0.5s ease; }
body.dark .hero-alert { background: var(--bg-panel); }
.hero-alert.visible { opacity: 1; transform: translateY(0); }

/* --- SCROLL STORY (DESKTOP) --- */
.scroll-story { position: relative; background: var(--bg-secondary); }
.sticky-wrapper { display: flex; position: relative; } 
.canvas-container { position: sticky; top: 0; width: 50%; height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg-secondary); }
.canvas-scene { width: 320px; height: 400px; background: var(--bg-panel); border-radius: 20px; box-shadow: var(--shadow-soft); position: relative; overflow: hidden; transition: background 0.5s; }
.cs-lane { position: absolute; left: 50%; top: 0; bottom: 0; width: 100px; transform: translateX(-50%); background: var(--bg-panel-soft); border-left: 2px dashed var(--border); border-right: 2px dashed var(--border); }
.cs-robot { width: 40px; height: 50px; background: #1d1d1f; border-radius: 8px; position: absolute; left: 50%; top: 80%; transform: translate(-50%, -50%); transition: all 1s cubic-bezier(0.25, 1, 0.5, 1); z-index: 2; }
body.dark .cs-robot { background: #f5f5f7; }
.cs-robot::before { content: ""; position: absolute; top: -2px; left: 10px; right: 10px; height: 4px; background: var(--accent); border-radius: 2px; }
.cs-zone-red { position: absolute; top: 0; left: 0; right: 0; height: 40%; background: rgba(255, 59, 48, 0.1); border-bottom: 2px solid var(--danger); display: flex; align-items: flex-end; justify-content: center; padding-bottom: 5px; font-size: 0.7rem; color: var(--danger); font-weight: bold; }
.cs-warning-icon { position: absolute; top: -25px; right: -20px; font-size: 24px; opacity: 0; transition: opacity 0.3s; }
.cs-overlay { position: absolute; top: 20px; right: 20px; width: 120px; background: rgba(0, 0, 0, 0.8); border-radius: 8px; padding: 10px; color: white; font-family: monospace; font-size: 0.7rem; opacity: 0; transition: opacity 0.5s; z-index: 5; }
.cs-graph-bar { height: 4px; background: var(--success); margin-top: 4px; border-radius: 2px; width: 40%; transition: width 0.3s; }
.cs-event-card { position: absolute; top: 50%; left: 50%; width: 260px; background: white; border-radius: 12px; padding: 20px; box-shadow: var(--shadow-strong); transform: translate(-50%, -50%) scale(0.9); opacity: 0; transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); z-index: 10; text-align: left; }
body.dark .cs-event-card { background: var(--bg-panel); }
.cs-event-header { font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.cs-event-badge { background: var(--danger); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.6rem; text-transform: uppercase; }
.cs-event-row { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding-bottom: 4px; }
.cs-event-val { color: var(--text-main); font-weight: 500; }
[data-state="1"] .cs-robot { top: 80%; }
[data-state="2"] .cs-robot { top: 35%; }
[data-state="2"] .cs-warning-icon { opacity: 1; animation: blink 1s infinite; }
[data-state="3"] .cs-robot { top: 35%; }
[data-state="3"] .cs-overlay { opacity: 1; }
[data-state="3"] .cs-graph-bar { width: 90%; background: var(--danger); }
[data-state="4"] .cs-robot { top: 35%; opacity: 0.3; }
[data-state="4"] .canvas-scene { background: #e5e5e5; }
[data-state="4"] .cs-event-card { opacity: 1; transform: translate(-50%, -50%) scale(1); }
@keyframes blink { 50% { opacity: 0; } }

/* Desktop Steps */
.steps-container { width: 50%; }
.step { min-height: 80vh; display: flex; flex-direction: column; justify-content: center; padding: 40px; opacity: 0.3; transition: opacity 0.5s; }
.step.is-active { opacity: 1; }
.step-card { padding: 0; background: transparent; border: none; box-shadow: none; }
.step h3 { font-size: 1.8rem; margin-bottom: 16px; }
.step p { max-width: 400px; }

/* --- OTHER SECTIONS --- */
.why-section, .personas, .stack-section, .demo-section, .cta-section { padding: var(--section-padding) 0; background: var(--bg-body); }
.why-grid { margin-top: 40px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.why-card, .d-box { background: var(--bg-panel); border-radius: 20px; padding: 20px 24px; box-shadow: var(--shadow-soft); transition: transform 0.25s ease, box-shadow 0.25s ease; }
.why-card:hover, .d-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-strong); }
.stack-section { text-align: center; background: var(--bg-secondary); }
.cta-section { text-align: center; background: var(--bg-secondary); }
.tabs-header { display: flex; justify-content: center; margin-bottom: 40px; background: var(--bg-secondary); width: fit-content; margin: 0 auto 40px auto; padding: 4px; border-radius: 99px; }
.tab-btn { padding: 10px 30px; border-radius: 99px; font-weight: 500; color: var(--text-muted); background: transparent; }
.tab-btn.active { background: var(--bg-panel); color: var(--text-main); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); }
.tab-content { display: none; text-align: center; max-width: 600px; margin: 0 auto; animation: fadeIn 0.5s; }
.tab-content.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.tab-content ul { text-align: left; margin: 30px 0; background: var(--bg-secondary); padding: 30px; border-radius: 20px; }
.tab-content li { margin-bottom: 12px; display: flex; gap: 10px; }
.tab-content li::before { content: "✓"; color: var(--accent); font-weight: bold; }
.stack-diagram { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 40px 0; }
.d-box { border: 1px solid var(--border); font-weight: 600; }
.d-box-dark { background: var(--text-main); color: var(--bg-body); border: none; }
.d-box-accent { border: 2px solid var(--accent); color: var(--accent); }
.d-arrow { font-size: 1.5rem; color: var(--text-muted); }
.demo-section { text-align: center; }
.video-wrapper { margin: 40px auto 0; max-width: 800px; background: #000; border-radius: 20px; overflow: hidden; box-shadow: var(--shadow-soft); aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center; color: white; }
video { width: 100%; height: 100%; object-fit: cover; }

/* Footer */
footer { padding: 32px 0; border-top: 1px solid var(--border); font-size: 0.85rem; color: var(--text-muted); background: var(--bg-body); }
.footer-inner { display: flex; justify-content: space-between; gap: 32px; flex-wrap: wrap; }
.footer-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.footer-right { display: flex; gap: 24px; flex-wrap: wrap; }
.footer-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.footer-email { color: var(--accent); font-weight: 500; }

/* Copy Button - Desktop Default */
.footer-copy-btn { border-radius: 999px; border: 1px solid var(--border); background: var(--bg-secondary); padding: 4px 10px; cursor: pointer; color: var(--text-main); }
body.dark .footer-copy-btn { border-color: #444; background: #222; color: #fff; } 

.reveal { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* BOOKING MODAL */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(5px); z-index: 3000; display: none; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.3s ease; }
.modal-overlay.open { display: flex; opacity: 1; }
.modal-content { width: 90%; max-width: 800px; height: 80vh; background: white; border-radius: 20px; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,0.3); overflow: hidden; }
body.dark .modal-content { background: #101219; }
.modal-close { position: absolute; top: 15px; right: 20px; background: transparent; border: none; font-size: 2rem; color: var(--text-main); cursor: pointer; z-index: 10; line-height: 1; }
.modal-content iframe { width: 100%; height: 100%; }

/* SCROLL INDICATOR */
.scroll-indicator { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 999; cursor: pointer; transition: opacity 0.3s, transform 0.3s; animation: bounce 2s infinite; }
.scroll-indicator.hidden { opacity: 0; pointer-events: none; transform: translateX(-50%) translateY(20px); }
.scroll-text { font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); }
.arrow-icon { font-size: 1.5rem; color: var(--accent); }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); } 40% { transform: translateX(-50%) translateY(-10px); } 60% { transform: translateX(-50%) translateY(-5px); } }

/* --- MOBILE MEDIA QUERY (900px) --- */
.mobile-menu-btn { display: none; background: none; border: none; flex-direction: column; gap: 6px; cursor: pointer; z-index: 2000; padding: 10px; }
.mobile-menu-btn span { display: block; width: 25px; height: 2px; background-color: var(--text-main); transition: 0.3s; }

@media (max-width: 900px) {
    :root { --section-padding: 60px; }
    h1 { font-size: 2.25rem !important; }
    h2 { font-size: 1.75rem !important; }
    .container { padding: 0 20px; }
    body, html { overflow-x: clip; } 

    /* Nav Drawer */
    .mobile-menu-btn { display: flex; }
    .nav-links { position: fixed; top: 0; right: 0; height: 100vh; width: 75%; max-width: 300px; background: var(--bg-panel); flex-direction: column; align-items: flex-start; justify-content: center; padding: 40px; box-shadow: -5px 0 20px rgba(0,0,0,0.2); transform: translateX(100%); transition: transform 0.3s ease-in-out; z-index: 1999; }
    .nav-links.nav-open { transform: translateX(0); }
    .nav-links a:not(.nav-btn) { width: 100%; border-bottom: 1px solid var(--border); padding: 15px 0; font-size: 1.1rem; }
    .nav-actions { margin-top: 20px; width: 100%; }
    .nav-btn { width: 100%; text-align: center; display: block; }

    /* Hero */
    .hero { display: block; padding-top: 40px; }
    .hero-grid { display: flex; flex-direction: column-reverse; gap: 30px; }
    .hero-text { text-align: center; }
    .hero-buttons { justify-content: center; flex-wrap: wrap; }
    .hero-visual { width: 100%; height: 280px; }

    /* GRID LAYOUT FOR MOBILE SCROLL STORY */
    .scroll-story { display: block !important; position: relative; overflow: visible !important; padding: 0; }
    .sticky-wrapper { display: grid; grid-template-columns: 1fr; grid-template-areas: "stack"; }

    /* Animation on Top (z-index 20) */
    .canvas-container {
        grid-area: stack;
        position: -webkit-sticky; position: sticky;
        top: 80px; 
        width: 100%; height: 45vh; 
        background: var(--bg-secondary); border-bottom: 1px solid var(--border); box-shadow: 0 5px 15px rgba(0,0,0,0.05);
        z-index: 20; 
        align-self: start; 
    }
    .canvas-scene { transform: scale(0.7); transform-origin: center center; }

    /* Text Behind (z-index 5) */
    .steps-container {
        grid-area: stack; position: relative; z-index: 5; 
        padding-top: 50vh; padding-bottom: 10vh; width: 100%; pointer-events: none;
    }
    .step { min-height: 50vh; display: flex; flex-direction: column; justify-content: center; padding: 20px; }
    .step-card {
        background: var(--bg-panel); padding: 24px; border-radius: 16px;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.1); border: 1px solid var(--border);
        pointer-events: auto; width: 100%; margin-bottom: 20px;
    }

    /* Rest */
    .why-grid { grid-template-columns: 1fr; }
    .tabs-header { width: 100%; flex-direction: row; }
    .tab-btn { flex: 1; padding: 10px 5px; font-size: 0.9rem; }
    .stack-diagram { flex-direction: column; gap: 16px; align-items: center; }
    .d-arrow { transform: rotate(90deg); margin: 10px auto; align-self: center; display: block; width: fit-content; }
    .d-box { width: 100%; max-width: 320px; margin: 0 auto; }
    .footer-inner { flex-direction: column; gap: 40px; text-align: center; }
    .footer-left, .footer-right, .footer-logo, .footer-email-row { align-items: center; justify-content: center; width: 100%; }
    
    /* Mobile Scroll Indicator */
    .scroll-indicator { bottom: 20px; background: rgba(255, 255, 255, 0.9); padding: 8px 16px; border-radius: 20px; border: 1px solid var(--border); box-shadow: 0 4px 15px rgba(0,0,0,0.1); z-index: 2002; }
    body.dark .scroll-indicator { background: rgba(0, 0, 0, 0.8); }

    /* MOBILE DARK MODE COPY BUTTON FIX */
    body.dark .footer-copy-btn {
        background-color: #222 !important;
        border-color: #444 !important;
        color: #ffffff !important;
        opacity: 1 !important;
        display: inline-block;
    }
}