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

:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #edf2f8;
    --text: #1a2433;
    --muted: #627086;
    --brand: #0f6fff;
    --brand-2: #11a0a5;
    --border: #dbe3ee;
    --shadow: 0 20px 50px rgba(12, 31, 61, 0.08);
    --header-h: 78px;
    --radius: 16px;
}

[data-theme="dark"] {
    --bg: #0c1320;
    --surface: #101b2d;
    --surface-soft: #142238;
    --text: #e9f1ff;
    --muted: #9ab0d3;
    --brand: #5ba4ff;
    --brand-2: #1ec8bf;
    --border: #26344f;
    --shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .site-header {
    background: rgba(12, 19, 32, 0.9);
}

[data-theme="dark"] .site-nav {
    background: rgba(16, 27, 45, 0.96);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', sans-serif;
    background: radial-gradient(circle at 0% 0%, rgba(15, 111, 255, 0.08), transparent 50%), radial-gradient(circle at 90% 20%, rgba(17, 160, 165, 0.1), transparent 40%), var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    transition: background-color 0.25s ease, color 0.25s ease;
}

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

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

h1,
h2,
h3 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.4rem);
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.5rem, 3.4vw, 2.2rem);
    margin-bottom: 0.9rem;
}

h3 {
    font-size: 1.2rem;
    margin-bottom: 0.6rem;
}

.text-sm {
    color: var(--muted);
    font-size: 0.95rem;
}

.container {
    width: min(1120px, 92%);
    margin: 0 auto;
}

.container-wide {
    width: min(1220px, 94%);
    margin: 0 auto;
}

.top-progress {
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    background: rgba(246, 248, 251, 0.82);
}

.header-inner {
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--text);
}

.brand-mark {
    width: 42px;
    height: 42px;
}

.brand-text {
    display: grid;
    line-height: 1.1;
}

.brand-text strong {
    font-size: 0.95rem;
}

.brand-text span {
    color: var(--muted);
    font-size: 0.72rem;
}

.site-nav {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 230px;
    padding: 0.55rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    display: none;
    flex-direction: column;
    gap: 0.15rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.site-nav a {
    color: var(--text);
    font-size: 0.93rem;
    padding: 0.55rem 0.7rem;
    border-radius: 9px;
    transition: 0.25s ease;
}

.site-nav a:hover,
.site-nav a.active {
    background: var(--surface-soft);
    color: var(--brand);
}

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

.theme-toggle,
.menu-toggle {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.menu-toggle {
    display: inline-block;
    position: relative;
}

.menu-toggle span,
.menu-toggle::before,
.menu-toggle::after {
    content: '';
    position: absolute;
    left: 11px;
    right: 11px;
    height: 2px;
    background: var(--text);
    transition: 0.25s ease;
}

.menu-toggle::before {
    top: 12px;
}

.menu-toggle span {
    top: 19px;
}

.menu-toggle::after {
    top: 26px;
}

body.menu-open .menu-toggle::before {
    transform: translateY(7px) rotate(45deg);
}

body.menu-open .menu-toggle span {
    opacity: 0;
}

body.menu-open .menu-toggle::after {
    transform: translateY(-7px) rotate(-45deg);
}

body.menu-open .site-nav {
    display: flex;
    animation: dropdownIn 0.18s ease-out;
}

@keyframes dropdownIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

main {
    padding: 2.4rem 0 4rem;
}

main .section:first-child {
    margin-top: 0;
}

.hero {
    display: block;
    position: relative;
    min-height: auto;
    padding-top: 0.2rem;
}

.hero-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(260px, 340px);
    gap: 1.2rem;
    align-items: center;
}

.hero-main {
    display: grid;
    gap: 1rem;
}

.hero-side {
    display: grid;
    gap: 0.9rem;
}

.eyebrow {
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--brand-2);
    font-weight: 700;
}

.headline-gradient {
    background: linear-gradient(120deg, var(--text) 30%, var(--brand));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-copy {
    color: var(--muted);
    max-width: 60ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.profile-shell {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 1.2rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
}

.profile-shell::before {
    content: '';
    position: absolute;
    right: -80px;
    top: -70px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(15, 111, 255, 0.2), transparent 70%);
}

.profile-photo {
    border-radius: 18px;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    border: 1px solid var(--border);
}

.index-avatar {
    justify-self: end;
    width: clamp(96px, 10vw, 132px);
    height: clamp(96px, 10vw, 132px);
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--surface);
    box-shadow: var(--shadow);
    background: var(--surface);
}

.index-avatar .profile-photo {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 0;
    object-fit: cover;
}

.hero-metrics {
    margin-top: 0.5rem;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
}

.metric-pill {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 12px;
    padding: 0.5rem 0.75rem;
    min-width: 140px;
}

.metric-pill strong {
    display: block;
    font-size: 1rem;
    color: var(--brand);
}

.metric-pill span {
    font-size: 0.8rem;
    color: var(--muted);
}

