/* ===========================
   MorphusAI Landing Page
   "Ethereal Tech" Style: Editorial Layout + Aurora Background
   =========================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-base: #f5f5f7;
    --text-dark: #111111;
    --text-gray: #555555;
    --accent-cyan: #00ffff;
    --accent-blue: #0066cc;
}

body {
    margin: 0;
    overflow-x: hidden;
    font-family: 'Inter', sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    transition: background-color 0.5s ease, color 0.5s ease;
}

body.dark-mode {
    background-color: #1a1a1a;
    color: #ffffff;
}

.theme-btn {
    background: transparent;
    border: 2px solid #ffffff;
    /* White border becomes black in difference mode */
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    margin-left: 20px;
    color: #ffffff;
    /* White text becomes black in difference mode */
    padding: 0;
    /* Reset padding */
}

body.dark-mode .theme-btn {
    border-color: #ffffff;
    color: #ffffff;
}

.theme-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .theme-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

body.dark-mode .content-box {
    background: transparent;
    border: none;
    backdrop-filter: none;
    box-shadow: none;
}

body.dark-mode .main-heading {
    background: linear-gradient(45deg, #ffffff, #a0a0a0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #ffffff;
}

body.dark-mode .phase-tag {
    color: var(--accent-cyan);
}

body.dark-mode .description {
    color: #e0e0e0;
    border-left-color: var(--accent-cyan);
}

body.dark-mode .cta-button {
    background: #ffffff;
    color: #111111;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
}

body.dark-mode h2 {
    color: #ffffff;
}

body.dark-mode p {
    color: #cccccc;
}

@keyframes aurora {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Canvas - Fixed Background */
#three-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    /* Vignette Overlay to make particles pop */
    mask-image: radial-gradient(circle at center, black 60%, transparent 100%);
}

/* Loader */
#loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-base);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--text-dark);
    border-radius: 50%;
    animation: spin 1s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

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

.loader-text {
    margin-top: 24px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    letter-spacing: 4px;
    color: var(--text-dark);
}

/* Header */
/* Fixed Header - 使用固定高度確保元素對齊 */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 120px;
    /* 固定高度 - 配合大 logo */
    z-index: 100;
    display: flex;
    flex-direction: row;
    align-items: center;
    /* 垂直居中所有項目 */
    justify-content: space-between;
    padding: 0 50px;
    transition: all 0.4s cubic-bezier(0.22, 1, 0.36, 1);
    mix-blend-mode: difference;
    color: white;
    box-sizing: border-box;
    overflow: hidden;
    /* 防止內容溢出 header 底部 */
}

/* Logo 區塊 */
.logo {
    display: flex;
    align-items: center;
    height: 100%;
    flex-shrink: 0;
    /* 防止 logo 被壓縮 */
}

.header-logo-img {
    height: 128px;
    /* 放大的 logo - 更顯眼 */
    width: auto;
    filter: invert(1);
    transition: filter 0.3s ease;
    display: block;
    flex-shrink: 0;
}

/* 導航區塊 - 居中 */
.header-nav {
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
    height: 100%;
    flex: 1;
    /* 佔據中間空間 */
}

/* 右側操作區塊 (語系切換 + 主題切換 + 手機選單) */
.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    height: 100%;
    flex-shrink: 0;
    /* 防止被壓縮 */
}

/* 滾動狀態 */
.main-header.scrolled {
    height: 90px;
    /* 滾動時稍微縮小 */
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0 50px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
    mix-blend-mode: normal;
    color: var(--text-dark);
    overflow: hidden;
    /* 確保滾動時也不會溢出 */
}

/* 滾動時 logo 稍微縮小 */
.main-header.scrolled .header-logo-img {
    height: 70px;
    /* 滾動時稍微縮小但仍然醒目 */
    filter: none;
    /* 黑色 logo 在白色背景 */
}

/* 深色模式滾動狀態 */
body.dark-mode .main-header.scrolled {
    background: rgba(20, 20, 20, 0.95);
    color: #ffffff;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
}

