/* --------------------------------------------------
   Siyuan Yan - Resume Web Page Style System
   Theme-able, Responsive, and Highly Interactive
-------------------------------------------------- */

/* 1. Global Variables & Themes */
:root {
    /* Fonts */
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Transition Speeds */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-slow: 0.8s cubic-bezier(0.25, 0.8, 0.25, 1);
    
    /* Spacing & Borders */
    --border-radius-sm: 8px;
    --border-radius-md: 16px;
    --border-radius-lg: 24px;
    --border-radius-full: 9999px;
}

/* Dark Theme (Default) */
html[data-theme="dark"] {
    --bg-primary: #070b13;
    --bg-secondary: #0f1524;
    --bg-alt: #0a0e1a;
    --bg-glass: rgba(15, 21, 36, 0.75);
    --bg-glass-hover: rgba(20, 29, 48, 0.85);
    
    --border-color: rgba(255, 255, 255, 0.07);
    --border-color-hover: rgba(255, 255, 255, 0.15);
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary-color: #3b82f6;
    --primary-rgb: 59, 130, 246;
    --accent-color: #6366f1;
    --accent-rgb: 99, 102, 241;
    --accent-glow: rgba(99, 102, 241, 0.15);
    --success-color: #10b981;
    
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5), 0 1px 3px rgba(255, 255, 255, 0.05);
    --glow-color: rgba(59, 130, 246, 0.25);
    --cursor-color: rgba(255, 255, 255, 0.8);
    --cursor-outline-color: rgba(255, 255, 255, 0.15);
}

/* Light Theme */
html[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-alt: #f1f5f9;
    --bg-glass: rgba(255, 255, 255, 0.75);
    --bg-glass-hover: rgba(255, 255, 255, 0.9);
    
    --border-color: rgba(15, 23, 42, 0.08);
    --border-color-hover: rgba(15, 23, 42, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    
    --primary-color: #2563eb;
    --primary-rgb: 37, 99, 235;
    --accent-color: #4f46e5;
    --accent-rgb: 79, 70, 229;
    --accent-glow: rgba(79, 70, 229, 0.06);
    --success-color: #059669;
    
    --card-shadow: 0 10px 30px -10px rgba(15, 23, 42, 0.08), 0 1px 3px rgba(0, 0, 0, 0.02);
    --glow-color: rgba(37, 99, 235, 0.12);
    --cursor-color: rgba(15, 23, 42, 0.8);
    --cursor-outline-color: rgba(15, 23, 42, 0.15);
}

/* 2. Resets & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-normal), color var(--transition-normal);
}

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

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

a:hover {
    color: var(--accent-color);
}

/* Section Common Styles */
.section-padding {
    padding: 7rem 0;
}

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

.section-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Section Header */
.section-header {
    margin-bottom: 4rem;
    position: relative;
}

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

.section-tag {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary-color);
    display: inline-block;
    margin-bottom: 0.5rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.header-line {
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: var(--border-radius-full);
    margin-top: 1rem;
}

.section-header.text-center .header-line {
    margin-left: auto;
    margin-right: auto;
}

.text-muted {
    color: var(--text-secondary);
}

/* 3. Typography Helpers */
.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-highlight {
    color: var(--primary-color);
    font-weight: 600;
}

/* Badges */
.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-primary {
    background-color: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

.badge-accent {
    background-color: rgba(var(--accent-rgb), 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(var(--accent-rgb), 0.2);
}

/* Custom Styled Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--border-radius-full);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Custom Cursor Styles */
.custom-cursor-dot,
.custom-cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 9999;
    transition: opacity var(--transition-fast) ease-in-out, transform var(--transition-fast) ease-in-out;
}

.custom-cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--cursor-color);
}

.custom-cursor-outline {
    width: 30px;
    height: 30px;
    border: 2px solid var(--cursor-outline-color);
    transition: width 0.15s ease-out, height 0.15s ease-out, border-color 0.15s ease-out;
}

/* When hovering over clickable items */
body.cursor-hover .custom-cursor-outline {
    width: 50px;
    height: 50px;
    background-color: rgba(var(--primary-rgb), 0.08);
    border-color: var(--primary-color);
}

@media (max-width: 1024px) {
    /* Hide custom cursor on tablets and mobiles */
    .custom-cursor-dot,
    .custom-cursor-outline {
        display: none;
    }
}

