:root {
    /* Color Variables */
    --primary-color: #4a90e2;
    --primary-dark: #357abd;
    --secondary-color: #50e3c2;
    --accent-color: #ff5a5f;
    --text-color: #333333;
    --bg-color: #ffffff;
    --bg-secondary: #f4f6f8;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --border-color: #e1e4e8;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 50px rgba(74, 144, 226, 0.15);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --primary-color: #64b5f6;
    --primary-dark: #42a5f5;
    --secondary-color: #4db6ac;
    --accent-color: #ff8a80;
    --text-color: #f0f0f0;
    --bg-color: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --nav-bg: rgba(26, 26, 26, 0.95);
    --border-color: #404040;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
    transition: var(--transition);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.4;
    background:
        radial-gradient(ellipse 80% 50% at 10% -20%, rgba(74, 144, 226, 0.12), transparent 50%),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(80, 227, 194, 0.08), transparent 45%);
}

[data-theme="dark"] body::before {
    opacity: 0.35;
    background:
        radial-gradient(ellipse 80% 50% at 10% -20%, rgba(100, 181, 246, 0.08), transparent 50%),
        radial-gradient(ellipse 60% 40% at 90% 100%, rgba(77, 182, 172, 0.06), transparent 45%);
}

/*
 * Lift sections above the page gradient — but NEVER apply this to .navbar:
 * if the nav gets z-index: 1, later siblings (main content) paint on top and
 * desktop dropdown menus disappear behind the page. Mobile overlay uses .mobile-nav-root.
 */
body > *:not(.mobile-nav-root):not(.navbar) {
    position: relative;
    z-index: 1;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

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

/* Navigation */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    z-index: 1220;
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.6) inset,
        var(--shadow-md);
    padding: 0.85rem 0;
    transition: var(--transition);
    /* Aligns drawer panel top with real bar height (mobile menu positioning). */
    --nav-offset: clamp(4rem, 13vw, 5rem);
}

[data-theme="dark"] .navbar {
    box-shadow:
        0 1px 0 rgba(255, 255, 255, 0.05) inset,
        var(--shadow-md);
}

/* Legacy: old inline drawer used .nav-backdrop; mobile menu v2 uses .mobile-nav-backdrop */
.nav-backdrop {
    display: none !important;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: nowrap;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
    letter-spacing: -0.5px;
    flex-shrink: 0;
    transition: transform 0.25s ease, filter 0.25s ease;
}

.logo:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.nav-links {
    flex: 1;
    display: flex;
    gap: clamp(1rem, 2vw, 2.5rem);
    align-items: center;
    justify-content: flex-end;
    margin-left: 0;
    min-width: 0;
}

.nav-toolbar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.nav-links a, .dropbtn {
    font-weight: 500;
    transition: var(--transition);
    color: var(--text-color);
    font-size: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 0.5rem;
}

.nav-links a:hover, .dropbtn:hover {
    color: var(--primary-color);
}

/* Dropdown */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0; /* Align right to prevent overflow if close to edge */
    background-color: var(--bg-color);
    min-width: 220px;
    box-shadow: var(--shadow-md);
    z-index: 1200;
    border-radius: 8px;
    padding: 0.5rem 0;
    border: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.dropdown-content.show {
    display: block;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.dropdown-content a {
    color: var(--text-color);
    padding: 0.8rem 1.5rem;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    transition: background-color 0.2s;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: var(--bg-secondary);
    color: var(--primary-color);
}

.dropbtn i {
    font-size: 0.8rem;
    margin-left: 5px;
    transition: transform 0.3s;
}

.dropdown.active .dropbtn i {
    transform: rotate(180deg);
}

/* EN / 中文 segmented control */
.lang-switch {
    display: inline-flex;
    padding: 4px;
    border-radius: 999px;
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-color));
    border: 1px solid var(--border-color);
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.06),
        0 2px 8px rgba(74, 144, 226, 0.08);
}