body.dark-mode .main-header.scrolled .header-logo-img {
    filter: invert(1);
    /* 白色 logo 在深色背景 */
}

/* 修正滾動狀態下的主題按鈕樣式 */
.main-header.scrolled .theme-btn {
    border-color: rgba(0, 0, 0, 0.3);
    color: var(--text-dark);
}

body.dark-mode .main-header.scrolled .theme-btn {
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

/* If the logo is black text, mix-blend-mode: difference on white bg makes it white (invisible?). 
   Wait, mix-blend-mode: difference inverts the content based on background.
   If bg is white: black content -> white. white content -> black.
   If bg is black: black content -> black (invisible). white content -> white.
   
   The original text was white because of color: white.
   The image is black.
   On white bg (light mode): Black image -> Inverted by difference -> White (invisible on white bg?? No, difference with white = invert).
   Let's rethink mix-blend-mode for the image.
   
   Actually, usually mix-blend-mode: difference is used with white text to ensure it's visible on both black and white backgrounds.
   White text on White bg -> Black.
   White text on Black bg -> White.
   
   If we use a BLACK logo image:
   On White bg: Black (0,0,0) diff White (255,255,255) -> (255,255,255) White. Invisible on white bg.
   On Black bg: Black (0,0,0) diff Black (0,0,0) -> (0,0,0) Black. Invisible on black bg.
   
   So a BLACK logo with mix-blend-mode: difference is problematic.
   We should probably INVERT the black logo to WHITE first using filter: invert(1).
   Then it behaves like white text.
   
   White Image:
   On White bg: White diff White -> Black. Visible.
   On Black bg: White diff Black -> White. Visible.
   
   So yes, filter: invert(1) on the black logo is correct to make it behave like the previous white text.
*/

/* 導航連結樣式 - 刪除重複定義，使用上方的主要定義 */

.header-nav a {
    font-size: 14px;
    color: inherit;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
    opacity: 0.7;
    transition: opacity 0.3s;
}

.header-nav a:hover {
    opacity: 1;
}

.cta-button-small {
    padding: 8px 16px;
    border: 1px solid currentColor;
    border-radius: 4px;
    opacity: 1 !important;
    transition: all 0.3s ease;
}

.cta-button-small:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* Language Switch */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Orbitron', sans-serif;
    font-size: 12px;
    letter-spacing: 1px;
}

/* 桌面版隱藏導航中的語系切換（只在手機版展開導航時顯示） */
.mobile-lang-switch {
    display: none;
}

.lang-switch a {
    text-decoration: none;
    color: inherit;
    opacity: 0.4;
    transition: all 0.3s ease;
    font-weight: 700;
}

.lang-switch a:hover {
    opacity: 1;
}

.lang-switch a.active {
    opacity: 1;
    color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.5);
}

.lang-switch .separator {
    opacity: 0.2;
    font-size: 10px;
}

body.dark-mode .lang-switch a.active {
    color: var(--accent-cyan);
}

/* Scroll Progress */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(0, 0, 0, 0.05);
    z-index: 101;
}

.scroll-progress-bar {
    height: 100%;
    background: var(--text-dark);
    width: 0%;
}

/* Sections */
.scroll-container {
    position: relative;
    z-index: 10;
    pointer-events: none;
}

.scroll-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 0 10%;
    /* Editorial padding */
    pointer-events: none;
}

/* Bottom Aligned Sections (Phase 1, 2, 3) */
.scroll-section.phase-1,
.scroll-section.phase-2,
.scroll-section.phase-3 {
    align-items: flex-end;
    padding-bottom: 80px;
}

/* Content Box - Editorial Style */
.content-box {
    max-width: 600px;
    opacity: 0;
    /* Initial state */
    transform: translateY(50px);
    /* Initial state */
    pointer-events: auto;
    /* Transition removed to allow direct JS control */
}

.content-box.wide-box {
    max-width: 1200px;
    /* Increased width for horizontal layout */
}