/* 4. Common Components */
/* Glassmorphism Cards */
.card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    box-shadow: var(--card-shadow);
    transition: border-color var(--transition-normal), transform var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card {
    background-color: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.glass-card:hover {
    border-color: var(--border-color-hover);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.15), 0 0 15px var(--glow-color);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1.8rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--border-radius-full);
    border: 1px solid transparent;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow var(--transition-fast), background var(--transition-fast);
}

.btn:active {
    transform: scale(0.96);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: #ffffff;
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(var(--primary-rgb), 0.45), 0 0 10px rgba(var(--accent-rgb), 0.3);
    color: #ffffff;
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(var(--primary-rgb), 0.05);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-sm {
    padding: 0.5rem 1.2rem;
    font-size: 0.85rem;
}

/* Scroll Progress Bar */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    z-index: 1001;
    transition: width 0.1s linear;
}

/* 5. Header / Navigation */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    padding: 1.5rem 0;
    transition: padding var(--transition-normal), background var(--transition-normal), border var(--transition-normal), box-shadow var(--transition-normal);
}

.header-container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.logo span {
    color: var(--primary-color);
}

.navbar {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    font-family: var(--font-heading);
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
    padding: 0.5rem 0;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width var(--transition-normal);
}

.nav-link:hover::after {
    width: 100%;
}

.sandbox-link {
    color: var(--accent-color);
    font-weight: 600;
}

.sandbox-link::after {
    background-color: var(--accent-color);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.1rem;
    transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle-btn:hover {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.05);
    transform: rotate(15deg);
}

.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
}

/* Scroll Timeline Animation for Header */
@keyframes header-shrink {
    to {
        padding: 0.75rem 0;
        background-color: var(--bg-glass);
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
}

@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    .main-header {
        animation: header-shrink auto linear both;
        animation-timeline: scroll(block root);
        animation-range: 0px 80px;
    }
}

/* Fallback Header Class (applied via JS) */
.main-header.scrolled {
    padding: 0.75rem 0;
    background-color: var(--bg-glass);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.03);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

@supports ((animation-timeline: scroll()) and (animation-range: 0% 100%)) {
    .main-header.scrolled {
        /* Reset manual class styles if native works */
        background-color: transparent;
        border-bottom: none;
        box-shadow: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
}

/* Mobile Navigation Drawer Open State */
@media (max-width: 768px) {
    .mobile-nav-toggle {
        display: block;
    }

    .navbar {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background-color: var(--bg-secondary);
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        justify-content: center;
        gap: 2.5rem;
        z-index: 999;
        transition: right var(--transition-normal);
        box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
    }

    .navbar.open {
        right: 0;
    }
}

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

/* Background Glowing Spheres */
.hero-bg-gradients {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
}

.gradient-sphere {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.15;
    animation: float-blobs 20s infinite alternate ease-in-out;
}

.sphere-1 {
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, var(--primary-color), var(--accent-color));
    top: -50px;
    right: -50px;
}

.sphere-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-color), #ec4899);
    bottom: -100px;
    left: -100px;
    animation-delay: -5s;
}

@keyframes float-blobs {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(40px, -60px) scale(1.1);
    }
}

.hero-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
}

.designer-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background-color: rgba(var(--primary-rgb), 0.08);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    color: var(--primary-color);
    padding: 0.4rem 1rem;
    border-radius: var(--border-radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: 1.1rem;
    max-width: 600px;
    margin-bottom: 2.5rem;
}

.hero-cta-group {
    display: flex;
    gap: 1.2rem;
    margin-bottom: 3.5rem;
}

/* Hero Quick Contact Grid */
.quick-contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    max-width: 680px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.contact-item:hover {
    color: var(--text-primary);
    transform: translateX(4px);
}

.contact-item .icon-box {
    width: 36px;
    height: 36px;
    background-color: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: var(--primary-color);
    transition: border-color var(--transition-fast), background-color var(--transition-fast);
}

.contact-item:hover .icon-box {
    border-color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.1);
}

/* Hero Avatar Card with 3D Parallax */
.hero-avatar-wrapper {
    perspective: 1000px;
    display: flex;
    justify-content: center;
}

.avatar-card {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 2 / 3;
    border-radius: var(--border-radius-lg);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    padding: 12px;
    transform-style: preserve-3d;
    transition: transform var(--transition-fast) ease-out;
}

