@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Premium Lab Identity */
    --primary-text: #1d1d1f;        /* Apple-like almost black */
    --secondary-text: #6e6e73;      /* Apple-like grey */
    --accent-color: #11856c;        /* Lab Green - Preserved */
    --accent-hover: #0d6e59;
    --accent-gradient: linear-gradient(135deg, #11856c 0%, #005a49 100%);
    
    /* Backgrounds */
    --bg-body: #f5f5f7;             /* Apple-like light grey background */
    --bg-card: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.72);
    
    /* Spacing & Layout */
    --container-width: 1200px;
    --header-height: 70px;     /* Larger, more prominent header */
    
    /* UI Elements */
    --radius-sm: 8px;
    --radius-md: 18px;         /* Larger, softer corners */
    --radius-lg: 24px;
    
    /* Shadows - Soft & Diffused */
    --shadow-card: 0 4px 24px rgba(0,0,0,0.04);
    --shadow-hover: 0 8px 32px rgba(0,0,0,0.08);
    
    /* Animation Timing */
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1); /* Physics-based feel */
}

/* Theme Overrides */
body.care-theme {
    --accent-color: #e67e22;
    --accent-hover: #d35400;
    --accent-gradient: linear-gradient(135deg, #e67e22 0%, #d35400 100%);
    --accent-light: #fff5e6; /* Lighter background for banner base */
}

body.hear-theme {
    --accent-color: #3498db;
    --accent-hover: #2980b9;
    --accent-gradient: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    --accent-light: #e6f3ff;
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: "Inter", "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
    color: var(--primary-text);
    background-color: var(--bg-body);
    font-size: 17px; /* Larger base font size */
    overflow-x: hidden;
}

/* Typography Overhaul */
h1, h2, h3 {
    margin-top: 0;
    letter-spacing: -0.025em; /* Premium tight tracking */
}

h1 {
    font-size: 48px;
    font-weight: 700;
    line-height: 1.1;
    color: #1d1d1f;
}

h2 {
    font-size: 40px;
    font-weight: 600;
    margin-bottom: 40px;
}

h3 {
    font-size: 24px;
    font-weight: 600;
    color: #1d1d1f;
}

p {
    color: var(--secondary-text);
    font-size: 19px; /* Highly readable body text */
    line-height: 1.5;
    margin-bottom: 1.5em;
    font-weight: 400;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    text-decoration: underline;
}

/* Header - Sleek & Translucent */
header {
    background-color: var(--bg-glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky;
    top: 0;
    z-index: 9999;
    height: var(--header-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    transition: background-color 0.3s ease;
}

.header-container {
    max-width: var(--container-width);
    margin: 0 auto;
    width: 100%;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    height: 50px; /* Larger branding */
    width: auto;
    display: block;
}

nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    gap: 32px;
}

nav a {
    color: #484848;
    font-size: 16px; /* Larger, more readable nav */
    font-weight: 500;
    letter-spacing: -0.01em;
    transition: all 0.2s ease;
    padding: 8px 16px;
    border-radius: 20px;
}

nav a:hover, nav a.active {
    color: #fff;
    background-color: var(--accent-color); /* Uses theme variable */
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Main Layout */
.intro-banner {
    background-color: var(--accent-light, var(--accent-color)); /* Fallback or use light var */
    /* Use the gradient variable defined in root or theme */
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.1), transparent 40%),
                var(--accent-gradient);
    padding: 120px 0 160px;
    text-align: center;
    position: relative;
    overflow: hidden;
    color: #fff;
}

/* Ensure headings in banner are white */
.intro-banner h1, .intro-banner p {
    color: #fff !important;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Subtle texture for banner */
.intro-banner::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    /* Clean, modern grid overlay */
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 40px 40px;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 980px;
    margin: 0 auto;
    padding: 0 24px;
}

.hero-content h1 {
    font-size: 56px;
    line-height: 1.05;
    margin-bottom: 24px;
    color: #ffffff;
    /* Text Shadow for better contrast on green */
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero-content p {
    font-size: 24px;
    line-height: 1.4;
    max-width: 800px;
    margin: 0 auto;
    color: rgba(255, 255, 255, 0.9);
}

/* Content Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 24px 100px;
}

/* Sections */
section {
    position: relative;
    margin-bottom: 80px;
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
}

.section-divider {
    border: 0;
    height: 1px;
    background: #e5e5e5;
    margin: 80px 0;
    width: 60%;
    margin-left: auto;
    margin-right: auto;
}

/* Bento Grid System for Research Cards */
.research-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); /* Fixed 2x2 Layout */
    gap: 24px;
}

.research-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    box-shadow: var(--shadow-card);
    transition: transform 0.4s var(--ease-out-expo), box-shadow 0.4s var(--ease-out-expo);
    border: 1px solid rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
    height: 100%;
    cursor: default;
}

.research-card:hover {
    transform: scale(1.02); /* Subtle apple-style zoom */
    box-shadow: var(--shadow-hover);
    z-index: 5;
}

.research-card h3 {
    font-size: 22px;
    margin-bottom: 16px;
    color: #1d1d1f;
}