/* Hero Specific Layout */
.hero-container {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    padding-top: 15vh;
    padding-bottom: 80px;
    /* Increased from 40px to push content up */
}

/* ... existing styles ... */



.hero-top {
    text-align: center;
    /* Glitch title is centered */
}

.hero-bottom {
    /* Align bottom content */
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hero-bottom .description {
    max-width: 600px;
    margin-bottom: 0;
    border-left: 2px solid var(--accent-cyan);
    /* Keep the accent */
    padding-left: 24px;
}

.hero-bottom .trust-badges {
    justify-content: flex-start;
    /* Left align badges */
    margin-top: 0;
}

.content-box.visible {
    opacity: 1;
    transform: translateY(0);
}

.phase-tag {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--accent-blue);
    letter-spacing: 4px;
    margin-bottom: 24px;
    display: block;
    font-weight: 600;
}

.main-heading {
    font-family: 'Inter', sans-serif;
    font-size: 88px;
    /* Massive Headline */
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -3px;
    margin-bottom: 40px;
    color: var(--text-dark);
    background: linear-gradient(45deg, #111, #444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.description {
    font-size: 20px;
    line-height: 1.6;
    color: var(--text-gray);
    font-weight: 400;
    max-width: 480px;
    margin-bottom: 40px;
    border-left: 2px solid var(--accent-cyan);
    padding-left: 24px;
}

.solution-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-dark);
}

body.dark-mode .solution-footer {
    border-top-color: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
}

.solution-footer strong {
    display: block;
    margin-bottom: 8px;
    color: var(--accent-blue);
    font-size: 18px;
}

body.dark-mode .solution-footer strong {
    color: var(--accent-cyan);
}

.wide-box .description {
    max-width: 800px;
}

.center-hero .description {
    border-left: none;
    padding-left: 0;
    max-width: 700px;
}

.center-text {
    text-align: center;
    border-left: none;
    padding-left: 0;
}

/* Trust Badges */
/* Hero Section - Ensure relative positioning for absolute children */
.hero {
    position: relative;
}

/* Trust Badges - Aligned with Text */
.trust-badges {
    position: relative;
    bottom: auto;
    left: auto;
    display: flex;
    gap: 40px;
    margin-top: 10px;
    /* Adjust spacing from text */
    margin-left: 26px;
    /* Align with text (2px border + 24px padding) */
    z-index: 20;
}

.partner-logo {
    height: 50px;
    width: auto;
    opacity: 0.8;
    transition: all 0.3s ease;
    /* Handle logos with white backgrounds in Light Mode */
    mix-blend-mode: multiply;
    filter: grayscale(100%);
}

.partner-logo:hover {
    opacity: 1;
    filter: none;
    transform: translateY(-2px);
}

body.dark-mode .partner-logo {
    /* Handle logos in Dark Mode: Invert colors and use Screen to hide black background */
    filter: invert(1) grayscale(100%);
    mix-blend-mode: screen;
}

/* Specific fix for AWS Logo (which appears to be white/inverted natively) */
.partner-logo[src*="aws"] {
    /* Light Mode: Invert White to Black */
    filter: invert(1) grayscale(100%);
}

body.dark-mode .partner-logo[src*="aws"] {
    /* Dark Mode: Keep White (Revert the global inversion) */
    filter: grayscale(100%);
    mix-blend-mode: normal;
}

body.dark-mode .partner-logo:hover {
    filter: invert(1);
}

body.dark-mode .partner-logo[src*="aws"]:hover {
    filter: none;
}

.badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    border: 1px solid rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
}

body.dark-mode .badge {
    background: rgba(255, 255, 255, 0.05);
    color: #ccc;
    border-color: rgba(255, 255, 255, 0.1);
}



/* Tech Grid - Footer Style (Horizontal) */
.tech-grid {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    /* Allow scrolling on small screens if needed */
}

body.dark-mode .tech-grid {
    border-top-color: rgba(255, 255, 255, 0.1);
}

