/* --- 1. 全局樣式與重設 --- */
:root {
    --card-border-radius: 16px;
    --card-bg-color: rgba(255, 255, 255, 0.6);
    --card-border-color: rgba(255, 255, 255, 0.5);
    --card-backdrop-blur: 18px;
    --text-primary: #1a1a1a;
    --text-secondary: #4d4d4d;
    --accent-color: #FD8E07;
    --page-bg: #FEFBF6;
    --font-family-sans: 'Montserrat', 'Noto Sans TC', sans-serif;
}

html {
    scroll-behavior: smooth;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: var(--font-family-sans); color: var(--text-primary); background-color: var(--page-bg); line-height: 1.6; -webkit-font-smoothing: antialiased; }

/* --- 2. Hyperspace Canvas 背景 --- */
#hyperspace-canvas {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    background-color: transparent;
}

/* --- 3. 玻璃卡片組件 (已精修) --- */
.glass-card {
    background-color: var(--card-bg-color);
    backdrop-filter: blur(var(--card-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--card-backdrop-blur));
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-border-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    position: relative;
    transform: translateY(0);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 1);
    transform: translateY(-8px) scale(1.05) !important;
}

/* --- 4. 佈局與通用組件 --- */
.page-wrapper { position: relative; z-index: 2; max-width: 1200px; margin: 0 auto; padding: 0 24px; }
header {
    position: fixed;
    top: 0;
    left: 0; /* Ensure it starts from the very left */
    z-index: 1000;
    width: 100%;
    
    /* Add a nice glassy effect */
    background-color: rgba(254, 251, 246, 0.8); /* var(--page-bg) with transparency */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    /* Keep original layout properties */
    padding: 24px 0; 
}

header .page-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px; /* Re-apply padding here */
}

main {
    /* Offset the content to prevent it from being hidden by the fixed header */
    padding-top: 100px; 
}
.logo { font-weight: 700; font-size: 1.5rem; color: var(--text-primary); text-decoration: none; }
nav a { margin-left: 32px; text-decoration: none; color: var(--text-secondary); font-weight: 500; transition: color 0.2s ease; }
nav a:hover { color: var(--text-primary); }
.section { padding: 120px 0; }
h1, h2, h3 { color: var(--text-primary); font-weight: 700; }
h1 { font-size: 3.5rem; line-height: 1.2; margin-bottom: 24px; }
.animated-gradient-text { background: linear-gradient(90deg, var(--accent-color), #FFDD88, var(--accent-color)); background-size: 200% auto; color: transparent; background-clip: text; -webkit-background-clip: text; animation: flow-gradient 1.5s linear infinite; }
@keyframes flow-gradient { to { background-position: -200% center; } }
h2 { font-size: 2.5rem; margin-bottom: 24px; }
h3 { font-size: 1.5rem; margin-bottom: 12px; }
.section-subtitle { font-size: 1.125rem; color: var(--text-secondary); max-width: 700px; margin-bottom: 32px; }
.btn { display: inline-block; padding: 14px 32px; border-radius: 50px; text-decoration: none; font-weight: 700; transition: transform 0.2s ease, box-shadow 0.2s ease; border: 2px solid transparent; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); }
.btn-primary { background-color: var(--accent-color); color: white; }
.btn-secondary { background-color: transparent; color: var(--text-primary); border-color: var(--text-primary); }

/* New style for active buttons */
.btn.btn-active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(253, 142, 7, 0.5); /* A subtle glow */
}

.button-group { display: flex; gap: 16px; }