.research-card p {
    font-size: 16px;
    color: #86868b;
    margin: 0;
    flex-grow: 1;
}

/* Impact Section - Large rounded container */
.impact-section {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    box-shadow: var(--shadow-card);
}

.publication-list {
    margin-top: 40px;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 20px;
}

.publication-item {
    padding: 24px;
    background: #fbfbfd; /* Very subtle background */
    border-radius: var(--radius-md);
    border: 1px solid rgba(0,0,0,0.03);
    font-size: 16px;
    color: #424245;
    word-wrap: break-word; /* Prevents overflow on mobile */
    overflow-wrap: break-word;
    word-break: break-word;
}

.publication-item strong {
    color: var(--accent-color);
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 17px;
}

/* Team Member Photo Consistency */
.team-member {
    display: flex;
    flex-wrap: wrap;
    margin-bottom: 40px;
    background-color: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,0,0,0.04);
}

.member-photo {
    flex: 0 0 200px;
    /* height: 250px; Removed to allow stretch with content */
    overflow: hidden;
    position: relative; /* Context */
}

.member-photo img, .placeholder-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%; /* Focus more on faces */
    background-color: #f0f4f8; 
    position: absolute; /* Absolute positioning to fill the flex container strictly */
    top: 0;
    left: 0;
}

.member-info {
    flex: 1;
    padding: 30px;
    min-width: 300px;
}

.member-info h4 {
    color: var(--primary-text);
    margin-top: 0;
    margin-bottom: 5px;
    font-size: 1.4rem;
    font-weight: 700;
}

.member-title {
    color: var(--secondary-text);
    font-style: italic;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.member-bio {
    line-height: 1.6;
    font-size: 16px;
}

.research-interests {
    margin-top: 15px;
    font-size: 15px;
    color: var(--secondary-text);
}

.research-interests strong {
    color: var(--accent-color);
}

@media (max-width: 768px) {
    .member-photo {
        flex: 0 0 100%;
        height: 280px; 
    }
}

/* Dr. Dong Bio Box */
.director-bio {
    margin-top: 40px;
    background: linear-gradient(135deg, #f5f5f7 0%, #eeeeee 100%);
    padding: 30px;
    border-radius: var(--radius-md);
    font-size: 16px;
    color: #424245;
}

/* Footer */
footer {
    background-color: #f5f5f7;
    color: #86868b;
    padding: 30px 0;
    text-align: center;
    font-size: 13px;
    border-top: 1px solid #e5e5e5;
}

footer p {
    margin: 0;
}

/* Back to Top */
#back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: none;
    width: 48px;
    height: 48px;
    
    /* Flexbox for perfect centering of SVG */
    display: none; /* JS toggles block/flex */
    align-items: center;
    justify-content: center;
    
    background: rgba(17, 133, 108, 0.6); /* Glassy Green */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #fff;
    cursor: pointer;
    border-radius: 12px; /* Tech-aesthetic Squircle */
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    
    z-index: 99;
    transition: all 0.3s var(--ease-out-expo);
    padding: 0; /* reset padding */
}

#back-to-top svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

#back-to-top:hover {
    transform: translateY(-4px);
    background: rgba(17, 133, 108, 0.85);
    box-shadow: 0 12px 40px rgba(17, 133, 108, 0.3);
}

/* Page Titles for sub-pages (Research, Members, Publications) */
.tech-page-title {
    font-size: 56px; /* Larger, more authoritative */
    font-weight: 800; /* Extra bold */
    margin-top: 40px;
    margin-bottom: 60px;
    letter-spacing: -0.03em;
    position: relative;
    display: inline-block;
    
    /* Premium Gradient */
    background: linear-gradient(135deg, #000000 0%, #434343 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    padding-bottom: 10px; /* Space for accent */
}

/* Tech Accent - Fading Line (Restored to transparent fade) */
.tech-page-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 120px; /* Made longer as requested */
    height: 6px; 
    /* Using var(--accent-color) which is set by theme, fading to transparent */
    background: linear-gradient(90deg, var(--accent-color), transparent);
    border-radius: 3px;
}

/* Scroll Animations - Apple-style fade up */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(40px) scale(0.98); /* Slight scale for depth */
    transition: opacity 1.0s var(--ease-out-expo), transform 1.0s var(--ease-out-expo);
    will-change: opacity, transform;
}

/* Visible State */
.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Fallback for safety - if JS fails, we want content visible */
@media (prefers-reduced-motion: reduce) {
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
}

.stagger-1 { transition-delay: 100ms; }
.stagger-2 { transition-delay: 200ms; }
.stagger-3 { transition-delay: 300ms; }
.stagger-4 { transition-delay: 400ms; }

/* Responsive adjustments */
@media (max-width: 768px) {
    .container { padding: 0 20px 60px; }
    
    .hero-content h1 { font-size: 40px; }
    .hero-content p { font-size: 20px; }
    
    .header-container { flex-direction: column; padding: 15px; }
    header { height: auto; position: relative; }
    nav ul { gap: 20px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
    
    .research-grid { grid-template-columns: 1fr; }
}