.tech-card {
    background: rgba(255, 255, 255, 0.5);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    flex: 1;
    /* Distribute space equally */
    min-width: 200px;
    /* Prevent squishing */
}

body.dark-mode .tech-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.tech-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.tech-card h3 {
    font-family: 'Orbitron', sans-serif;
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-dark);
}

body.dark-mode .tech-card h3 {
    color: #fff;
}

.patent-id {
    display: inline-block;
    font-size: 12px;
    color: var(--accent-blue);
    margin-bottom: 12px;
    font-family: monospace;
    background: rgba(0, 102, 204, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

body.dark-mode .patent-id {
    color: var(--accent-cyan);
    background: rgba(0, 255, 255, 0.1);
}

.tech-card p {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-gray);
    margin: 0;
}

body.dark-mode .tech-card p {
    color: #bbb;
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: space-around;
    width: 100%;
    margin-bottom: 60px;
    flex-wrap: wrap;
    gap: 20px;
}

.stat-item {
    text-align: center;
}

.main-heading {
    font-family: 'Orbitron', sans-serif;
    font-size: 64px;
    font-weight: 700;
    line-height: 1.4;
    /* Increased from 1.1 to prevent cutoff */
    margin-bottom: 30px;
    letter-spacing: -2px;
    background: linear-gradient(180deg, #1a1a1a 0%, #4a4a4a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 0.2em;
    /* Ensure descenders aren't clipped */
    overflow: visible;
}

.stat-value {
    font-family: 'Orbitron', sans-serif;
    font-size: 48px;
    font-weight: 700;
    color: var(--text-dark);
    background: linear-gradient(45deg, #111, #444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

body.dark-mode .stat-value {
    background: linear-gradient(45deg, #fff, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-label {
    font-size: 14px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
}

body.dark-mode .stat-label {
    color: #ccc;
}

/* Roadmap - Horizontal */
.roadmap-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    position: relative;
    border-left: none;
    /* Remove vertical line */
    padding-left: 0;
}

body.dark-mode .roadmap-container {
    border-top-color: rgba(255, 255, 255, 0.1);
    border-left: none;
}

/* Horizontal Line Connector */
.roadmap-container::before {
    content: '';
    position: absolute;
    top: -1px;
    /* Align with border-top */
    left: 0;
    width: 100%;
    height: 2px;
    background: transparent;
    /* The border-top serves as the line, but we can add dots */
}

.roadmap-item {
    position: relative;
    flex: 1;
    padding-top: 20px;
    /* Space for the dot */
}

.roadmap-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: -6px;
    /* Center on the top border */
    width: 12px;
    height: 12px;
    background: var(--bg-base);
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
}

body.dark-mode .roadmap-item::before {
    background: #1a1a1a;
    border-color: var(--accent-cyan);
}

.year {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--accent-blue);
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
}

body.dark-mode .year {
    color: var(--accent-cyan);
}

.milestone {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    display: block;
    margin-bottom: 8px;
    min-height: 48px;
    /* Align heights */
}

body.dark-mode .milestone {
    color: #fff;
}

.roadmap-item p {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
    line-height: 1.5;
}

body.dark-mode .roadmap-item p {
    color: #bbb;
}

/* Magnetic Flow Line */
.magnetic-flow-line {
    position: absolute;
    top: -2px;
    left: 0;
    width: 40%;
    /* Connects 2023 to 2025 */
    height: 4px;
    background: linear-gradient(90deg,
            rgba(0, 0, 0, 0) 0%,
            var(--accent-cyan) 50%,
            rgba(0, 0, 0, 0) 100%);
    background-size: 200% 100%;
    animation: magneticFlow 3s linear infinite;
    z-index: 1;
    border-radius: 2px;
    opacity: 0.8;
    mix-blend-mode: screen;
}

.flow-head {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-cyan), 0 0 20px var(--accent-cyan);
    animation: headPulse 2s ease-in-out infinite;
}

@keyframes magneticFlow {
    0% {
        background-position: 100% 0;
    }

    100% {
        background-position: -100% 0;
    }
}

@keyframes headPulse {

    0%,
    100% {
        transform: translateY(-50%) scale(1);
        opacity: 0.8;
    }

    50% {
        transform: translateY(-50%) scale(1.3);
        opacity: 1;
    }
}

body.dark-mode .magnetic-flow-line {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0%,
            var(--accent-cyan) 50%,
            rgba(255, 255, 255, 0) 100%);
}