.profile-note {
    margin-top: 0.8rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.social-quick {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.social-chip {
    padding: 0.45rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.84rem;
    transition: 0.2s ease;
}

.social-chip:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.section {
    margin-top: 2.2rem;
}

.section.compact {
    margin-top: 1.1rem;
}

.grid-1,
.grid-2,
.grid-3 {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.cv-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 1.2rem;
}

.cv-layout {
    display: grid;
    grid-template-columns: 1.45fr 1fr;
    gap: 1.2rem;
    align-items: start;
}

.cv-main-stack,
.cv-side-stack {
    display: grid;
    gap: 0.9rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    box-shadow: var(--shadow);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.card:hover {
    transform: translateY(-3px);
    border-color: var(--brand);
    box-shadow: 0 24px 50px rgba(12, 31, 61, 0.14);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 11px;
    border: 1px solid transparent;
    padding: 0.7rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    transition: 0.2s ease;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
}

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

.btn-outline:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.tag {
    display: inline-block;
    margin: 0 0.35rem 0.45rem 0;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.78rem;
    padding: 0.3rem 0.65rem;
}

.link-list {
    display: grid;
    gap: 0.6rem;
}

.link-list a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    background: var(--surface);
}

.link-list a:hover {
    border-color: var(--brand);
}

.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.filter-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--muted);
    cursor: pointer;
}

.filter-btn.active,
.filter-btn:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.mail-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
}

.mail-link:hover {
    border-color: var(--brand);
    color: var(--brand);
}

.copy-email {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    color: var(--muted);
    border-radius: 8px;
    padding: 0.4rem 0.55rem;
    font-size: 0.78rem;
    cursor: pointer;
}

.icon-inline {
    width: 18px;
    color: var(--brand);
    margin-right: 0.45rem;
}

.teaching-module {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: var(--surface);
}

.solution-toggle {
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    background: var(--surface-soft);
    padding: 0.55rem 0.7rem;
    width: 100%;
    margin-top: 0.6rem;
    cursor: pointer;
}

.solution-content {
    margin-top: 0.6rem;
    display: none;
    border-left: 3px solid var(--brand);
    padding: 0.7rem 0.8rem;
    background: var(--surface-soft);
    border-radius: 0 9px 9px 0;
}

.footer {
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    padding: 1rem 0 2rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.back-top {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    display: none;
    z-index: 999;
}

.back-top.show {
    display: inline-grid;
    place-items: center;
}

.mini-panel {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 0.85rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.mini-panel h4 {
    margin: 0 0 0.35rem;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.95rem;
}

.mini-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.surface-box {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    background: var(--surface);
}

.surface-box.soft-glow {
    background: linear-gradient(145deg, var(--surface), var(--surface-soft));
}

.headline-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.timeline {
    position: relative;
    display: grid;
    gap: 0.9rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 10px;
    bottom: 10px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-left: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 10px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface);
    border: 3px solid var(--brand);
}

.item-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.2rem;
}

.pub-grid {
    display: grid;
    gap: 0.9rem;
}

.pub-grid.tight {
    gap: 0.75rem;
}

.pub-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1rem;
    background: var(--surface);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.pub-card:hover {
    transform: translateY(-2px);
    border-color: var(--brand);
}

.pub-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.45rem;
}

.pub-title {
    font-size: 1.02rem;
    margin-bottom: 0.4rem;
}

.research-tools {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.8rem;
    align-items: center;
}

.research-search {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem 0.8rem;
    background: var(--surface);
    color: var(--text);
    outline: none;
}

.research-search:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 111, 255, 0.14);
}

.counter-badge {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    color: var(--muted);
}

.floating-orb {
    position: fixed;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.24;
    filter: blur(30px);
    transition: transform 0.35s ease;
}

.orb-a {
    background: radial-gradient(circle, rgba(15, 111, 255, 0.45), transparent 70%);
    top: 8%;
    left: 2%;
}

.orb-b {
    background: radial-gradient(circle, rgba(17, 160, 165, 0.45), transparent 70%);
    bottom: 8%;
    right: 2%;
}

.paper-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(250px, 320px);
    gap: 1rem;
}

.paper-side {
    display: grid;
    gap: 0.8rem;
    align-content: start;
}

.paper-side .card:first-child {
    position: sticky;
    top: calc(var(--header-h) + 1rem);
}

.skills-matrix {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
    margin-top: 0.35rem;
}

.skill-chip {
    border: 1px solid var(--border);
    background: var(--surface-soft);
    border-radius: 10px;
    padding: 0.5rem 0.65rem;
}

.skill-chip strong {
    display: block;
    font-size: 0.87rem;
}

.skill-chip span {
    color: var(--muted);
    font-size: 0.78rem;
}

.skill-bars {
    display: grid;
    gap: 0.65rem;
}

.skill-row {
    display: grid;
    gap: 0.35rem;
}

.skill-head {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    font-size: 0.84rem;
    color: var(--muted);
}

.skill-track {
    height: 9px;
    border-radius: 999px;
    background: var(--surface-soft);
    border: 1px solid var(--border);
    overflow: hidden;
}

.skill-fill {
    width: 0;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
    transition: width 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 1000px) {
    .hero-shell {
        grid-template-columns: 1fr;
    }

    .hero-side {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .paper-layout {
        grid-template-columns: 1fr;
    }

    .paper-side .card:first-child {
        position: static;
    }

    .grid-3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .site-nav {
        right: 2%;
        left: 2%;
        min-width: auto;
    }

    .index-avatar {
        width: 90px;
        height: 90px;
        justify-self: start;
    }

    .hero-side {
        grid-template-columns: 1fr;
    }

    .hero-metrics {
        grid-template-columns: 1fr;
    }

    .grid-2,
    .grid-3,
    .cv-grid,
    .cv-layout {
        grid-template-columns: 1fr;
    }

    .research-tools {
        grid-template-columns: 1fr;
    }

    .skills-matrix {
        grid-template-columns: 1fr;
    }

    .brand-text span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