[data-theme="dark"] .lang-switch {
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.35),
        0 2px 10px rgba(0, 0, 0, 0.25);
}

.lang-switch-btn {
    position: relative;
    padding: 0.42rem 0.95rem;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    font-family: inherit;
    color: var(--text-color);
    background: transparent;
    opacity: 0.55;
    transition: color 0.25s ease, opacity 0.25s ease, transform 0.2s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.lang-switch-btn:hover {
    opacity: 0.95;
}

.lang-switch-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.lang-switch-btn.active {
    opacity: 1;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    box-shadow:
        0 3px 12px rgba(74, 144, 226, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .lang-switch-btn.active {
    box-shadow:
        0 3px 14px rgba(100, 181, 246, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.theme-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 50%;
    font-size: 1.15rem;
    color: var(--text-color);
    padding: 0;
    margin-left: 0.15rem;
    border: 1px solid var(--border-color);
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-color));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.theme-toggle:hover {
    transform: scale(1.06);
    border-color: var(--primary-color);
    box-shadow: 0 4px 14px rgba(74, 144, 226, 0.25);
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--bg-secondary), var(--bg-color));
    border: 1px solid var(--border-color);
    font-size: 1.25rem;
    line-height: 1;
    color: var(--text-color);
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
}

.mobile-menu-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 4px 14px rgba(74, 144, 226, 0.2);
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse 120% 80% at 70% 20%, rgba(74, 144, 226, 0.09), transparent 55%),
        linear-gradient(145deg, var(--bg-secondary) 0%, var(--bg-color) 55%, var(--bg-secondary) 100%);
    padding-top: 100px;
    padding-bottom: 50px;
}

.hero::after {
    content: '';
    position: absolute;
    inset: -20%;
    background: radial-gradient(circle at 30% 70%, rgba(80, 227, 194, 0.06), transparent 45%);
    pointer-events: none;
    animation: heroGlow 14s ease-in-out infinite alternate;
}

@keyframes heroGlow {
    0% { opacity: 0.6; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.05); }
}

.hero .container {
    position: relative;
    z-index: 1;
}

.hero-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    width: 100%;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.headshot-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.headshot {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--bg-color);
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.12),
        0 0 0 1px rgba(74, 144, 226, 0.12);
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

.headshot:hover {
    transform: scale(1.06);
    box-shadow:
        var(--shadow-lg),
        0 0 0 1px rgba(74, 144, 226, 0.25);
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    text-shadow: 0 2px 24px rgba(74, 144, 226, 0.15);
}

.hero p {
    font-size: 1.15rem;
    color: var(--text-color);
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.8;
}

.btn-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.cta-button {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 1rem 2rem;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
    border: 2px solid var(--primary-color);
}

.cta-button.secondary {
    background: transparent;
    color: var(--primary-color);
    box-shadow: none;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 144, 226, 0.4);
}

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

/* Services Section */
.section {
    padding: 5rem 0;
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
    line-height: 1.25;
    padding: 0 0.75rem;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 20px rgba(74, 144, 226, 0.12);
}

.section-title.fancy-title {
    position: relative;
    display: block;
    width: fit-content;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 0.35rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    text-shadow: none;
    animation: sectionTitleGlow 3s ease-in-out infinite alternate;
}

.section-title.fancy-title::before {
    content: '';
    position: absolute;
    left: 12%;
    right: 12%;
    bottom: 0;
    height: 3px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(74, 144, 226, 0.25), rgba(80, 227, 194, 0.85), rgba(74, 144, 226, 0.25));
    box-shadow: 0 0 14px rgba(74, 144, 226, 0.3);
}

.section-title.fancy-title.is-typing::after {
    content: '';
    position: absolute;
    right: -0.08em;
    top: 0.12em;
    width: 0.08em;
    height: 0.85em;
    border-radius: 2px;
    background: currentColor;
    animation: sectionTitleCaret 0.7s steps(1, end) infinite;
}