/* Interactive Dots */
.roadmap-item {
    position: relative;
    flex: 1;
    padding-top: 20px;
    cursor: default;
    /* Default cursor for text */
}

.roadmap-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: -6px;
    width: 12px;
    height: 12px;
    background: var(--bg-base);
    border: 2px solid var(--accent-blue);
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    /* Bouncy effect */
    z-index: 2;
    cursor: pointer;
    /* Pointer for the dot */
}

.roadmap-item:hover::before {
    transform: scale(1.6);
    background: var(--accent-cyan);
    border-color: transparent;
    box-shadow: 0 0 15px var(--accent-cyan), 0 0 30px rgba(0, 255, 255, 0.4);
}

.roadmap-item:hover .year {
    color: var(--accent-cyan);
    text-shadow: 0 0 8px rgba(0, 255, 255, 0.4);
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

body.dark-mode .roadmap-item::before {
    background: #1a1a1a;
    border-color: var(--accent-cyan);
}

.year {
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    color: var(--accent-blue);
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
}

body.dark-mode .year {
    color: var(--accent-cyan);
}

.milestone {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-dark);
    display: block;
    margin-bottom: 8px;
    min-height: 48px;
    /* Align heights */
}

body.dark-mode .milestone {
    color: #fff;
}

.roadmap-item p {
    font-size: 13px;
    color: var(--text-gray);
    margin: 0;
    line-height: 1.5;
}

body.dark-mode .roadmap-item p {
    color: #bbb;
}

/* Roadmap Animation */
.roadmap-item {
    opacity: 0;
    transform: translateX(-100px);
    /* Start further left for more dramatic effect */
    transition: opacity 2.5s ease-out, transform 2.5s cubic-bezier(0.25, 1, 0.5, 1);
    /* Much slower for better observability */
    will-change: opacity, transform;
}

