:root {
    /* Light Mode Variables (Default) */
    --color-bg: #FFFFFF;
    --color-bg-alt: #F9FAFB;
    --color-text: #111827;
    --color-text-light: #6B7280;

    --color-primary: #2563EB;
    /* Royal Blue */
    --color-primary-hover: #1D4ED8;

    --color-border: #E5E7EB;

    --nav-bg-initial: rgba(255, 255, 255, 0.95);
    --nav-bg-scrolled: rgba(255, 255, 255, 0.98);
    --mobile-menu-bg: #FFFFFF;
    --shadow-color: rgba(0, 0, 0, 0.1);

    /* Fonts */
    --font-heading: 'Noto Sans TC', sans-serif;
    --font-body: 'Noto Sans TC', sans-serif;
    --font-decorative: 'Outfit', sans-serif;

    --container-width: 1200px;
    --section-spacing: 120px;
    --border-radius: 50px;
    /* Fully rounded/pill shape */
}

/* Dark Mode Support (System) */
@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #0F172A;
        /* Slate 900 */
        --color-bg-alt: #1E293B;
        /* Slate 800 */
        --color-text: #F9FAFB;
        /* Slate 50 */
        --color-text-light: #94A3B8;
        /* Slate 400 */

        --color-primary: #3B82F6;
        /* Blue 500 */
        --color-primary-hover: #60A5FA;
        /* Blue 400 */

        --color-border: #334155;
        /* Slate 700 */

        --nav-bg-initial: rgba(15, 23, 42, 0.95);
        --nav-bg-scrolled: rgba(15, 23, 42, 0.98);
        --mobile-menu-bg: #0F172A;
        --shadow-color: rgba(0, 0, 0, 0.5);
    }
}

/* Dark Mode Support (Manual Class) - Overrides System */
html.dark:root,
:root.dark {
    --color-bg: #0F172A;
    --color-bg-alt: #1E293B;
    --color-text: #F9FAFB;
    --color-text-light: #94A3B8;
    --color-primary: #3B82F6;
    --color-primary-hover: #60A5FA;
    --color-border: #334155;
    --nav-bg-initial: rgba(15, 23, 42, 0.95);
    --nav-bg-scrolled: rgba(15, 23, 42, 0.98);
    --mobile-menu-bg: #0F172A;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Utilities */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 40px;
}

.section {
    padding: var(--section-spacing) 0;
}

.bg-gray {
    background-color: var(--color-bg-alt);
}

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

/* Typography */
h1,
h2,
h3,
h4 {
    color: var(--color-text);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: 4rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 2.5rem;
    position: relative;
    display: inline-block;
}

/* Minimalist separator */
h2::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: var(--color-primary);
    margin-top: 16px;
    border-radius: 2px;
}

.center-text h2::after {
    margin-left: auto;
    margin-right: auto;
}

h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

p {
    color: var(--color-text-light);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* Navigation - Clean & Minimal */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px 0;
    background: var(--nav-bg-initial);
    backdrop-filter: blur(12px);
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: all 0.3s;
}

.navbar.scrolled {
    padding: 16px 0;
    border-color: var(--color-border);
    background: var(--nav-bg-scrolled);
}

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

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.5rem;
    font-family: var(--font-decorative);
}

.brand-logo {
    height: 36px;
    width: auto;
}

.nav-menu {
    display: flex;
    gap: 40px;
    list-style: none;
    align-items: center;
    /* Ensure items wrap if space is tight, though usually row */
}

/* Mobile Menu Active State */
.nav-menu.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--mobile-menu-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 20px;
    box-shadow: 0 10px 30px var(--shadow-color);
}

.nav-menu a {
    text-decoration: none;
    color: var(--color-text);
    font-weight: 500;
    font-size: 1rem;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--color-primary);
}

.btn-cw {
    padding: 10px 24px;
    background: var(--color-text);
    color: var(--color-bg) !important;
    /* Ensure high contrast */
    border-radius: 50px;
    /* Pill Shape */
    font-weight: 500;
    transition: all 0.2s;
}

