/* --- Global Variables & Reset (v3 - Consistent Cards) --- */
:root {
    --primary-color: #ffb703;      /* Amber/Gold Accent */
    --secondary-color: #023047;   /* Dark Slate Blue */
    --accent-color: #2ab7ca;       /* Brighter Cyan */
    --text-color: #023047;         /* Dark Slate Blue for text */
    --text-light: #495057;         /* Darkened Gray for better readability */
    --bg-color: #ffffff;
    --bg-light: #f8f9fa;
    --border-color: #e9ecef;       /* Slightly softer border color */
    --shadow-sm: 0 2px 4px rgba(2, 48, 71, 0.05);
    --shadow-md: 0 4px 8px rgba(2, 48, 71, 0.07);
    --shadow-lg: 0 10px 20px rgba(2, 48, 71, 0.1);
    --radius-md: 8px;
    --radius-lg: 12px;
    --transition: all 0.3s ease-in-out;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: 'Noto Sans TC', 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Layout & Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

section {
    padding: 100px 0;
}

.bg-light {
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
}

/* --- Typography --- */
h1, h2, h3, h4 {
    font-family: 'Poppins', 'Noto Sans TC', sans-serif;
    font-weight: 700;
    line-height: 1.3;
}
h1 { font-size: 3.5rem; }
h2 { font-size: 2.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.25rem; }
p { color: var(--text-light); margin-bottom: 1rem; }

.section-header {
    text-align: center;
    margin-bottom: 60px;
}
.section-tag {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 12px;
}
.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* --- Components: Buttons --- */
.btn {
    padding: 12px 28px;
    border-radius: 50px;
    transition: var(--transition);
    display: inline-block;
    font-weight: 600;
    text-decoration: none;
    border: 2px solid transparent;
    cursor: pointer;
}
.btn-primary {
    background-color: var(--primary-color);
    color: var(--secondary-color);
    box-shadow: var(--shadow-md);
}
.btn-primary:hover {
    background-color: #ffc740;
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}
.btn-secondary {
    background-color: transparent;
    color: var(--secondary-color);
    border-color: var(--secondary-color);
}
.btn-secondary:hover {
    background-color: var(--secondary-color);
    color: white;
}
.btn-outline {
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    font-weight: 500;
    padding: 8px 20px;
}
.btn-outline:hover {
    background-color: var(--accent-color);
    color: white;
}

/* --- Navigation --- */
nav {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
    border-bottom: 1px solid var(--border-color);
}
.nav-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 80px;
}
.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary-color);
    text-decoration: none;
}
nav ul {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 32px;
}
nav ul a {
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
    text-decoration: none;
    position: relative;
    padding-bottom: 5px;
}
nav ul a:not(.btn)::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 50%;
    background-color: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}
nav ul a:hover:not(.btn) { color: var(--secondary-color); }
nav ul a:hover:not(.btn)::after { width: 100%; }

/* --- Mobile Menu --- */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}
.icon-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--secondary-color);
    margin: 5px 0;
    transition: var(--transition);
}
.mobile-menu-toggle.active .icon-bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.mobile-menu-toggle.active .icon-bar:nth-child(2) { opacity: 0; }
.mobile-menu-toggle.active .icon-bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }


/* --- Hero Section --- */
.hero {
    background-color: var(--bg-light);
    padding: 120px 0;
    border-bottom: 1px solid var(--border-color);
}
.hero-content {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 64px;
}
.hero-subtitle {
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: block;
}
.hero-text p {
    font-size: 1.1rem;
    max-width: 500px;
}
.hero-buttons {
    margin-top: 32px;
    display: flex;
    gap: 16px;
}
.hero-image-container {
    position: relative;
}
.hero-image {
    width: 100%;
    max-width: 350px;
    border-radius: 50%;
    border: 8px solid white;
    box-shadow: var(--shadow-lg);
    z-index: 1;
    position: relative;
    margin: 0 auto;
    display: block;
}
.hero-image-container::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    height: 90%;
    background-color: var(--primary-color);
    border-radius: 50%;
    opacity: 0.2;
    z-index: 0;
}

/* --- Components: Cards & Grids --- */
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.grid-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px; }

.card {
    background: var(--bg-color);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}
.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}
.card h3 { color: var(--secondary-color); margin-bottom: 1rem; }
.card ul { list-style: none; padding-left: 0; }
.card li {
    padding: 4px 0 4px 28px;
    position: relative;
    color: var(--text-light);
}
.card li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}
.card strong { color: var(--text-color); }

/* --- Stats Section --- */
.stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 60px;
    flex-wrap: wrap;
}
.stat-item {
    text-align: center;
    padding: 24px;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    min-width: 220px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}
.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--secondary-color);
}
.stat-label { color: var(--text-light); font-weight: 500; }