@keyframes sectionTitleGlow {
    0% {
        filter: drop-shadow(0 0 0 rgba(74, 144, 226, 0.05));
    }
    100% {
        filter: drop-shadow(0 0 8px rgba(74, 144, 226, 0.22));
    }
}

@keyframes sectionTitleCaret {
    50% {
        opacity: 0;
    }
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.service-card {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    text-align: center;
}

.service-card:hover {
    transform: translateY(-5px);
}

.service-icon {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    color: var(--secondary-color);
}

/* Contact Section */
.contact-form {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    background: var(--bg-color);
    color: var(--text-color);
    transition: var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(74, 144, 226, 0.2);
}

.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.submit-btn:hover {
    background: #357abd;
}

.feedback-status {
    margin-top: 0.85rem;
    min-height: 1.5rem;
    font-size: 0.95rem;
    text-align: left;
    opacity: 0.9;
}

.feedback-status.is-success {
    color: #168f52;
}

.feedback-status.is-error {
    color: #c73939;
}

[data-theme="dark"] .feedback-status.is-success {
    color: #67d49a;
}

[data-theme="dark"] .feedback-status.is-error {
    color: #ff8f8f;
}

.feedback-honeypot {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Footer */
footer {
    background: var(--bg-secondary);
    padding: 3rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.social-links {
    margin-bottom: 1.5rem;
}

.social-links a {
    margin: 0 10px;
    font-size: 1.5rem;
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--primary-color);
}

.footer-contact {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    opacity: 0.8;
}

.footer-contact p {
    margin-bottom: 0.5rem;
}

.footer-contact a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.footer-contact a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Utilities */
.scroll-top {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: auto;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.35s ease;
    z-index: 9999;
    box-shadow: 0 6px 22px rgba(74, 144, 226, 0.4);
    border: none;
}

@supports (bottom: max(1rem, env(safe-area-inset-bottom))) {
    .scroll-top {
        bottom: max(1rem, env(safe-area-inset-bottom));
        left: max(1rem, env(safe-area-inset-left));
    }
}

.scroll-top:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 10px 28px rgba(74, 144, 226, 0.5);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.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);
}

/* Uniform gallery frames (same outer size site-wide). Images use cover — crop edges if aspect differs; no manual resize needed. */
.carousel-container {
    position: relative;
    width: 100%;
    max-width: 880px;
    margin: 0 auto 2rem;
    overflow: hidden;
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    background-color: var(--bg-secondary);
    isolation: isolate;
    border: 1px solid rgba(74, 144, 226, 0.08);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.45s ease;
    aspect-ratio: 16 / 10;
    height: auto;
    max-height: clamp(240px, 42vw, 460px);
}

@media (hover: hover) and (pointer: fine) {
    .carousel-container:hover {
        transform: translateY(-4px) scale(1.01);
        box-shadow: var(--shadow-lg);
    }
}

/* Show one slide at a time with display (opacity stacking breaks image paint/decoding in some browsers). */
.carousel-container > img.carousel-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: none;
    z-index: 0;
}

.carousel-container > img.carousel-slide.active {
    display: block;
    z-index: 2;
}

@supports not (aspect-ratio: 1 / 1) {
    .carousel-container {
        height: clamp(240px, 42vw, 460px);
        padding-bottom: 0;
    }
}

/* Awards Section Styling */
.awards-content {
    max-width: 900px;
    margin: 2rem auto;
    padding: 1.5rem;
    background-color: var(--bg-secondary);
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.award-item {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.award-item:last-child {
    border-bottom: none;
}

.award-item h3 {
    color: var(--primary-color);
    font-size: 1.4rem;
    margin-bottom: 0.5rem;
}

.award-institution {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 0.3rem;
}

.award-year {
    font-size: 0.95rem;
    color: #888;
}

.text-placeholder {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-color);
}

/* Mobile Responsive */
@media (max-width: 968px) {
    .hero-container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 2rem;
    }

    .hero-content {
        max-width: 100%;
    }

    .btn-group {
        justify-content: center;
    }

    .headshot {
        width: 180px;
        height: 180px;
    }
}