.avatar-inner {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: calc(var(--border-radius-lg) - 6px);
    overflow: hidden;
    transform: translateZ(20px);
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: scale var(--transition-slow);
}

.avatar-card:hover .avatar-img {
    scale: 1.05;
}

.avatar-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15) 0%, transparent 100%);
    pointer-events: none;
    z-index: 2;
}

.avatar-overlay-details {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem;
    background: linear-gradient(0deg, rgba(7, 11, 19, 0.95) 0%, rgba(7, 11, 19, 0) 100%);
    color: #ffffff;
    z-index: 3;
    transform: translateZ(30px);
}

.avatar-overlay-details h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.avatar-overlay-details p {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* Scroll Down Indicator */
.scroll-down-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translate(-50%, 0);
    }
    40% {
        transform: translate(-50%, -10px);
    }
    60% {
        transform: translate(-50%, -5px);
    }
}

/* Tablet & Mobile Layout collapses for Hero */
@media (max-width: 900px) {
    .hero-container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 4rem;
        padding-bottom: 4rem;
    }

    .hero-bg-gradients {
        display: none;
    }

    .hero-title {
        font-size: 2.8rem;
    }

    .hero-description {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-cta-group {
        justify-content: center;
    }

    .quick-contact-grid {
        margin: 0 auto;
    }
}

/* 7. About & Metrics Section */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.metric-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 2.5rem 2rem;
    text-align: center;
    box-shadow: var(--card-shadow);
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 10px 25px rgba(var(--primary-rgb), 0.05);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-num {
    font-family: var(--font-heading);
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    line-height: 1;
}

.metric-label {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    font-size: 1.05rem;
}

.metric-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* 8. Education Section Timeline */
.education-timeline {
    position: relative;
    padding-left: 2rem;
}

.education-timeline::before {
    content: '';
    position: absolute;
    top: 0.5rem;
    left: 0;
    width: 2px;
    height: calc(100% - 1rem);
    background-color: var(--border-color);
}

.timeline-block {
    position: relative;
    margin-bottom: 3.5rem;
}

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

.timeline-marker {
    position: absolute;
    left: -2rem;
    top: 1.5rem;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.marker-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: var(--primary-color);
    border: 3px solid var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
    z-index: 2;
    transition: transform var(--transition-fast), background-color var(--transition-fast);
}

.timeline-block:hover .marker-dot {
    transform: scale(1.3);
    background-color: var(--accent-color);
}

