:root {
    /* Color System - Enhanced palette */
    --bg: #f7f9fc;
    --surface: #ffffff;
    --surface-strong: #0f172a;
    --surface-subtle: #0f172a0d;
    --surface-hover: #f8fafc;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --muted: #64748b;
    --muted-light: #94a3b8;
    --text: #1f2937;
    --text-strong: #0f172a;

    /* Primary Colors - Blue gradient system */
    --primary-50: #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;

    /* Accent Colors */
    --accent-amber: #f59e0b;
    --accent-amber-light: #fef3c7;
    --accent-teal: #14b8a6;
    --accent-teal-light: #ccfbf1;
    --accent-indigo: #6366f1;
    --accent-indigo-light: #e0e7ff;
    --accent-purple: #a855f7;
    --accent-purple-light: #f3e8ff;

    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --radius-full: 999px;

    /* Shadows - Enhanced depth system */
    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 10px 30px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 25px 50px -12px rgba(15, 23, 42, 0.12);
    --shadow-xl: 0 35px 60px -15px rgba(15, 23, 42, 0.15);

    /* Spacing System */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-2xl: 4rem;

    /* Typography */
    --font-sans: 'Inter', 'Noto Sans TC', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    --font-weight-extrabold: 800;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 200ms ease;
    --transition-slow: 300ms ease;
}

/* Base Styles */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--text-strong);
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: var(--font-weight-extrabold);
    line-height: 1.1;
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.75rem);
    font-weight: var(--font-weight-bold);
    line-height: 1.2;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: var(--font-weight-bold);
    line-height: 1.3;
}

h4 {
    font-size: clamp(1.25rem, 2vw, 1.5rem);
    font-weight: var(--font-weight-semibold);
}

h5 {
    font-size: 1.125rem;
    font-weight: var(--font-weight-semibold);
}

h6 {
    font-size: 1rem;
    font-weight: var(--font-weight-medium);
}

p {
    margin: 0 0 1rem;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-600);
}

img {
    max-width: 100%;
    display: block;
}

/* Layout Containers */
.shell {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container {
    max-width: 1200px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: var(--space-lg) !important;
    padding-right: var(--space-lg) !important;
}

.container-custom {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

/* Sections */
.section {
    padding: 80px 0;
}

.section-block {
    padding: 72px 0;
}

.section-title {
    font-size: clamp(1.8rem, 3vw, 2.5rem);
    font-weight: var(--font-weight-extrabold);
    color: var(--text-strong);
    text-align: center;
    letter-spacing: -0.02em;
    margin: 0 0 var(--space-sm);
}

.section-subtitle {
    color: var(--muted);
    text-align: center;
    max-width: 760px;
    margin: 0 auto var(--space-xl);
    font-size: 1.1rem;
    line-height: 1.7;
}

/* Cards - Enhanced design */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: var(--space-lg);
    transition: transform var(--transition-base), box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-200);
}

.card-strong {
    background: linear-gradient(145deg, #0f172a, #0b1223);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.card-bleed {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(14, 165, 233, 0.08));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 28px;
}

/* Pills & Tags */
.pill {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: var(--surface-subtle);
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: var(--font-weight-semibold);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.pill:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: var(--radius-md);
    background: var(--primary-50);
    color: var(--primary-700);
    font-weight: var(--font-weight-semibold);
    font-size: 0.75rem;
    transition: background var(--transition-fast);
}

.tag:hover {
    background: var(--primary-100);
}

/* Buttons - Enhanced with better states */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: var(--font-weight-bold);
    font-size: 0.95rem;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    cursor: pointer;
    border: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    color: #fff;
    box-shadow: 0 14px 30px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 40px rgba(37, 99, 235, 0.35);
    background: linear-gradient(135deg, var(--primary-700), var(--primary-800));
}

.btn-ghost {
    background: var(--surface);
    color: var(--text-strong);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.btn-ghost:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--primary-200);
    background: var(--surface-hover);
}

/* Grid Layouts */
.grid-two {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.grid-three {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-lg);
}

.grid-four {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
}

/* Navigation */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    /* Removed backdrop/background from here to prevent fixed child clipping */
}

/* New background layer that handles the blur */
.header-bg {
    position: absolute;
    inset: 0;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    z-index: 1;
}

.nav-bar {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-lg);
    position: relative;
    z-index: 50;
    /* Ensure nav content stays above bg and menu if needed */
}

.brand {
    font-weight: var(--font-weight-extrabold);
    font-size: 1.35rem;
    color: var(--primary-700);
    letter-spacing: -0.02em;
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    transition: color var(--transition-fast);
    /* Safe defaults */
    white-space: nowrap;
    flex-shrink: 0;
    text-decoration: none;
}

.brand:hover {
    color: var(--primary-800);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.nav-link {
    padding: 10px 16px;
    border-radius: var(--radius-full);
    color: var(--muted);
    font-weight: var(--font-weight-semibold);
    font-size: 0.95rem;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.nav-link:hover {
    color: var(--primary-700);
    background: var(--primary-50);
}

.nav-link.is-active {
    color: var(--primary-700);
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
}

/* Footer */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 32px 0 40px;
    margin-top: 80px;
}

.footer-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 0.95rem;
}