/* Phone portrait + short landscape: overlay menu (sheet + dimmed backdrop) — see script.js */
.mobile-nav-root {
    display: none;
}

@media (max-width: 768px),
       (max-height: 520px) and (max-width: 1024px) {
    /* Toolbar stays above overlay so hamburger / EN / theme always receive touches */
    .navbar {
        z-index: 100002;
    }

    .nav-links {
        display: none !important;
    }

    /*
     * Overlay sits above page content (z-index 1) but below the navbar.
     * --mobile-nav-overlay-top is set in script from the real navbar bottom (fixes iOS / font scale).
     */
    .mobile-nav-root {
        --mobile-nav-overlay-top-fallback: calc(env(safe-area-inset-top, 0px) + 3.75rem);
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: var(--mobile-nav-overlay-top, var(--mobile-nav-overlay-top-fallback));
        z-index: 100001;
        isolation: isolate;
        pointer-events: none;
        visibility: hidden;
    }

    .mobile-nav-root.active {
        pointer-events: auto;
        visibility: visible;
    }

    .mobile-nav-backdrop {
        position: absolute;
        inset: 0;
        z-index: 1;
        background: rgba(6, 8, 14, 0.62);
        opacity: 0;
        transition: opacity 0.32s ease;
        -webkit-tap-highlight-color: transparent;
        cursor: pointer;
        touch-action: manipulation;
    }

    [data-theme="dark"] .mobile-nav-backdrop {
        background: rgba(0, 0, 0, 0.78);
    }

    .mobile-nav-root.active .mobile-nav-backdrop {
        opacity: 1;
    }

    /*
     * Single scrolling column (no nested flex scroll) — avoids iOS Safari collapsing the link list.
     */
    .mobile-nav-sheet {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(26rem, 100%);
        max-width: 100%;
        z-index: 2;
        height: 100%;
        max-height: 100%;
        background: var(--bg-color);
        border-left: 1px solid var(--border-color);
        box-shadow: -16px 0 48px rgba(0, 0, 0, 0.22);
        transform: translate3d(105%, 0, 0);
        transition: transform 0.38s cubic-bezier(0.32, 0.72, 0, 1);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        touch-action: manipulation;
    }

    [data-theme="dark"] .mobile-nav-sheet {
        box-shadow: -16px 0 56px rgba(0, 0, 0, 0.55);
    }

    .mobile-nav-root.active .mobile-nav-sheet {
        transform: translate3d(0, 0, 0);
    }

    .mobile-nav-sheet__header {
        position: sticky;
        top: 0;
        z-index: 6;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem 1rem 1rem 1.15rem;
        border-bottom: 1px solid var(--border-color);
        background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-color) 100%);
    }

    .mobile-nav-sheet__title {
        font-size: 1.15rem;
        font-weight: 700;
        letter-spacing: 0.04em;
        color: var(--primary-color);
    }

    .mobile-nav-close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.85rem;
        height: 2.85rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        background: var(--bg-secondary);
        color: var(--text-color);
        cursor: pointer;
        transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-close:active {
        transform: scale(0.96);
    }

    .mobile-nav-close__icon {
        font-size: 1.35rem;
        line-height: 1;
        font-weight: 300;
    }

    .mobile-nav-sheet__scroll {
        display: block;
        padding: 0.75rem 0.9rem calc(1.25rem + env(safe-area-inset-bottom, 12px));
        color: var(--text-color);
    }

    .mobile-nav-sheet__footer {
        flex-shrink: 0;
        padding: 0.85rem 1rem calc(1rem + env(safe-area-inset-bottom, 12px));
        border-top: 1px solid var(--border-color);
        background: var(--bg-secondary);
    }

    .mobile-nav-sheet__footer--in-scroll {
        margin-top: 1rem;
        border-radius: 12px;
        border: 1px solid var(--border-color);
        padding: 1rem;
    }

    .mobile-nav-sheet > .mobile-nav-sheet__footer .mobile-nav-resume-cta,
    .mobile-nav-sheet__footer .mobile-nav-resume-cta {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        min-height: 3rem;
        gap: 0.5rem;
        text-align: center;
    }

    .mobile-nav-tree {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        min-height: min-content;
        color: var(--text-color);
    }

    .mobile-nav-home {
        display: block;
        padding: 1rem 1.1rem;
        border-radius: 12px;
        font-weight: 700;
        font-size: 1.05rem;
        text-align: center;
        background: linear-gradient(135deg, rgba(74, 144, 226, 0.14), rgba(80, 227, 194, 0.08));
        border: 1px solid rgba(74, 144, 226, 0.28);
        color: var(--text-color);
        transition: transform 0.15s ease, box-shadow 0.2s ease;
    }

    .mobile-nav-home:active {
        transform: scale(0.99);
    }

    .mobile-nav-details {
        border-radius: 12px;
        border: 1px solid var(--border-color);
        background: var(--bg-secondary);
        overflow: hidden;
    }

    .mobile-nav-details__summary {
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        padding: 1rem 1rem 1rem 1.1rem;
        cursor: pointer;
        font-weight: 600;
        font-size: 1rem;
        color: var(--text-color);
        -webkit-tap-highlight-color: transparent;
        user-select: none;
        -webkit-appearance: none;
        appearance: none;
        touch-action: manipulation;
    }

    .mobile-nav-details__summary::-webkit-details-marker {
        display: none;
    }

    .mobile-nav-details__summary::marker {
        display: none;
        content: '';
    }

    .mobile-nav-details__chevron {
        flex-shrink: 0;
        width: 0.55rem;
        height: 0.55rem;
        border-right: 2px solid var(--primary-color);
        border-bottom: 2px solid var(--primary-color);
        transform: rotate(-45deg);
        transition: transform 0.28s ease;
        margin-top: -0.15rem;
        opacity: 0.85;
    }

    .mobile-nav-details[open] .mobile-nav-details__chevron {
        transform: rotate(45deg);
        margin-top: 0.15rem;
    }

    .mobile-nav-details__panel {
        display: flex;
        flex-direction: column;
        gap: 0.35rem;
        padding: 0 0.55rem 0.85rem;
    }

    .mobile-nav-details__panel a {
        display: block;
        padding: 0.95rem 1rem;
        border-radius: 10px;
        font-size: 0.98rem;
        font-weight: 500;
        text-align: left;
        background: var(--bg-color);
        border: 1px solid var(--border-color);
        color: var(--text-color);
        transition: border-color 0.2s ease, background 0.2s ease;
    }

    .mobile-nav-details__panel a:active {
        background: rgba(74, 144, 226, 0.08);
        border-color: rgba(74, 144, 226, 0.35);
    }

    .mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

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

    .carousel-container {
        max-height: min(240px, 46vh);
        aspect-ratio: 16 / 10;
        margin-bottom: 1.5rem;
    }

    .carousel-container:hover {
        transform: none !important;
        box-shadow: var(--shadow-md) !important;
    }

    .lang-switch-btn {
        padding: 0.38rem 0.72rem;
        font-size: 0.68rem;
    }

    .cta-button {
        min-height: 48px;
        padding: 0.9rem 1.35rem;
    }
}

