:root {
    /* Default Dark Mode Palette */
    --primary: #00ffaa;
    --secondary: #7000ff;
    --bg: #050505;
    --surface: rgba(255, 255, 255, 0.03);
    --text: #e0e0e0;
    --text-light: #aaa;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: none;
    --logo-bg: url('../images/logo_dark.png');
    --scanline-color: var(--primary);
    --blend-mode: screen;
    --hero-logo-filter: none;
    --scanline-opacity: 0.5;
}

[data-theme="light"] {
    /* Light Mode Palette */
    --primary: #00a8ff;
    --secondary: #0984e3;
    --bg: #f5f6fa;
    --surface: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --glass: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(0, 168, 255, 0.1);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    --logo-bg: url('../images/logo_light.png');
    --scanline-color: var(--primary);
    --blend-mode: exclusion;
    --hero-logo-filter: none;
    --scanline-opacity: 0.5;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Rajdhani', 'Noto Sans TC', 'Microsoft JhengHei', 'PingFang TC', sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3, h4 {
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text); /* Explicitly set color to follow theme */
}

/* --- Global Tech Background --- */
.fixed-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    background:
        linear-gradient(rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.8)),
        repeating-linear-gradient(transparent 0, transparent 49px, rgba(0, 255, 170, 0.03) 50px);
    transition: opacity 0.3s;
}

[data-theme="light"] .fixed-bg {
    background:
        linear-gradient(rgba(245, 246, 250, 0.95), rgba(245, 246, 250, 0.9)),
        repeating-linear-gradient(transparent 0, transparent 49px, rgba(0, 168, 255, 0.03) 50px);
}

/* --- UI Components --- */
.btn {
    display: inline-block;
    padding: 12px 30px;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    text-decoration: none;
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
    font-weight: 700;
    letter-spacing: 2px;
    transition: 0.3s;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
}

[data-theme="light"] .btn {
    background: var(--surface);
    border: 2px solid var(--primary);
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary);
    transition: 0.3s;
    z-index: -1;
}

.btn:hover {
    color: #fff;
}

[data-theme="dark"] .btn:hover {
    color: #000;
}

[data-theme="light"] .btn:hover {
    color: #fff;
    border-color: var(--primary);
}

.btn:hover::before {
    left: 0;
}

/* --- Navbar --- */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 50px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
    backdrop-filter: blur(10px);
    background: rgba(5, 5, 5, 0.8);
    border-bottom: 1px solid var(--glass-border);
    transition: background 0.3s, border-color 0.3s;
}

[data-theme="light"] nav {
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.03);
}

.nav-logo {
    font-family: 'Orbitron';
    font-weight: 900;
    font-size: 1.5rem;
    color: #fff;
    text-decoration: none;
}

[data-theme="light"] .nav-logo {
    color: var(--text);
}

.nav-logo span {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    opacity: 0.7;
    transition: 0.3s;
}

[data-theme="light"] .nav-links a {
    color: var(--text);
    font-weight: 600;
}

.nav-links a:hover {
    opacity: 1;
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary);
}

[data-theme="light"] .nav-links a:hover {
    text-shadow: none;
}

/* Theme Toggle Button */
#theme-toggle {
    background: none;
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
    font-size: 0.8rem;
    transition: all 0.3s ease;
}

#theme-toggle:hover {
    background: var(--primary);
    color: var(--bg);
}

/* Language Toggle Button */
#lang-toggle {
    background: none;
    border: 1px solid var(--secondary);
    color: var(--secondary);
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    margin-left: 10px;
}

#lang-toggle:hover {
    background: var(--secondary);
    color: #fff;
}

/* Dark Mode Override for Lang Toggle */
[data-theme="dark"] #lang-toggle {
    border-color: var(--primary) !important;
    color: var(--primary) !important;
}

[data-theme="dark"] #lang-toggle:hover {
    background: var(--primary) !important;
    color: var(--bg) !important;
}


/* --- Hero Section --- */
.hero {
    height: 100vh;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.hero-content {
    position: absolute;
    z-index: 10;
    text-align: center;
    bottom: 15%;
    width: 100%;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    /* Removed default opacity:0/transform for progressive enhancement. GSAP will handle it. */
}

[data-theme="light"] .hero-title {
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 2rem;
    /* Removed default opacity:0/transform for progressive enhancement. GSAP will handle it. */
}

[data-theme="light"] .hero-subtitle {
    font-weight: 600;
}

#anim-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

.logo-wrapper {
    width: 400px;
    height: 400px; /* Enforce square to match design */
    position: relative;
    z-index: 20;
    mix-blend-mode: screen; /* Default for dark mode */
    display: flex;
    justify-content: center;
    align-items: center;
}

[data-theme="light"] .logo-wrapper {
    mix-blend-mode: normal;
}

.logo-wrapper img {
    width: 100%;
    height: auto;
    display: block;
}

.glitch-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--logo-bg) no-repeat center center;
    background-size: contain;
    opacity: 0;
    mix-blend-mode: var(--blend-mode);
}

.scanline {
    width: 100vw;
    height: 20vh;
    background: linear-gradient(0deg, transparent, var(--scanline-color), transparent);
    opacity: var(--scanline-opacity);
    position: fixed;
    top: -20vh;
    left: 0;
    z-index: 9999;
    mix-blend-mode: screen;
    animation: scan 8s linear infinite;
    pointer-events: none;
}
[data-theme="light"] .scanline {
    mix-blend-mode: multiply; /* Better visibility on light background */
    opacity: 0.15;
}