.footer-links {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.footer-link {
    padding: 8px 14px;
    border-radius: var(--radius-md);
    background: var(--surface-subtle);
    color: var(--text-strong);
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-weight: var(--font-weight-semibold);
    font-size: 0.9rem;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.footer-link:hover {
    background: var(--primary-50);
    color: var(--primary-700);
    transform: translateY(-1px);
}

/* Hero Section */
.hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 64, 175, 0.65));
}

.hero-shell {
    position: relative;
    z-index: 1;
}

/* Utility Classes */
.muted {
    color: var(--muted);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-600), var(--accent-indigo));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cta-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
}

.stat {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-xs);
    align-items: center;
}

/* Lists */
.list-tight {
    margin: 12px 0 0;
    padding-left: 18px;
    color: var(--muted);
}

.list-tight li {
    margin-bottom: 4px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Focus States for Accessibility */
:focus {
    outline: 2px solid var(--primary-600);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

/* Responsive Design */
/* Responsive Design & Mobile Menu - Clean Slate Refactor */
@media (max-width: 1024px) {
    :root {
        --space-lg: 1.5rem;
        --space-xl: 2.5rem;
    }

    /* 1. Header & Navigation */
    .site-header {
        position: -webkit-sticky;
        position: sticky;
        top: 0;
        width: 100%;
        /* Ensure it remains sticky on mobile */
    }

    .nav-bar {
        height: 64px;
        flex-wrap: nowrap;
        /* Prevent brand wrapping */
    }

    .brand {
        font-size: 1.25rem;
        /* Slightly smaller on mobile to fit */
        white-space: nowrap;
        flex-shrink: 0;
        z-index: 60;
        /* Above menu if needed, though menu covers everything usually */
    }

    /* Hide Desktop Elements - FORCE override tailwind utilities */
    .nav-links,
    .cta-row {
        display: none !important;
    }

    /* Mobile Hamburger Button */
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        /* Larger touch target */
        height: 44px;
        min-width: 44px;
        border: 1px solid var(--border);
        background: var(--surface);
        border-radius: var(--radius-md);
        color: var(--text-strong);
        cursor: pointer;
        z-index: 10000;
        /* Highest Z-index to be clickable, above menu */
        transition: all var(--transition-fast);
        outline: none;
    }

    .mobile-menu-btn:hover,
    .mobile-menu-btn:active {
        background: var(--surface-hover);
        border-color: var(--primary-200);
        color: var(--primary-600);
    }

    /* 2. Full Screen Mobile Menu Overlay */
    .mobile-menu {
        position: fixed;
        inset: 0;
        /* Full screen - works now because header has no transform/filter */
        background-color: #ffffff;
        z-index: 20;
        /* Above header-bg(1) but BELOW nav-bar(50) so button remains clickable */
        padding: 80px var(--space-lg) var(--space-lg);
        /* Top padding clears header */
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        /* Items start from top */
        overflow-y: auto;
        /* Allow scrolling if huge menu */

        /* Transition */
        opacity: 0;
        visibility: hidden;
        transform: translateY(10px);
        transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    }

    .mobile-menu.is-active {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    /* Mobile Nav Links - Centralized & Prominent */
    /* Mobile Nav Links - Centralized & Prominent */
    .mobile-nav-link {
        font-size: 1.5rem;
        /* More elegant size */
        font-weight: 600;
        /* Semi-bold instead of ExtraBold */
        color: var(--text-strong);
        padding: 12px 0;
        /* Slightly tighter vertical spacing */
        width: 100%;
        text-align: center;
        /* Center aligned for focus */
        transition: all 0.2s ease;
        border-radius: var(--radius-md);
        /* For hover effect */
    }

    .mobile-nav-link:hover,
    .mobile-nav-link:active {
        color: var(--primary-600);
        background-color: var(--surface-hover);
        /* Subtle touch feedback */
        transform: scale(1.05);
        /* Gentle zoom */
    }

    /* Mobile CTA Section */
    .mobile-cta {
        margin-top: auto;
        /* Push to bottom */
        padding-top: var(--space-xl);
        display: flex;
        flex-direction: column;
        gap: var(--space-md);
        width: 100%;
    }

    .mobile-cta .btn {
        width: 100%;
        padding: 16px;
        font-size: 1.1rem;
        justify-content: center;
    }

    /* 3. Grid & Layout Reflow */
    .shell,
    .container,
    .container-custom {
        padding-left: 24px !important;
        padding-right: 24px !important;
    }

    .section {
        padding: 60px 0;
    }

    /* Stacking grids vertically on mobile */
    .grid-two,
    .grid-three,
    .grid-four {
        grid-template-columns: 1fr;
        gap: 32px;
        /* Consistent vertical rhythm */
    }

    /* Footer changes */
    .footer-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-lg);
    }
}

/* 4. Small Mobile Improvements */
@media (max-width: 400px) {
    .brand {
        font-size: 1.1rem;
        /* Scale down logo slightly */
    }

    h1 {
        font-size: 2.25rem !important;
        /* Force readable sizing */
    }
}

@media (min-width: 1025px) {

    .mobile-menu-btn,
    .mobile-menu {
        display: none !important;
    }
}

/* Print Styles */
@media print {

    .site-header,
    .site-footer,
    .cta-row {
        display: none;
    }

    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* Custom Hero Background for Pages */
.page-hero-bg {
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.6)),
        url('hero_banner_smart_city.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: relative;
}

/* Ensure text is readable on the light background */
.page-hero-bg h1,
.page-hero-bg h2,
.page-hero-bg p {
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}