@media (min-width: 769px) and (min-height: 521px),
       (min-width: 1025px) {
    .mobile-nav-root {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

body.menu-open {
    overflow: hidden;
}

body.menu-open .scroll-top {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

@media (max-width: 380px) {
    .scroll-top {
        width: 48px;
        height: 48px;
        left: 0.75rem;
        bottom: 0.75rem;
    }

    .lang-switch-btn {
        padding: 0.35rem 0.55rem;
        font-size: 0.65rem;
    }

    .logo {
        font-size: 1.45rem;
    }
}

/* Carousel Styles (bottom) - Redundant block removed */

.text-placeholder {
    max-width: 800px;
    margin: 2rem auto;
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
    line-height: 1.8;
}

.text-placeholder.prose {
    text-align: left;
    border: 1px solid rgba(74, 144, 226, 0.12);
    transition: transform 0.4s ease, box-shadow 0.4s ease, border-color 0.4s ease;
}

.text-placeholder.prose:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: rgba(74, 144, 226, 0.22);
}

.text-placeholder.prose p + p {
    margin-top: 1rem;
}

.text-placeholder.prose .prose-inline-link {
    color: var(--primary-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    font-weight: 500;
}

.text-placeholder.prose .prose-inline-link:visited {
    color: var(--primary-color);
}

.text-placeholder.prose .prose-inline-link:hover {
    color: var(--primary-dark);
}

/* Homepage quote cards */
.quote-grid {
    max-width: 980px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.quote-card {
    position: relative;
    margin: 0;
    padding: 1.8rem 1.6rem 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(74, 144, 226, 0.2);
    background:
        linear-gradient(145deg, rgba(74, 144, 226, 0.14), rgba(80, 227, 194, 0.1)),
        var(--bg-secondary);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    isolation: isolate;
    transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    animation: quoteFloat 6s ease-in-out infinite;
}

.quote-card::before {
    content: '\201C';
    position: absolute;
    top: -0.42em;
    left: 0.2em;
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 5.4rem;
    line-height: 1;
    color: rgba(74, 144, 226, 0.22);
    z-index: -1;
}

.quote-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.22), transparent 42%);
    pointer-events: none;
}

.quote-card:hover {
    transform: translateY(-6px) scale(1.01);
    border-color: rgba(74, 144, 226, 0.4);
    box-shadow: 0 18px 30px rgba(41, 73, 130, 0.16);
}

.quote-text {
    margin: 0;
    font-size: 1.25rem;
    line-height: 1.7;
    letter-spacing: 0.01em;
    font-family: Georgia, 'Times New Roman', serif;
    font-style: italic;
    color: var(--text-color);
}

.quote-author {
    display: block;
    margin-top: 0.95rem;
    text-align: right;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--primary-color);
}