.timeline-content {
    padding: 2rem 2.5rem;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.timeline-title-group {
    display: flex;
    flex-direction: column;
}

.timeline-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timeline-institution {
    font-weight: 500;
    color: var(--primary-color);
    margin-top: 0.2rem;
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timeline-meta-badges {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.timeline-body h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

/* Skills/Courses flex pills */
.skills-flex {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.skill-pill {
    background-color: rgba(var(--primary-rgb), 0.04);
    border: 1px solid var(--border-color);
    padding: 0.4rem 1rem;
    border-radius: var(--border-radius-full);
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: border-color var(--transition-fast), background-color var(--transition-fast), color var(--transition-fast);
}

.timeline-block:hover .skill-pill {
    border-color: rgba(var(--primary-rgb), 0.2);
    background-color: rgba(var(--primary-rgb), 0.08);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .timeline-header {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 9. Experience Section */
.experience-nav {
    display: flex;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 3rem;
    overflow-x: auto;
    scrollbar-width: none; /* Firefox */
}

.experience-nav::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.exp-nav-btn {
    background: none;
    border: none;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--border-radius-full);
    transition: color var(--transition-fast), background-color var(--transition-fast);
    white-space: nowrap;
}

.exp-nav-btn:hover {
    color: var(--text-primary);
    background-color: rgba(var(--primary-rgb), 0.05);
}

.exp-nav-btn.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
}

.experience-container {
    position: relative;
    min-height: 250px;
}

.experience-detail-card {
    display: none;
    animation: fade-in-up 0.5s ease forwards;
}

.experience-detail-card.active {
    display: block;
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exp-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
    margin-bottom: 1.8rem;
    gap: 1.5rem;
}

.exp-company-info {
    display: flex;
    flex-direction: column;
}

.exp-role {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.exp-company {
    color: var(--primary-color);
    font-size: 1.05rem;
    font-weight: 500;
    margin-top: 0.3rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem;
}

.exp-company-link {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px dashed rgba(var(--primary-rgb), 0.4);
    transition: border-color var(--transition-fast), color var(--transition-fast);
    font-size: 0.95rem;
}
.exp-company-link:hover {
    color: var(--accent-color);
    border-bottom-color: var(--accent-color);
}
.exp-company-link .fa-arrow-up-right-from-square {
    font-size: 0.7em;
    margin-left: 0.15rem;
    opacity: 0.7;
}

.exp-company-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Metrics row under each experience */
.exp-metrics-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.exp-metric {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(var(--primary-rgb), 0.06);
    border: 1px solid rgba(var(--primary-rgb), 0.15);
    border-radius: var(--border-radius-sm);
    min-width: 80px;
    text-align: center;
}

.exp-m-num {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
}

.exp-m-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
    white-space: nowrap;
}

.exp-timeline {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.exp-meta-info {
    margin-bottom: 1.5rem;
}

.exp-bullets {
    list-style: none;
}

.exp-bullets li {
    position: relative;
    padding-left: 1.8rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.exp-bullets li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

/* Other experience cards layout */
.other-exp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.other-exp-item {
    padding: 2rem;
}

.other-role {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
}

.other-company {
    color: var(--primary-color);
    font-weight: 500;
    display: block;
    margin: 0.2rem 0 0.5rem 0;
}

.other-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1rem;
}

.other-desc {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .exp-header {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* 10. Selected Projects & Exhibitions */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 2.2rem 1.8rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--accent-color);
    box-shadow: 0 15px 35px -10px rgba(0, 0, 0, 0.2), 0 0 15px rgba(var(--accent-rgb), 0.15);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.project-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background-color: rgba(var(--primary-rgb), 0.05);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 1px solid var(--border-color);
    transition: border-color var(--transition-fast), color var(--transition-fast), background-color var(--transition-fast);
}

.project-card:hover .project-icon {
    border-color: var(--accent-color);
    color: #ffffff;
    background-color: var(--accent-color);
}

.project-date {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.project-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.project-subtitle {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.project-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: auto; /* Push tags to bottom */
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.2rem;
}

.project-tags span {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    background-color: rgba(128, 128, 128, 0.05);
    padding: 0.25rem 0.6rem;
    border-radius: var(--border-radius-full);
}

/* 11. Leadership & Activities */
.leadership-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

.leadership-roles {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.role-item {
    padding: 1.5rem 1.8rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.role-icon-box {
    width: 48px;
    height: 48px;
    background-color: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--primary-color);
    flex-shrink: 0;
}

.role-details h3 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

.role-org {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.2rem;
}

.leadership-content {
    padding: 3rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.leadership-icon {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.leadership-content h3 {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.leadership-content p {
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.events-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.event-tag {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-tag i {
    color: var(--accent-color);
}

@media (max-width: 900px) {
    .leadership-layout {
        grid-template-columns: 1fr;
    }
    
    .leadership-content {
        padding: 2.2rem;
    }
}

/* 12. Honors & Awards */
.honors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 3rem;
}

.honor-col-title {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--primary-color);
}

.honor-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.honor-item {
    display: flex;
    gap: 1.2rem;
    border-left: 2px solid var(--border-color);
    padding-left: 1.2rem;
    position: relative;
    transition: border-color var(--transition-fast);
}

.honor-item:hover {
    border-color: var(--accent-color);
}

.honor-year {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-color);
    background-color: rgba(var(--accent-rgb), 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: var(--border-radius-sm);
    height: fit-content;
    white-space: nowrap;
}

.honor-status {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--primary-color);
    background-color: rgba(var(--primary-rgb), 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: var(--border-radius-sm);
    height: fit-content;
    white-space: nowrap;
}

.honor-info h4 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.honor-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.3rem;
}

.honor-info-simple h4 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

/* 13. Skills & Capabilities */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
}

.skill-category-card {
    padding: 2.2rem 2rem;
}

.skill-cat-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.cat-icon {
    font-size: 1.5rem;
}

.skill-cat-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.skill-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.skill-list li {
    font-size: 0.95rem;
    color: var(--text-secondary);
    position: relative;
    padding-left: 1.2rem;
}

.skill-list li::before {
    content: '•';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.expert-skill {
    font-weight: 600;
    color: var(--text-primary) !important;
}

.expert-skill::after {
    content: ' (Expert)';
    color: var(--primary-color);
    font-size: 0.8rem;
    font-weight: normal;
}

.languages-box {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.language-item {
    display: flex;
    flex-direction: column;
}

.lang-name {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1rem;
}

.lang-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.1rem;
}

/* 14. Interactive Sandbox Playground */
.sandbox-intro-card {
    padding: 2.5rem;
    margin-bottom: 2.5rem;
}

.sandbox-intro-card h3 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.sandbox-requirements-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
}

.req-item {
    display: flex;
    gap: 1.2rem;
    align-items: flex-start;
}

.req-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: rgba(var(--primary-rgb), 0.05);
    border: 1px solid var(--border-color);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.req-item:hover .req-icon {
    background-color: rgba(var(--accent-rgb), 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.req-item strong {
    display: block;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

.req-item p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.sandbox-container {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 480px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    padding: 0;
}

#sandbox-canvas, #galaxy-container {
    display: block;
    width: 100%;
    height: 100%;
    background-color: var(--bg-alt);
    cursor: crosshair;
}

.sandbox-dashboard {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--bg-glass);
    border-top: 1px solid var(--border-color);
    padding: 1.2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    z-index: 10;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.sandbox-settings-panel {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    flex-grow: 1;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 140px;
    flex-grow: 1;
}

.settings-group label {
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.settings-group label span {
    color: var(--primary-color);
    font-weight: 700;
}

.settings-group input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    height: 4px;
    border-radius: var(--border-radius-full);
    outline: none;
    transition: background var(--transition-fast);
    cursor: pointer;
}

.settings-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    transition: transform 0.1s ease, background 0.1s ease;
}

.settings-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    background: var(--accent-color);
}

.sandbox-controls {
    display: flex;
    gap: 1rem;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .sandbox-requirements-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    .sandbox-dashboard {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
        padding: 1.2rem;
    }
    .sandbox-settings-panel {
        gap: 1rem;
    }
    .settings-group {
        min-width: 120px;
    }
}

@media (max-width: 768px) {
    .sandbox-container {
        aspect-ratio: 4 / 3;
        min-height: 600px;
    }
}

/* 15. Footer */
.main-footer {
    background-color: #05080e;
    color: #ffffff;
    border-top: 1px solid var(--border-color);
    padding: 5rem 0 2rem 0;
}

.footer-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-brand h4, 
.footer-links h4,
.footer-contact h4 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    color: #ffffff;
}

.footer-logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.02em;
    display: inline-block;
    margin-bottom: 1rem;
}

.footer-logo span {
    color: var(--primary-color);
}

.footer-brand p {
    color: #94a3b8;
    font-size: 0.95rem;
}

.footer-links-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
}

.footer-links-grid a {
    color: #94a3b8;
    font-size: 0.95rem;
    transition: color var(--transition-fast);
}

.footer-links-grid a:hover {
    color: #ffffff;
}

.footer-contact p {
    color: #94a3b8;
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.footer-contact a {
    color: #94a3b8;
}

.footer-contact a:hover {
    color: #ffffff;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 2rem;
    text-align: center;
}

.footer-bottom p {
    color: #64748b;
    font-size: 0.85rem;
}

@media (max-width: 800px) {
    .footer-container {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* 16. Scroll View-Timeline Reveal Animation */
@keyframes reveal-up {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Native CSS View-Timeline when supported */
@supports ((animation-timeline: view()) and (animation-range: entry)) {
    .scroll-reveal {
        animation: reveal-up auto cubic-bezier(0.25, 0.8, 0.25, 1) both;
        animation-timeline: view();
        animation-range: entry 10% cover 30%;
    }
}

/* Fallback Scroll Reveal Active Class (applied via JS) */
.scroll-reveal.reveal-active {
    animation: reveal-up 0.9s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

/* If scroll view timelines are supported, disable fallback active animation */
@supports ((animation-timeline: view()) and (animation-range: entry)) {
    .scroll-reveal.reveal-active {
        animation: none;
    }
}

/* Disable scroll animations if user prefers reduced motion */
@media (prefers-reduced-motion: reduce) {
    .scroll-reveal,
    .scroll-reveal.reveal-active {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    .gradient-sphere {
        animation: none !important;
    }
    .custom-cursor-dot,
    .custom-cursor-outline {
        display: none !important;
    }
}

/* ================================================
   Activity Showcase (Horizontal Scroll)
   ================================================ */
.activity-carousel-section {
    margin-top: 2.5rem;
}

.carousel-header {
    margin-bottom: 1.5rem;
    position: sticky;
    top: 60px; /* offset for nav header */
    background: var(--bg-alt);
    padding: 10px 0;
    z-index: 10;
}

.gallery-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

/* Tab/Anchor navigation */
.carousel-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
}
.carousel-tabs::-webkit-scrollbar { display: none; }

.ctab {
    flex-shrink: 0;
    padding: 0.5rem 1.2rem;
    border-radius: var(--border-radius-full);
    border: 1px solid var(--border-color);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}
.ctab:hover {
    border-color: rgba(var(--primary-rgb), 0.4);
    color: var(--text-primary);
    background: rgba(var(--primary-rgb), 0.05);
}
.ctab.active {
    background: rgba(var(--primary-rgb), 0.12);
    border-color: rgba(var(--primary-rgb), 0.5);
    color: var(--primary-color);
    font-weight: 500;
}

/* Horizontal Scroll Container */
.activity-scroll-container {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding-bottom: 2rem;
    scroll-behavior: smooth;
    /* Custom Scrollbar for better UX */
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) var(--bg-secondary);
}

.activity-scroll-container::-webkit-scrollbar {
    height: 8px;
}

.activity-scroll-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.activity-scroll-container::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
}

/* Activity Group */
.activity-group {
    display: flex;
    gap: 1.5rem;
    flex-shrink: 0;
    scroll-margin-left: 2rem; /* ensures the element is not flushed against the edge when scrolling to it */
}

/* Description Card inline with media */
.activity-desc-card {
    flex-shrink: 0;
    width: 280px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding: 1.5rem;
    border-left: 4px solid rgba(var(--primary-rgb), 0.4);
    background: rgba(var(--primary-rgb), 0.04);
    border-radius: var(--border-radius-md);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.activity-desc-card strong {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    display: block;
}

/* Media Items (Images & Videos) */
.activity-media-item {
    flex-shrink: 0;
    width: 450px;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.activity-media-item:hover {
    transform: translateY(-5px);
    border-color: rgba(var(--primary-rgb), 0.3);
}

.activity-media-item img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.activity-media-item .video-wrapper {
    width: 100%;
    height: 300px;
    background: #000;
}

.activity-media-item iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.media-caption {
    display: block;
    padding: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    line-height: 1.4;
    /* Optional: allows multi-line if needed, or keep single line with ellipsis */
}

@media (max-width: 768px) {
    .activity-media-item {
        width: 320px;
    }
    .activity-media-item img, 
    .activity-media-item .video-wrapper {
        height: 220px;
    }
    .activity-desc-card {
        width: 240px;
        padding: 1rem;
    }
}


/* ================================================
   Project Detail Modal
   ================================================ */
.project-card {
    cursor: pointer;
}

.project-card:focus-visible {
    outline: 3px solid rgba(var(--primary-rgb), 0.45);
    outline-offset: 4px;
}

.highlight-pill {
    color: var(--primary-color);
    border-color: rgba(var(--primary-rgb), 0.35);
    background-color: rgba(var(--primary-rgb), 0.1);
}

.project-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.project-modal.is-open {
    display: flex;
}

.project-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.project-modal-panel {
    position: relative;
    width: min(760px, 100%);
    max-height: 88vh;
    overflow-y: auto;
    border-radius: var(--border-radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
    padding: 2.2rem;
    z-index: 1;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--text-primary);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}

.project-modal-date {
    display: inline-block;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.7rem;
}

.project-modal-panel h3 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    line-height: 1.25;
    margin-bottom: 0.45rem;
}

.project-modal-subtitle {
    color: var(--accent-color);
    font-weight: 600;
    margin-bottom: 1.2rem;
}

.project-modal-detail {
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1.5rem;
}

.project-detail-media {
    min-height: 260px;
    border: 1px dashed rgba(var(--primary-rgb), 0.35);
    border-radius: var(--border-radius-md);
    background: rgba(var(--primary-rgb), 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    color: var(--text-muted);
}

.project-detail-media i {
    font-size: 2rem;
    color: var(--primary-color);
}

body.modal-open {
    overflow: hidden;
}

@media (max-width: 640px) {
    .project-modal-panel {
        padding: 1.6rem;
    }

    .project-modal-panel h3 {
        font-size: 1.45rem;
    }

    .project-detail-media {
        min-height: 200px;
    }
}

/* ================================================
   Interaction Portfolio
   ================================================ */
.portfolio-section {
    background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.portfolio-intro {
    max-width: 640px;
    margin-top: 1rem;
    line-height: 1.7;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.portfolio-card {
    position: relative;
    min-height: 430px;
    display: flex;
    flex-direction: column;
    padding: 1.7rem;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: var(--bg-secondary);
    box-shadow: var(--card-shadow);
    cursor: pointer;
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.portfolio-card::after {
    content: '';
    position: absolute;
    width: 210px;
    height: 210px;
    right: -90px;
    bottom: -100px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(var(--primary-rgb), 0.2), transparent 68%);
    pointer-events: none;
}

.portfolio-card:hover {
    transform: translateY(-8px);
    border-color: rgba(var(--primary-rgb), 0.42);
    box-shadow: 0 18px 36px -14px rgba(0, 0, 0, 0.3), 0 0 22px rgba(var(--primary-rgb), 0.12);
}

.portfolio-card:focus-visible {
    outline: 3px solid rgba(var(--primary-rgb), 0.45);
    outline-offset: 4px;
}

.portfolio-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portfolio-index {
    font-family: var(--font-heading);
    font-size: 0.82rem;
    font-weight: 800;
    color: var(--primary-color);
    letter-spacing: 0.08em;
}

.portfolio-type {
    padding: 0.28rem 0.65rem;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    border-radius: var(--border-radius-full);
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--text-secondary);
    font-size: 0.72rem;
    white-space: nowrap;
}

.portfolio-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 2.1rem 0 1.3rem;
    border: 1px solid rgba(var(--primary-rgb), 0.22);
    border-radius: 15px;
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--primary-color);
    font-size: 1.35rem;
}

.portfolio-card h3 {
    font-family: var(--font-heading);
    font-size: clamp(1.25rem, 2vw, 1.58rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
}

.portfolio-cn-title {
    margin-top: 0.65rem;
    color: var(--primary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.portfolio-desc {
    margin-top: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
}

.portfolio-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: auto;
    padding-top: 1.5rem;
}

.portfolio-tags span,
.portfolio-modal-skills span {
    padding: 0.3rem 0.62rem;
    border-radius: var(--border-radius-full);
    background: rgba(var(--primary-rgb), 0.07);
    color: var(--text-secondary);
    font-size: 0.73rem;
}

.portfolio-detail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.portfolio-card:hover .portfolio-detail-link i {
    transform: translateX(4px);
}

.portfolio-detail-link i {
    transition: transform var(--transition-fast);
}

.portfolio-modal-breakdown {
    display: grid;
    gap: 1rem;
    margin: 0 0 1.5rem;
}

.portfolio-modal-breakdown section {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: rgba(var(--primary-rgb), 0.035);
}

.portfolio-modal-breakdown h4 {
    margin-bottom: 0.4rem;
    color: var(--primary-color);
    font-family: var(--font-heading);
    font-size: 0.88rem;
}

.portfolio-modal-breakdown p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.65;
}

.portfolio-modal-skills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

@media (max-width: 980px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .portfolio-card {
        min-height: 380px;
        padding: 1.4rem;
    }
}

/* Full-width portfolio case-study presentation */
.project-modal-panel:has(.portfolio-case-gallery:not([hidden])) {
    width: min(1440px, 96vw);
    max-height: 94vh;
    padding: clamp(1.4rem, 3vw, 3.2rem);
}

.project-modal-panel:has(.portfolio-case-gallery:not([hidden])) .project-modal-detail {
    max-width: 880px;
    font-size: 1rem;
}

.portfolio-case-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 1.75rem 0 0;
}

.portfolio-case-media {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    background: #080a0f;
    box-shadow: var(--card-shadow);
}

.portfolio-case-media.featured {
    grid-column: 1 / -1;
}

.portfolio-case-media img {
    display: block;
    width: 100%;
    height: auto;
}

.portfolio-case-media figcaption {
    padding: 0.75rem 1rem;
    color: var(--text-muted);
    background: var(--bg-secondary);
    font-size: 0.8rem;
    line-height: 1.45;
}

@media (max-width: 720px) {
    .project-modal-panel:has(.portfolio-case-gallery:not([hidden])) {
        width: 100%;
        max-height: 96vh;
    }

    .portfolio-case-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .portfolio-case-media.featured {
        grid-column: auto;
    }
}

/* Original PDF artboards: preserve each page's native white / dark background. */
.portfolio-case-media { background: transparent; border-color: rgba(var(--primary-rgb), .16); }
.portfolio-case-media figcaption { display: none; }
.portfolio-case-gallery { gap: 2rem; }

/* Internship project galleries */
.experience-media-gallery { display:flex; gap:1rem; overflow-x:auto; margin-top:1.5rem; padding:1rem 0 .4rem; border-top:1px solid var(--border-color); scrollbar-width:thin; }
.experience-media-item { flex:0 0 min(360px, 78vw); overflow:hidden; padding:0; border:1px solid var(--border-color); border-radius:var(--border-radius-sm); background:var(--bg-secondary); color:var(--text-muted); cursor:pointer; text-align:left; }
.experience-media-item img { display:block; width:100%; height:180px; object-fit:cover; background:#fff; transition:transform var(--transition-normal); }
.experience-media-item:hover img { transform:scale(1.03); }
.experience-media-item span { display:block; padding:.6rem .75rem; font-size:.78rem; }
.image-preview-modal { position:fixed; inset:0; z-index:2200; display:none; align-items:center; justify-content:center; padding:1.5rem; }
.image-preview-modal.is-open { display:flex; }
.image-preview-overlay { position:absolute; inset:0; background:rgba(0,0,0,.8); backdrop-filter:blur(8px); }
.image-preview-panel { position:relative; z-index:1; max-width:min(1400px,96vw); max-height:92vh; }
.image-preview-panel img { display:block; max-width:100%; max-height:90vh; border-radius:var(--border-radius-sm); background:#fff; }
.image-preview-close { position:absolute; top:-.75rem; right:-.75rem; width:38px; height:38px; border:1px solid rgba(255,255,255,.35); border-radius:50%; background:#111827; color:#fff; font-size:1.6rem; cursor:pointer; }


/* ================================================
   Reading-safe enhanced motion
   Intense enough to communicate depth, short enough to protect scanning.
   ================================================ */
#ambient-particle-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    opacity: 0.58;
}

main, .main-header, .main-footer {
    position: relative;
    z-index: 1;
}

.education-timeline,
.projects-grid,
.portfolio-grid,
.skills-grid,
.honors-grid,
.leadership-layout {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.motion-lift,
.motion-fan {
    will-change: transform, opacity;
    backface-visibility: hidden;
}

.motion-lift {
    transform: translateY(46px) rotateX(16deg) rotateY(-4deg) scale(0.94);
    opacity: 0.88;
    transition: transform 680ms cubic-bezier(0.16, 1, 0.3, 1), opacity 360ms ease-out, box-shadow 420ms ease;
    transition-delay: var(--motion-delay, 0ms);
}

.motion-fan {
    transform: translateY(var(--fan-offset, 78px)) rotateX(22deg) rotateY(-6deg) rotateZ(var(--fan-rotation, -12deg)) scale(0.88);
    opacity: 0.9;
    transition: transform 720ms cubic-bezier(0.16, 1, 0.3, 1), opacity 380ms ease-out, box-shadow 420ms ease;
    transition-delay: var(--motion-delay, 0ms);
}

.motion-ready {
    transform: translate3d(0, 0, 0) rotateX(0) rotateY(0) rotateZ(0) scale(1);
    opacity: 1;
}

.motion-ready.project-card:hover,
.motion-ready.portfolio-card:hover {
    transform: translateY(-10px) rotateX(3deg) rotateY(-3deg) scale(1.025);
}

.motion-ready.experience-media-item:hover {
    transform: translateY(-5px) rotateX(2deg) rotateY(-2deg) scale(1.015);
}

@media (prefers-reduced-motion: reduce), (pointer: coarse) {
    #ambient-particle-canvas { display: none; }
    .motion-lift,
    .motion-fan,
    .motion-ready {
        transform: none !important;
        opacity: 1 !important;
        transition: none !important;
    }
}

/* Let the reading-safe motion own transforms for enhanced cards. */
.scroll-reveal.motion-lift,
.scroll-reveal.motion-fan {
    animation: none;
}