/* --- AI Showcase Section (v3 - Consistent Card Layout) --- */
.ai-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 32px;
    align-items: stretch; /* Ensures cards in a row have same height */
}
.ai-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.ai-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}
/* New container for consistent media height */
.ai-card-media {
    height: 220px;
    background-color: #000;
    position: relative;
    overflow: hidden;
}
.ai-card-content {
    padding: 24px;
    flex-grow: 1; /* Allows content area to fill remaining space */
    display: flex;
    flex-direction: column;
}
.ai-card-content h3 {
    font-size: 1.125rem;
    color: var(--secondary-color);
}
.ai-card-content p {
    color: var(--text-light);
    flex-grow: 1; /* Pushes title up if content is short */
    margin-top: 0.5rem;
}
.video-wrapper, .interactive-ad-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}
.video-wrapper iframe {
    width: 100%;
    height: 100%;
    border: 0;
}
/* Adjust vertical video to fit, not stretch */
.video-wrapper-vertical iframe {
    object-fit: cover;
}
.interactive-ad-preview {
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}
.interactive-ad-preview .play-icon { font-size: 3rem; }
.interactive-ad-preview h3 { color: white; margin-top: 1rem; }
.interactive-ad-preview p { color: white; margin: 0; opacity: 0.9; }


/* --- Research Section --- */
.research-paper {
    background: white;
    border-radius: var(--radius-lg);
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    display: flex;
    gap: 32px;
    align-items: flex-start;
}
.paper-icon { font-size: 3rem; color: var(--accent-color); }
.paper-content { flex-grow: 1; }
.research-paper h3 { color: var(--secondary-color); font-size: 1.5rem; }
.paper-meta { color: var(--text-light); margin-bottom: 1.5rem; font-style: italic; font-size: 0.9rem; }
.paper-abstract p { color: var(--text-light); }
.paper-links { margin-top: 32px; display: flex; gap: 16px; flex-shrink: 0; flex-direction: column;}

/* --- About Section --- */
.about-content {
    max-width: 900px;
    margin: 0 auto;
}
.about-intro {
    font-size: 1.2rem;
    color: var(--text-color);
}
.about-quote {
    font-size: 1.1rem;
    font-style: italic;
    padding: 20px;
    margin: 30px 0;
    border-left: 4px solid var(--primary-color);
    background-color: white;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.skill-card {
    background-color: white;
    padding: 24px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    height: 100%;
}
.skill-card h4 { color: var(--accent-color); }
.skill-card ul { list-style: none; padding: 0; }
.skill-card li { margin-bottom: 8px; color: var(--text-light); }

/* --- Blog Preview Section --- */
.blog-card {
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    padding: 24px;
    text-decoration: none;
    color: inherit;
}
.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}
.blog-date { color: var(--text-light); font-size: 0.875rem; }
.blog-title {
    font-size: 1.2rem;
    color: var(--secondary-color);
    margin: 0.5rem 0 1rem 0;
}
.blog-excerpt { margin-bottom: 1.5rem; flex-grow: 1; }
.blog-read-more {
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
}
.view-all-center { text-align: center; margin-top: 60px; }

/* --- Projects Section --- */
.project-card {
    background: white;
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.project-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}
.project-card h4 {
    color: var(--secondary-color);
    font-size: 1.2rem;
}
.project-card p { flex-grow: 1; margin: 1rem 0; }
.project-link {
    font-weight: 600;
    color: var(--accent-color);
    text-decoration: none;
    align-self: flex-start;
}

/* --- Contact Section --- */
.contact-box {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px;
    background: linear-gradient(135deg, var(--secondary-color), #023e5a);
    color: white;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}
.contact-box h2 { color: white; }
.contact-box p { color: white; opacity: 0.8; }
.contact-info { margin: 30px 0; }
.contact-info p { margin-bottom: 0.5rem; }
.contact-info a { color: var(--primary-color); text-decoration: none; transition: var(--transition); }
.contact-info a:hover { color: #ffc740; }
.contact-socials { display: flex; justify-content: center; gap: 24px; margin-top: 30px; }
.contact-socials a {
    color: white;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}
.contact-socials a:hover { color: var(--primary-color); }

/* --- Footer --- */
footer {
    background: var(--secondary-color);
    color: white;
    text-align: center;
    padding: 40px 24px;
    margin-top: 100px;
}
footer p { color: white; opacity: 0.7; margin: 0; }

/* --- Animations --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive Design --- */
@media (max-width: 1024px) {
    h1 { font-size: 3rem; }
    h2 { font-size: 2.2rem; }
    .grid-3col { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
    .hero-content { grid-template-columns: 1fr; text-align: center; }
    .hero-text p { margin: 0 auto 1rem auto; }
    .hero-buttons { justify-content: center; }
    .hero-image-container { order: -1; margin-bottom: 40px; }
    .research-paper { flex-direction: column; align-items: center; text-align: center; }
    .paper-links { flex-direction: row; justify-content: center; }
}

@media (max-width: 768px) {
    /* Mobile Navigation */
    .mobile-menu-toggle { display: block; }
    nav ul {
        display: none;
        position: absolute;
        top: 80px;
        left: 0;
        right: 0;
        background: white;
        flex-direction: column;
        padding: 24px;
        box-shadow: var(--shadow-lg);
        gap: 0;
        border-top: 1px solid var(--border-color);
    }
    nav ul.active { display: flex; }
    nav ul li { width: 100%; text-align: center; }
    nav ul a { padding: 16px 0; display: block; width: 100%; }
    nav ul a:not(.btn)::after { display: none; }
    
    section { padding: 80px 0; }
    h1 { font-size: 2.5rem; }
    .grid-2col { grid-template-columns: 1fr; }
    .stats { gap: 16px; }
    .stat-item { min-width: 180px; }
    .contact-box { padding: 40px 24px; }
}