/* --- 5. 特定區塊樣式 --- */
.hero-section { display: flex; align-items: center; gap: 64px; min-height: calc(100vh - 100px); padding: 40px 0; }
.hero-content { flex: 1; text-align: left; }
.hero-content .section-subtitle { margin-left: 0; }
.hero-visual { flex: 1; display: flex; justify-content: center; align-items: center; }
.phone-mockup { width: 300px; height: 610px; background: #1C1C1E; border-radius: 40px; border: 12px solid #111; box-shadow: 0 20px 50px rgba(0,0,0,0.3); display: flex; justify-content: center; align-items: center; position: relative; transform: rotateZ(-5deg); }
.mockup-screen { width: 100%; height: 100%; background: #000; border-radius: 28px; overflow: hidden; position: relative; }

.demo-video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Ensures the video covers the screen without distortion */
}

.mockup-screen::before { content: ''; position: absolute; top: 15px; left: 50%; transform: translateX(-50%); width: 100px; height: 25px; background: #111; border-radius: 20px; }
.mockup-content { display: flex; justify-content: center; align-items: center; height: 100%; flex-direction: column; gap: 20px; color: rgba(255,255,255,0.7); }
.mockup-content svg { width: 80px; height: 80px; }
@keyframes wave { 0%, 100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }
.waveform { display: flex; gap: 4px; }
.waveform div { width: 4px; height: 50px; background: var(--accent-color); animation: wave 1.2s ease-in-out infinite; }
.waveform div:nth-child(2) { animation-delay: 0.2s; } .waveform div:nth-child(3) { animation-delay: 0.4s; } .waveform div:nth-child(4) { animation-delay: 0.6s; } .waveform div:nth-child(5) { animation-delay: 0.8s; }

.problem-section { text-align: center; }
.problem-section .section-subtitle { margin: 0 auto 32px auto; }
.problem-section-cards { display: flex; flex-wrap: wrap; justify-content: center; gap: 32px; margin-top: 64px; }
.problem-section-cards .glass-card { padding: 40px 24px; flex: 1 1 320px; max-width: 350px; }
.problem-section-cards .icon { height: 48px; width: 48px; margin-bottom: 24px; color: var(--text-primary); }

/* --- Data Showcase Section --- */
.data-showcase-section .container {
    text-align: center;
}

.data-showcase-section .intro-text {
    max-width: 700px;
    margin: 0 auto 48px auto;
    color: var(--text-secondary);
}

.data-features-grid {
    display: flex;
    gap: 32px;
    align-items: stretch; /* Key for equal height cards */
    text-align: left;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

.feature-card {
    flex: 1 1 300px; /* Flex grow, shrink, and basis */
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg-color);
    backdrop-filter: blur(var(--card-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--card-backdrop-blur));
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-border-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    padding: 32px 24px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

.feature-text-content {
    flex-grow: 1; /* Allows this to grow, pushing the visual to the bottom */
}

.feature-card h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--accent-color);
}

.feature-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.feature-visual {
    flex-shrink: 0; /* Prevents the visual box from shrinking */
    background-color: #1C1C1E; /* Dark background for the code */
    border-radius: 12px;
    overflow: hidden;
    height: 300px; /* Fixed height for the visual box */
    display: flex; /* Use flex to make the pre take full height */
}

.data-box {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 16px;
    font-size: 0.7rem; /* Smaller font for dense data */
    line-height: 1.6;
    color: #EAEAEA; /* Light text on dark background */
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
    background-color: transparent;
    font-family: 'SF Mono', 'Fira Code', 'Roboto Mono', monospace;
}

/* Custom Scrollbar for Data Box */
.data-box::-webkit-scrollbar {
    width: 6px;
}

.data-box::-webkit-scrollbar-track {
    background: transparent;
}

.data-box::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
}

/* Custom font sizes for titles as per user request */
.data-showcase-section h3[data-lang="data-showcase-subtitle"] {
    font-size: 2.2rem;
}

.data-vis-section h2[data-lang="data-vis-title"] {
    font-size: 1.8rem;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.feature-list li {
    background-color: var(--card-bg-color);
    backdrop-filter: blur(var(--card-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--card-backdrop-blur));
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-border-radius);
    padding: 32px 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), border-color 0.3s ease;
    text-align: left;
    height: 100%; /* Make cards in a row equal height */
}

.feature-list li:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.5);
}

.feature-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 24px;
    color: var(--accent-color);
}

.feature-list h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--accent-color);
}

.feature-list p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.btn-dataspec {
    margin-top: 48px;
}

.contribute-section { text-align: center; }
.contribute-section .section-subtitle { margin: 0 auto 32px auto; }
.contribute-steps { display: flex; justify-content: center; gap: 32px; margin-top: 64px; }
.contribute-steps .glass-card { flex: 1; }
.step-number { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); background-color: var(--accent-color); color: white; width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 1.2rem; border: 4px solid var(--page-bg); }