/* Specific Navbar Button Override for Dark Mode */
@media (prefers-color-scheme: dark) {
    .btn-cw {
        background-color: #FFFFFF !important;
        color: #0F172A !important;
        border: none;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
    }

    .btn-cw:hover {
        background-color: #F1F5F9 !important;
        /* Slightly off-white on hover */
        transform: translateY(-2px);
    }
}

/* Manual Dark Mode Override for Button */
html.dark .btn-cw,
:root.dark .btn-cw {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    border: none;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

html.dark .btn-cw:hover,
:root.dark .btn-cw:hover {
    background-color: #F1F5F9 !important;
    transform: translateY(-2px);
}


.btn-cw:hover {
    background: var(--color-primary);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--color-text);
    cursor: pointer;
}

/* Theme Toggle Button */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: all 0.2s;
    margin-left: 10px;
}

.theme-toggle:hover {
    background: var(--color-bg-alt);
    color: var(--color-primary);
    transform: rotate(15deg);
}

/* Hero Section */
.hero {
    padding: 180px 0 100px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.hero-text {
    z-index: 2;
}

.hero-text h1 {
    font-size: 3.5rem;
    line-height: 1.2;
}

.hero-visual {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Subtle Glow Background for Scene */
.hero-visual::before {
    content: '';
    position: absolute;
    width: 100%;
    /* Use percentage for scene */
    height: 100%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.15) 0%, rgba(37, 99, 235, 0) 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: -1;
    border-radius: 50%;
    animation: pulse-glow 5s ease-in-out infinite alternate;
}

@keyframes pulse-glow {
    0% {
        transform: translate(-50%, -50%) scale(0.95);
        opacity: 0.6;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
}

.hero-visual img {
    width: 100%;
    height: auto;
    /* Fit the container */
    max-width: none;
    /* Remove artificial max-width */
    margin: 0 auto;
    border-radius: 0;
    box-shadow: none;
    display: block;
    background: transparent;
    transition: transform 0.5s ease;
    position: relative;
    z-index: 2;
}

.hero-visual:hover img {
    transform: scale(1.02);
}

/* Buttons */
.cta-group {
    display: flex;
    gap: 20px;
    margin-top: 40px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 40px;
    /* Wider for pill shape */
    border-radius: 50px;
    /* Pill Shape */
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-text {
    color: var(--color-text);
    padding: 14px 32px;
    background: transparent;
    border: 1px solid var(--color-border);
    /* Subtle border for pill shape visibility */
}

.btn-text:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Features - Minimalist Cards */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
}

.feature-item {
    background: var(--color-bg);
    padding: 40px;
    border-radius: 20px;
    /* Softer card corners */
    transition: all 0.3s;
    border: 1px solid transparent;
}

.feature-item:hover {
    border-color: var(--color-border);
    box-shadow: 0 10px 30px var(--shadow-color);
    transform: translateY(-5px);
}

.icon-lg {
    font-size: 3rem;
    color: var(--color-primary);
    margin-bottom: 24px;
    display: block;
}

/* Services */
.service-block {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 100px;
    align-items: center;
    margin-bottom: 160px;
}

.service-block:last-child {
    margin-bottom: 0;
}

.service-block.reverse .service-visual {
    order: 1;
}

.service-block.reverse .service-info {
    order: 2;
}

.service-visual img {
    width: 100%;
    height: auto;
    /* Pure graphic look */
    border-radius: 0;
    box-shadow: none;
    background: transparent;
}

.service-list {
    list-style: none;
    margin-top: 32px;
}

.service-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-weight: 500;
}

.service-list i {
    color: var(--color-primary);
    font-size: 1.25rem;
}

/* Partners Options */
.partner-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
    margin-top: 40px;
}

.partner-item {
    background: var(--color-bg);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 4px 6px var(--shadow-color);
    text-align: center;
    transition: transform 0.3s ease;
    border: 1px solid var(--color-border);
}