@keyframes scan {
    0% { top: -20vh; }
    100% { top: 120vh; }
}

/* --- Selling Points --- */
.points-section {
    padding: 20px 10% 80px 10%; /* Reduced top padding significantly */
    margin-top: -20px; /* Pull it slightly up closer to hero */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    position: relative;
}

.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    padding: 40px;
    border-radius: 4px;
    transition: 0.3s;
    position: relative;
    box-shadow: var(--shadow);
}

.card:hover {
    transform: translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.1); /* Default dark glow */
}

[data-theme="light"] .card:hover {
    box-shadow: 0 0 30px rgba(0, 168, 255, 0.1);
}

.card-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 20px;
    font-family: 'Orbitron';
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: var(--text);
}

[data-theme="dark"] .card h3 {
     color: #fff;
}

.card p {
    font-size: 1rem;
    color: var(--text-light);
}

/* --- Features Section --- */
.features-section {
    padding: 20px 10% 100px 10%; /* Reduced top padding */
}

[data-theme="light"] .features-section {
    background: #fff;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

.section-header h2 {
    font-size: 2.5rem;
    color: var(--text);
    margin-bottom: 10px;
}

[data-theme="dark"] .section-header h2 {
    color: #fff;
}

.section-header .line {
    width: 60px;
    height: 4px;
    background: var(--secondary);
    margin: 0 auto;
}

.feature-row {
    display: flex;
    align-items: center;
    gap: 50px;
    margin-bottom: 100px;
}

.feature-row:nth-child(even) {
    flex-direction: row-reverse;
}

.f-text {
    flex: 1;
}

.f-text h3 {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 15px;
}

.f-text p {
    font-size: 1.1rem;
    color: var(--text-light); /* Default logic usually maps to text-light or specific var */
    margin-bottom: 10px;
}
[data-theme="dark"] .f-text p {
    color: #ccc;
}
[data-theme="light"] .f-text p {
    color: var(--text);
}


.f-text .en-text {
    font-size: 0.9rem;
    color: #666;
    font-style: italic;
}
[data-theme="light"] .f-text .en-text {
    color: var(--text-light);
}


.f-visual {
    flex: 1;
    height: 300px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    border-radius: 4px;
}

[data-theme="light"] .f-visual {
    background: var(--bg);
    border-radius: 20px;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.05);
}

/* Procedural Tech Visuals for Features */
.tech-circle {
    width: 150px;
    height: 150px;
    border: 2px dashed var(--secondary);
    border-radius: 50%;
    animation: rotate 10s linear infinite;
}

.tech-square {
    width: 100px;
    height: 100px;
    border: 2px solid var(--primary);
    transform: rotate(45deg);
    background: rgba(0, 255, 170, 0.1);
}

[data-theme="light"] .tech-square {
    background: rgba(0, 168, 255, 0.05);
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

/* --- footer --- */
footer {
    padding: 50px;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    background: #000;
}

[data-theme="light"] footer {
    background: #f1f2f6;
}

footer p {
    color: #aaa;
}

[data-theme="light"] footer p {
    color: var(--text-light);
}

footer a {
    color: var(--primary);
    margin: 0 10px;
    text-decoration: none;
    font-weight: 500;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .nav-links {
        display: none; /* Mobile menu needed */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: rgba(30, 30, 30, 0.98);
        flex-direction: column;
        padding: 20px;
        text-align: center;
    }
    
    [data-theme="light"] .nav-links {
         background: rgba(255, 255, 255, 0.95);
    }

    .nav-links.active {
        display: flex;
    }

    /* Mobile Layout Fix: Switch to Flex Column to prevent overlap */
    .hero {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: center;
        padding-top: 100px;
        padding-bottom: 10px; /* Reduced bottom padding to separate from next section */
        height: auto;
        min-height: auto; /* Allow height to adjust to content on mobile to avoid large gaps */
    }

    #anim-container {
        position: relative;
        height: auto;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-bottom: 10px;
        flex: 0 0 auto;
    }

    .logo-wrapper {
        width: 220px;
        height: 220px;
    }

    .hero-content {
        position: relative;
        bottom: auto;
        width: 100%;
        padding: 0 20px;
        margin-bottom: 20px;
    }

    .hero-title {
        font-size: clamp(1rem, 6vw, 1.5rem); /* Dynamic sizing to fit long English word */
        word-break: normal; /* Prevent breaking if possible */
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }

    .feature-row {
        flex-direction: column !important;
    }
    
    .mobile-menu-toggle {
        display: block;
        color: var(--text);
        font-size: 1.5rem;
        cursor: pointer;
    }
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none;
    }
}

/* Language toggling classes */
html[lang="en"] .lang-zh { display: none; }
html[lang="zh-TW"] .lang-en { display: none; }

/* Mobile display toggles */
.mobile-show { display: none; }
@media (max-width: 768px) {
    .mobile-hide { display: none; }
    .mobile-show { display: inline; }
    
    .brand-text { display: block; margin-top: 5px; }
    .brand-part { display: block; line-height: 1.2; }
}