.about-section { display: flex; align-items: center; gap: 64px; }
.about-content { flex: 1; text-align: left; }
.about-content .section-subtitle { margin-left: 0; }
.about-content p { max-width: 500px; }
.about-visual { flex: 1; }
.visual-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-item img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--card-border-radius); box-shadow: 0 8px 24px rgba(0,0,0,0.1); }
.grid-item:nth-child(1) { transform: rotate(-5deg); }
.grid-item:nth-child(2) { transform: rotate(3deg) translateY(20px); }
.grid-item:nth-child(3) { transform: rotate(4deg) translateY(-10px); }
.grid-item:nth-child(4) { transform: rotate(-2deg) translateY(10px); }

.contact-section { text-align: center; }
.contact-section .section-subtitle { margin: 0 auto 48px auto; }
.contact-form { max-width: 600px; margin: 0 auto; }
.form-group { position: relative; margin-bottom: 24px; }
.form-group input, .form-group textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--card-border-color);
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.5);
    font-size: 1rem;
    font-family: var(--font-family-sans);
    color: var(--text-primary);
    transition: border-color 0.2s ease;
}
.form-group input:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}
.form-group label {
    position: absolute;
    top: 16px;
    left: 16px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: all 0.2s ease;
}
.form-group input:focus + label, 
.form-group input:not(:placeholder-shown) + label, 
.form-group textarea:focus + label, 
.form-group textarea:not(:placeholder-shown) + label {
    top: -10px;
    left: 12px;
    font-size: 0.8rem;
    color: var(--accent-color);
    background-color: var(--page-bg);
    padding: 0 4px;
}
.contact-form button {
    width: 100%;
}

footer { padding: 48px 0; text-align: center; border-top: 1px solid rgba(0, 0, 0, 0.05); margin-top: 80px; }
footer p { color: var(--text-secondary); font-size: 0.9rem; }

/* --- Data Visualization Section --- */
.data-vis-section {
    text-align: center;
    margin-top: -60px;
}

.data-vis-container {
    display: flex;
    gap: 16px;
    align-items: stretch; /* Make columns equal height */
    text-align: left;
    margin-top: 64px;
}

.data-vis-video-wrapper {
    flex: 2;
    min-width: 0; /* Prevents flex item from overflowing */
    background: #111;
    border-radius: var(--card-border-radius);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    height: 450px;
}

.data-vis-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.data-vis-text-card {
    flex: 4;
    min-width: 0;
    height: 450px;
    background-color: var(--card-bg-color);
    backdrop-filter: blur(var(--card-backdrop-blur));
    -webkit-backdrop-filter: blur(var(--card-backdrop-blur));
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-border-radius);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Ensures border-radius is respected by children */
}

.data-vis-text-header {
    padding: 12px 24px;
    border-bottom: 1px solid var(--card-border-color);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
    background-color: rgba(255, 255, 255, 0.2);
}

.data-vis-text-header h4 {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0;
}

.data-vis-title-icon {
    width: 20px;
    height: 20px;
    color: var(--accent-color);
    flex-shrink: 0;
}

.data-vis-text-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 24px;
    font-size: 0.75rem; /* Final font size to 8px */
    line-height: 1.7;
    color: var(--text-secondary);
}

/* Custom Scrollbar Styling */
.data-vis-text-content::-webkit-scrollbar {
    width: 8px;
}

.data-vis-text-content::-webkit-scrollbar-track {
    background: transparent;
}

.data-vis-text-content::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.data-vis-text-content::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* --- 6. 滾動觸發動畫 --- */
.animated-card {
    opacity: 0;
    transform: translateY(50px);
    transition: opacity 0.8s cubic-bezier(0.23, 1, 0.32, 1), transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}
.animated-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.animated-card:nth-child(2).is-visible { transition-delay: 0.15s; }
.animated-card:nth-child(3).is-visible { transition-delay: 0.3s; }





/* --- 8. 響應式設計 --- */
@media (max-width: 992px) {
    .hero-section { flex-direction: column; text-align: center; min-height: auto; padding: 80px 0; }
    .hero-content { text-align: center; }

    .data-vis-container {
        flex-direction: column;
        align-items: center;
    }

    .data-vis-video-wrapper,
    .data-vis-text-card {
        width: 100%;
        max-width: 600px; /* Optional: constrain width on tablets */
        height: auto; /* Override fixed height on mobile */
    }

    .data-vis-text-card {
        max-height: 300px; /* Adjust height for smaller screens */
        /* This rule is redundant as it's already covered above, but it's harmless. */
    }
    .button-group { justify-content: center; }
    .hero-visual { margin-top: 60px; }
    .phone-mockup { width: 260px; height: 530px; transform: rotateZ(0); }
    
}
@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    nav { display: none; }

    .contribute-steps {
        flex-direction: column;
    }
}