.roadmap-item.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Disable animation on mobile */
@media (max-width: 768px) {
    .roadmap-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

/* Stats Counter Animation */
.stat-value {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

.stat-value.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Responsive Roadmap: Stack on mobile */
@media (max-width: 768px) {
    .roadmap-container {
        flex-direction: column;
        border-top: none;
        border-left: 2px solid rgba(255, 255, 255, 0.1);
        padding-left: 30px;
        padding-top: 0;
    }

    .magnetic-flow-line {
        width: 4px;
        height: 40%;
        /* Connects top items vertically */
        top: 0;
        left: -3px;
        /* Align with border-left */
        background: linear-gradient(180deg,
                rgba(0, 0, 0, 0) 0%,
                var(--accent-cyan) 50%,
                rgba(0, 0, 0, 0) 100%);
        background-size: 100% 200%;
    }

    .flow-head {
        right: auto;
        left: 50%;
        bottom: 0;
        top: auto;
        transform: translateX(-50%);
    }

    @keyframes headPulse {

        0%,
        100% {
            transform: translateX(-50%) scale(1);
            opacity: 0.8;
        }

        50% {
            transform: translateX(-50%) scale(1.3);
            opacity: 1;
        }
    }

    .roadmap-item::before {
        left: -37px;
        top: 0;
    }

    .roadmap-item {
        padding-top: 0;
        margin-bottom: 30px;
    }
}

/* Glitch Effect */
/* Glitch Effect for Logo Image */
.glitch-logo-container {
    position: relative;
    width: 600px;
    /* Adjust size as needed */
    max-width: 90vw;
    height: auto;
    margin: 0 auto 40px;
    display: inline-block;
}

.glitch-img {
    display: block;
    width: 100%;
    height: auto;
}

.glitch-img.base {
    position: relative;
    z-index: 2;
}

.glitch-img.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.8;
}

.glitch-img.layer1 {
    left: 4px;
    animation: glitch-anim 5s infinite linear alternate-reverse;
    filter: drop-shadow(-2px 0 #ff00c1);
    clip-path: inset(44% 0 56% 0);
}

.glitch-img.layer2 {
    left: -4px;
    animation: glitch-anim2 5s infinite linear alternate-reverse;
    filter: drop-shadow(2px 0 #00fff9);
    clip-path: inset(44% 0 56% 0);
}

/* Dark Mode Glitch Logo */
body.dark-mode .glitch-img.base {
    filter: invert(1);
}

body.dark-mode .glitch-img.layer1 {
    /* Invert the black logo to white, then apply the colored shadow */
    filter: invert(1) drop-shadow(-2px 0 #ff00c1);
}

body.dark-mode .glitch-img.layer2 {
    filter: invert(1) drop-shadow(2px 0 #00fff9);
}

.glitch-wrapper {
    display: inline-block;
    position: relative;
    margin-bottom: 20px;
}

.glitch {
    position: relative;
    color: var(--text-dark);
    font-size: 100px;
    font-weight: 800;
    letter-spacing: -5px;
    z-index: 1;
}

body.dark-mode .glitch {
    color: #ffffff;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-base);
}

body.dark-mode .glitch::before,
body.dark-mode .glitch::after {
    background: #1a1a1a;
}

.glitch::before {
    left: 4px;
    /* Increased from 2px */
    text-shadow: -2px 0 #ff00c1;
    /* Increased from -1px */
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim 5s infinite linear alternate-reverse;
}

.glitch::after {
    left: -4px;
    /* Increased from -2px */
    text-shadow: -2px 0 #00fff9;
    /* Increased from -1px */
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim2 5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
    0% {
        clip-path: inset(7% 0 50% 0);
    }

    5% {
        clip-path: inset(28% 0 13% 0);
    }

    10% {
        clip-path: inset(5% 0 83% 0);
    }

    15% {
        clip-path: inset(88% 0 3% 0);
    }

    20% {
        clip-path: inset(2% 0 66% 0);
    }

    25% {
        clip-path: inset(62% 0 2% 0);
    }

    30% {
        clip-path: inset(47% 0 16% 0);
    }

    35% {
        clip-path: inset(3% 0 92% 0);
    }

    40% {
        clip-path: inset(15% 0 54% 0);
    }

    45% {
        clip-path: inset(58% 0 28% 0);
    }

    50% {
        clip-path: inset(31% 0 60% 0);
    }

    55% {
        clip-path: inset(83% 0 5% 0);
    }

    60% {
        clip-path: inset(11% 0 64% 0);
    }

    65% {
        clip-path: inset(54% 0 10% 0);
    }

    70% {
        clip-path: inset(23% 0 46% 0);
    }

    75% {
        clip-path: inset(76% 0 2% 0);
    }

    80% {
        clip-path: inset(3% 0 86% 0);
    }

    85% {
        clip-path: inset(42% 0 35% 0);
    }

    90% {
        clip-path: inset(6% 0 71% 0);
    }

    95% {
        clip-path: inset(45% 0 2% 0);
    }

    100% {
        clip-path: inset(59% 0 11% 0);
    }
}

@keyframes glitch-anim2 {
    0% {
        clip-path: inset(21% 0 57% 0);
    }

    5% {
        clip-path: inset(25% 0 30% 0);
    }

    10% {
        clip-path: inset(9% 0 63% 0);
    }

    15% {
        clip-path: inset(57% 0 19% 0);
    }

    20% {
        clip-path: inset(64% 0 33% 0);
    }

    25% {
        clip-path: inset(59% 0 20% 0);
    }

    30% {
        clip-path: inset(13% 0 57% 0);
    }

    35% {
        clip-path: inset(0% 0 74% 0);
    }

    40% {
        clip-path: inset(50% 0 33% 0);
    }

    45% {
        clip-path: inset(3% 0 30% 0);
    }

    50% {
        clip-path: inset(39% 0 5% 0);
    }

    55% {
        clip-path: inset(6% 0 13% 0);
    }

    60% {
        clip-path: inset(26% 0 50% 0);
    }

    65% {
        clip-path: inset(52% 0 1% 0);
    }

    70% {
        clip-path: inset(38% 0 35% 0);
    }

    75% {
        clip-path: inset(89% 0 5% 0);
    }

    80% {
        clip-path: inset(7% 0 80% 0);
    }

    85% {
        clip-path: inset(28% 0 62% 0);
    }

    90% {
        clip-path: inset(11% 0 49% 0);
    }

    95% {
        clip-path: inset(17% 0 25% 0);
    }

    100% {
        clip-path: inset(51% 0 47% 0);
    }
}

/* Responsive Glitch */
@media (max-width: 768px) {
    .glitch {
        font-size: 60px;
    }
}

/* CTA */
.cta-button {
    display: inline-block;
    padding: 18px 48px;
    background: var(--text-dark);
    color: white;
    text-decoration: none;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    letter-spacing: 2px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Final Section */
.final {
    justify-content: center;
    text-align: center;
}

.final .content-box {
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final .description {
    border-left: none;
    padding-left: 0;
    text-align: center;
    max-width: 600px;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 102;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: white;
    margin: 5px 0;
    transition: all 0.3s ease;
}

body.dark-mode .mobile-menu-btn span {
    background-color: white;
}

/* Scrolled state for menu button */
.main-header.scrolled .mobile-menu-btn span {
    background-color: var(--text-dark);
}

body.dark-mode .main-header.scrolled .mobile-menu-btn span {
    background-color: white;
}

/* Responsive */
@media (max-width: 1200px) {
    .main-heading {
        font-size: 64px;
    }
}

@media (max-width: 768px) {

    /* Mobile Header Layout */
    .main-header {
        padding: 20px;
        display: flex;
        /* Switch back to flex for mobile simplicity */
        justify-content: space-between;
        align-items: center;
    }

    /* Reset Grid Columns for Mobile */
    .logo,
    .header-actions {
        grid-column: auto;
    }

    .logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        width: auto;
        justify-content: center;
    }

    .header-actions {
        display: flex;
        gap: 15px;
        /* Ensure it's on the right */
        margin-left: auto;
    }

    /* Hide language switch in header on mobile, it will be shown in nav overlay */
    .header-actions .lang-switch {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    /* Mobile Nav Overlay */
    .header-nav {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 40px;
        transform: translateY(-100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 101;
        /* Behind burger button */
        display: flex;
        /* Ensure it's flex for column layout */
    }

    body.dark-mode .header-nav {
        background: rgba(20, 20, 20, 0.98);
    }

    .header-nav.active {
        transform: translateY(0);
    }

    .header-nav a {
        font-size: 24px;
        color: var(--text-dark);
        -webkit-tap-highlight-color: transparent;
    }

    body.dark-mode .header-nav a {
        color: white;
    }

    /* Show language switch in nav overlay on mobile */
    .header-nav .lang-switch {
        display: flex;
        margin-left: 0;
        margin-top: 10px;
        transform: scale(1.5);
        /* Make it touch-friendly */
    }

    /* Hamburger Animation */
    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }

    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(5px, -5px);
    }

    /* Scrolled Header Adjustments */
    .main-header.scrolled {
        padding: 15px 20px;
    }

    .header-logo-img {
        height: 80px;
    }

    .main-header.scrolled .header-logo-img {
        height: 60px;
    }

    .scroll-section {
        padding: 0 30px;
    }

    .main-heading {
        font-size: 48px;
    }

    .description {
        font-size: 16px;
    }

    .tech-grid {
        flex-direction: column;
        overflow-x: visible;
    }

    /* Fix Vision Section Overlap on Mobile */
    #vision {
        padding-top: 80px;
        /* Reduced padding to balance space */
        align-items: flex-start;
        /* Align content to top */
    }
}