@keyframes quoteFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

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

/* Video embeds (Projects → Videos) */
.video-grid {
    display: grid;
    gap: 2.5rem;
    max-width: 900px;
    margin: 0 auto 2rem;
}

.video-item {
    transition: transform 0.4s ease;
}

.video-item:hover {
    transform: translateY(-4px);
}

.video-item h3 {
    margin-bottom: 0.75rem;
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 600;
}

.video-item video {
    width: 100%;
    max-height: 70vh;
    border-radius: 10px;
    background: #000;
    box-shadow: var(--shadow);
}

/* IPO Links Styling */
.ipo-links {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px dashed var(--border-color);
}

.ipo-links h3 {
    color: var(--accent-color);
    font-size: 1.3rem;
    margin-bottom: 1rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
}

.ipo-links ul {
    list-style: none;
    padding: 0;
}

.ipo-links li {
    margin-bottom: 0.75rem;
    position: relative;
    padding-left: 1.5rem;
}

.ipo-links li::before {
    content: '🔗'; /* Link emoji as bullet */
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-size: 1rem;
}

.ipo-links li a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
}

.ipo-links li a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

/* Video Wrapper for Responsive YouTube Embeds */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin-bottom: 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

@media (prefers-reduced-motion: reduce) {
    .hero::after {
        animation: none;
    }

    .carousel-container,
    .headshot,
    .text-placeholder.prose,
    .quote-card,
    .scroll-top,
    .mobile-nav-backdrop,
    .mobile-nav-sheet,
    .mobile-nav-details__chevron {
        transition: none;
    }

    .carousel-container:hover,
    .headshot:hover,
    .quote-card:hover {
        transform: none;
    }
}