/* --- 7. New Privacy Section (V2) --- */
.privacy-section-v2 {
    padding-top: 80px;
    text-align: center;
}

.privacy-section-v2 .section-subtitle {
    margin: 0 auto 48px auto;
}

.privacy-core-commitments {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 64px;
    flex-wrap: wrap;
}

.privacy-core-commitments .glass-card {
    flex: 1 1 400px; /* Allow wrapping on smaller screens */
    max-width: 450px;
    padding: 32px;
    text-align: left;
}

.privacy-card-icon {
    margin-bottom: 24px;
    color: var(--accent-color);
}

.timeline-container {
    max-width: 800px;
    margin: 64px auto 0 auto;
    padding: 48px;
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid var(--card-border-color);
    border-radius: var(--card-border-radius);
}

.timeline-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 48px;
}

.timeline {
    position: relative;
    padding: 20px 0;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 23px; /* (48px icon width / 2) - 1px */
    height: 100%;
    width: 2px;
    background: rgba(253, 142, 7, 0.2);
}

.timeline-item {
    display: flex;
    gap: 24px;
    margin-bottom: 48px;
    position: relative;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--page-bg);
    border: 2px solid rgba(253, 142, 7, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-color);
    z-index: 1;
}

.timeline-content {
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: var(--card-border-radius);
    padding: 24px;
    flex-grow: 1;
}

.timeline-content h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.7;
}


/* --- Responsive for Privacy V2 --- */
@media (max-width: 992px) {
    .privacy-core-commitments {
        flex-direction: column;
        align-items: center;
    }
}
@media (max-width: 768px) {
    .timeline-container {
        padding: 32px 24px;
    }

    .timeline::before {
        left: 50%;
        transform: translateX(-50%);
    }
    .timeline-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .timeline-content {
        width: 100%;
    }
}

.privacy-button-container {
    margin-top: 48px;
    text-align: center;
}

/* --- Scroll-triggered Mask and Title Animation --- */
#privacy-scroll-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent;
    z-index: 1; /* Behind content, above particles */
    pointer-events: none; /* Make sure it doesn't block clicks */
    transition: background-color 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

#privacy-scroll-mask.active {
    background-color: rgba(0, 0, 0, 0.6);
}

.privacy-section-v2 h2[data-lang="privacy-v2-title"] {
    color: var(--text-primary);
    text-shadow: none;
    transition: color 0.8s cubic-bezier(0.4, 0, 0.2, 1), text-shadow 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.privacy-section-v2.is-active h2[data-lang="privacy-v2-title"] {
    color: #FFFFFF;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.7);
}

/* --- Dark Mode Adjustments for Privacy Section --- */
.privacy-section-v2.is-active .section-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

.privacy-section-v2.is-active .privacy-core-commitments .glass-card {
    background-color: rgba(30, 30, 30, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
}

.privacy-section-v2.is-active .glass-card h3,
.privacy-section-v2.is-active .glass-card p {
    color: #FFFFFF;
}

.privacy-section-v2.is-active .timeline-container {
    background-color: rgba(30, 30, 30, 0.7);
    border-color: rgba(255, 255, 255, 0.3);
}

.privacy-section-v2.is-active .timeline-title {
    color: #FFFFFF;
}

.privacy-section-v2.is-active .timeline-content {
    background-color: rgba(0, 0, 0, 0.3);
}

.privacy-section-v2.is-active .timeline-content h4 {
    color: #FFFFFF;
}

.privacy-section-v2.is-active .timeline-content p {
    color: rgba(255, 255, 255, 0.85);
}

.privacy-section-v2.is-active .timeline-icon {
    border-color: var(--accent-color);
    background-color: rgba(253, 142, 7, 0.2);
}

.privacy-section-v2.is-active .btn-secondary {
    color: #FFFFFF;
    border-color: #FFFFFF;
}