@media (prefers-color-scheme: dark) {
    .partner-item {
        background: var(--color-bg-alt);
    }
}

html.dark .partner-item,
:root.dark .partner-item {
    background: var(--color-bg-alt);
}


.partner-item:hover {
    transform: translateY(-5px);
}

.partner-logo-wrapper {
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.partner-logo {
    max-height: 100%;
    max-width: 100%;
    object-fit: contain;
    border-radius: 12px;
    /* Soft rounded corners */
}

.partner-description {
    color: var(--color-text-light);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

.partner-actions .secondary-button {
    display: inline-block;
    padding: 8px 20px;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 50px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
}

.partner-actions .secondary-button:hover {
    background: var(--color-primary);
    color: white;
}

.partner-tag {
    display: none;
}

/* Contact CTA */
.contact-section {
    text-align: center;
    background: linear-gradient(135deg, var(--color-primary) 0%, #1d4ed8 100%);
    color: white;
    border-radius: 30px;
    /* Softer rounded section */
    margin: 80px 24px;
    width: auto;
    padding: 80px 40px;
}

.contact-layout h2 {
    color: white;
}

.contact-layout h2::after {
    background: white;
}

.contact-layout p {
    color: rgba(255, 255, 255, 0.9);
}

.contact-action .btn-primary {
    background: white;
    color: var(--color-primary);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
}

.contact-action .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.contact-email {
    margin-top: 20px;
    color: white;
    font-weight: 600;
}

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

.footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 40px;
}

.social-links {
    display: flex;
    gap: 24px;
}

.social-link {
    color: var(--color-text-light);
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-link:hover {
    color: var(--color-primary);
    transform: translateY(-3px);
}

.footer-info {
    text-align: center;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

.footer-info p {
    margin-bottom: 8px;
}

/* Animations */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger Utilities */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.delay-100 {
    transition-delay: 0.1s;
}

.delay-200 {
    transition-delay: 0.2s;
}

.delay-300 {
    transition-delay: 0.3s;
}

.delay-400 {
    transition-delay: 0.4s;
}

.delay-500 {
    transition-delay: 0.5s;
}

/* Micro-interactions */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px var(--shadow-color);
}

/* Responsive */
@media (max-width: 960px) {

    .hero-layout,
    .service-block {
        grid-template-columns: 100%;
        width: 100%;
        text-align: center;
        gap: 60px;
    }

    /* Fixed: Hero image centering based on bounding box debug */
    .hero-visual {
        justify-content: center;
        display: flex;
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }

    .hero-visual img {
        margin-left: auto;
        margin-right: auto;
        max-width: 100%;
        height: auto;
        display: block;
        transform: translateX(-25px);
        /* Optical Alignment: Shift Left to balance visual center */
        transition: none;
        /* Disable transition on mobile */
    }

    /* Disable hover animation on mobile to prevent jumping */
    .hero-visual:hover img {
        transform: translateX(-25px);
    }

    .hero {
        padding-top: 140px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    /* Fixed: Heading underline centered */
    .center-text h2::after,
    h2::after {
        margin-left: auto;
        margin-right: auto;
        left: auto;
        transform: none;
    }

    .contact-section {
        margin: 40px 16px;
    }

    .features-grid,
    .partner-grid {
        grid-template-columns: 1fr;
    }

    /* Fixed: Services Info (Top) -> Image (Bottom) */
    .service-block .service-info,
    .service-block.reverse .service-info {
        order: 1;
    }

    .service-block .service-visual,
    .service-block.reverse .service-visual {
        order: 2;
    }

    .service-list li {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }

    .mobile-toggle {
        display: block;
    }

    .theme-toggle {
        margin-right: 16px;
        margin-left: auto;
    }

    .cta-group {
        flex-direction: column;
        align-items: center;
    }

    .footer-content {
        flex-direction: column;
        gap: 40px;
        text-align: center;
    }
}