:root,
:root[data-theme="dark"] {
    --bg: #02040a;
    --bg-soft: #070b14;
    --card: rgba(255, 255, 255, 0.055);
    --card-strong: rgba(255, 255, 255, 0.09);
    --text: #f7fbff;
    --muted: #9aa4b2;
    --accent: #7c3aed;
    --accent-two: #10e7f4;
    --accent-two-ink: #10e7f4;
    --accent-three: #22c55e;
    --line: rgba(255, 255, 255, 0.12);
    --shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
    --surface-1: rgba(255, 255, 255, 0.055);
    --surface-2: rgba(255, 255, 255, 0.035);
    --surface-3: rgba(255, 255, 255, 0.06);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --header-bg: rgba(2, 4, 10, 0.78);
    --mobile-nav-bg: rgba(2, 4, 10, 0.96);
    --grid-line: rgba(255, 255, 255, 0.03);
    --h1-mid: #ffffff;
    --blob-1: rgba(124, 58, 237, 0.36);
    --blob-2: rgba(16, 231, 244, 0.20);
    --blob-3: rgba(34, 197, 94, 0.12);
    --terminal-text: #d9e0e8;
}

:root[data-theme="light"] {
    --bg: #f3f5f9;
    --bg-soft: #ffffff;
    --card: rgba(15, 23, 42, 0.045);
    --card-strong: rgba(15, 23, 42, 0.075);
    --text: #0b0f19;
    --muted: #565f70;
    --accent: #7c3aed;
    --accent-two: #10e7f4;
    --accent-two-ink: #0e7490;
    --accent-three: #16a34a;
    --line: rgba(15, 23, 42, 0.11);
    --shadow: 0 30px 80px rgba(15, 23, 42, 0.12);
    --surface-1: rgba(15, 23, 42, 0.04);
    --surface-2: rgba(15, 23, 42, 0.025);
    --surface-3: rgba(15, 23, 42, 0.05);
    --surface-hover: rgba(15, 23, 42, 0.065);
    --header-bg: rgba(255, 255, 255, 0.78);
    --mobile-nav-bg: rgba(255, 255, 255, 0.97);
    --grid-line: rgba(15, 23, 42, 0.035);
    --h1-mid: #0b0f19;
    --blob-1: rgba(124, 58, 237, 0.16);
    --blob-2: rgba(16, 231, 244, 0.14);
    --blob-3: rgba(34, 197, 94, 0.10);
    --terminal-text: #1c2333;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(circle at center, black 30%, transparent 80%);
    pointer-events: none;
    z-index: 0;
}

.page-bg {
    position: fixed;
    inset: 0;
    background:
        radial-gradient(circle at 14% 18%, var(--blob-1), transparent 34%),
        radial-gradient(circle at 86% 10%, var(--blob-2), transparent 32%),
        radial-gradient(circle at 60% 88%, var(--blob-3), transparent 30%);
    pointer-events: none;
    z-index: 0;
}

.cursor-glow {
    position: fixed;
    width: 360px;
    height: 360px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(16, 231, 244, 0.13), transparent 70%);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1;
}

.site-header {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(1120px, calc(100% - 32px));
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--header-bg);
    backdrop-filter: blur(22px);
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.25);
    transition: background 0.3s ease, border-color 0.3s ease;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
}

.brand span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-two));
    box-shadow: 0 0 30px rgba(16, 231, 244, 0.28);
}

.nav {
    display: flex;
    gap: 6px;
}

.nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    padding: 9px 13px;
    border-radius: 999px;
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.nav a:hover,
.nav a:focus,
.nav a.active-link {
    color: var(--text);
    background: var(--surface-hover);
    outline: none;
    transform: translateY(-1px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.theme-toggle,
.menu-btn {
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 18px;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover,
.menu-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.menu-btn {
    display: none;
    font-size: 22px;
}

.theme-toggle .sun { display: none; }
.theme-toggle .moon { display: inline; }
:root[data-theme="light"] .theme-toggle .sun { display: inline; }
:root[data-theme="light"] .theme-toggle .moon { display: none; }

.section {
    position: relative;
    z-index: 2;
    padding: 116px 8%;
}

.hero {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 0.95fr;
    gap: 56px;
    align-items: center;
    padding-top: 150px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-1);
    color: var(--muted);
    font-size: 14px;
    margin-bottom: 24px;
}

.pill span {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent-three);
    box-shadow: 0 0 18px var(--accent-three);
}

.eyebrow,
.section-title p,
.card-top b,
.work-card span,
time {
    color: var(--accent-two-ink);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
}

h1 {
    max-width: 900px;
    font-size: clamp(46px, 8vw, 100px);
    line-height: 0.93;
    letter-spacing: -0.075em;
    margin: 12px 0 22px;
}

h1 em {
    font-style: normal;
    color: transparent;
    background: linear-gradient(135deg, var(--accent-two), var(--h1-mid) 42%, var(--accent));
    background-clip: text;
    -webkit-background-clip: text;
}

.hero-text {
    max-width: 740px;
    color: var(--muted);
    font-size: clamp(17px, 2vw, 21px);
    margin-bottom: 30px;
}

.hero-actions,
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.btn,
.contact-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 16px;
    text-decoration: none;
    font-weight: 800;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.primary,
.contact-links a:first-child {
    color: #071018;
    background: linear-gradient(135deg, var(--accent-two), #ffffff);
    box-shadow: 0 16px 50px rgba(16, 231, 244, 0.18);
}

.secondary,
.contact-links a:not(:first-child) {
    color: var(--text);
    border: 1px solid var(--line);
    background: var(--card);
}

.btn:hover,
.contact-links a:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 60px rgba(16, 231, 244, 0.16);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 14px;
    margin-top: 26px;
}

.hero-meta span {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 12px;
    background: var(--surface-2);
}

.hero-panel {
    display: grid;
    gap: 18px;
}

.terminal-card,
.glass-card,
.project-card,
.skill-box,
.research-card,
.work-card,
.contact-card,
.quick-stats div {
    border: 1px solid var(--line);
    background: linear-gradient(180deg, var(--card-strong), var(--surface-2));
    box-shadow: var(--shadow);
    backdrop-filter: blur(22px);
}

.terminal-card {
    border-radius: 30px;
    padding: 28px;
    font-family: 'JetBrains Mono', monospace;
    position: relative;
    overflow: hidden;
}

.terminal-card::after,
.project-card::after,
.research-card::after,
.work-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 10% 0%, rgba(16, 231, 244, 0.12), transparent 35%);
    opacity: 0;
    transition: opacity 0.25s ease;
    pointer-events: none;
}

.terminal-card:hover::after,
.project-card:hover::after,
.research-card:hover::after,
.work-card:hover::after {
    opacity: 1;
}

.terminal-top {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
}

.terminal-top span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent-two);
}

.terminal-card p {
    margin: 10px 0;
    color: var(--terminal-text);
}

.terminal-card .cmd {
    color: var(--muted);
}

.quick-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.quick-stats div {
    border-radius: 24px;
    padding: 22px;
}

.quick-stats strong {
    display: block;
    font-size: 34px;
    line-height: 1;
}

.quick-stats span {
    color: var(--muted);
    font-size: 14px;
}

.section-title {
    max-width: 820px;
    margin-bottom: 42px;
}

.section-title.center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.section-title h2,
.contact-card h2 {
    font-size: clamp(34px, 5vw, 58px);
    line-height: 1.04;
    letter-spacing: -0.05em;
    margin: 8px 0 12px;
}

.section-title span {
    color: var(--muted);
    font-size: 17px;
}

.about-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 22px;
}

.glass-card {
    border-radius: 30px;
    padding: 30px;
}

.glass-card h3,
.skill-box h3,
.project-card h3,
.research-card h3,
.work-card h3 {
    font-size: 22px;
    line-height: 1.22;
    margin-bottom: 12px;
}

.glass-card p,
.project-card p,
.skill-box p,
.research-card p,
.work-card p,
.contact-card p {
    color: var(--muted);
}

.glass-card p + p {
    margin-top: 14px;
}

.focus-list,
.tags,
.mini-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.focus-list span,
.tags span,
.mini-tags b {
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-3);
    padding: 7px 11px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
}

.project-card {
    grid-column: span 2;
    min-height: 300px;
    border-radius: 30px;
    padding: 26px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}

.project-card.featured {
    grid-column: span 4;
}

.project-card:hover,
.skill-box:hover,
.research-card:hover,
.work-card:hover {
    transform: translateY(-6px);
    border-color: rgba(16, 231, 244, 0.45);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.card-top span {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    color: var(--text);
    background: rgba(16, 231, 244, 0.10);
    border: 1px solid rgba(16, 231, 244, 0.25);
    font-family: 'JetBrains Mono', monospace;
}

.tags {
    margin-top: 22px;
}

.skills-grid,
.research-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.skill-box,
.research-card {
    border-radius: 28px;
    padding: 26px;
    position: relative;
    overflow: hidden;
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.research-card {
    min-height: 255px;
}

.research-card time {
    display: inline-block;
    margin-bottom: 14px;
}

.timeline-wrap {
    position: relative;
    max-width: 1080px;
    margin: 0 auto;
    padding: 16px 0;
}

.timeline-line {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: linear-gradient(var(--accent-two), var(--accent), var(--accent-two));
    box-shadow: 0 0 28px rgba(16, 231, 244, 0.35);
}

.work-card {
    position: relative;
    width: calc(50% - 44px);
    border-radius: 26px;
    padding: 28px;
    margin: 30px 0;
    transition: transform 0.25s ease, border-color 0.25s ease;
    overflow: visible;
}

.work-card.left {
    margin-right: auto;
}

.work-card.right {
    margin-left: auto;
}

.work-card .dot {
    position: absolute;
    top: 28px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg);
    border: 3px solid var(--accent-two);
    box-shadow: 0 0 20px rgba(16, 231, 244, 0.75);
}

.work-card.left .dot {
    right: -53px;
}

.work-card.right .dot {
    left: -53px;
}

.work-card h4 {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
}

.mini-tags {
    margin-top: 18px;
}

.contact-card {
    max-width: 960px;
    margin: 0 auto;
    border-radius: 34px;
    padding: 38px;
    text-align: center;
}

.contact-card > p:last-of-type {
    max-width: 760px;
    margin: 0 auto 26px;
    font-size: 18px;
}

.contact-links {
    justify-content: center;
}

footer {
    position: relative;
    z-index: 2;
    padding: 34px 8%;
    color: var(--muted);
    text-align: center;
    border-top: 1px solid var(--line);
}

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

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

@media (max-width: 1080px) {
    .hero,
    .about-grid {
        grid-template-columns: 1fr;
    }

    .project-card,
    .project-card.featured {
        grid-column: span 3;
    }

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

@media (max-width: 820px) {
    .section {
        padding: 92px 6%;
    }

    .site-header {
        top: 10px;
    }

    .nav {
        position: absolute;
        top: 66px;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        padding: 18px;
        border-radius: 24px;
        background: var(--mobile-nav-bg);
        border: 1px solid var(--line);
    }

    .nav.open {
        display: flex;
    }

    .menu-btn {
        display: grid;
    }

    .project-grid,
    .skills-grid,
    .research-grid {
        grid-template-columns: 1fr;
    }

    .project-card,
    .project-card.featured {
        grid-column: span 1;
    }

    .timeline-line {
        left: 10px;
    }

    .work-card,
    .work-card.left,
    .work-card.right {
        width: calc(100% - 42px);
        margin-left: 42px;
        margin-right: 0;
    }

    .work-card.left .dot,
    .work-card.right .dot {
        left: -40px;
        right: auto;
    }
}

@media (max-width: 560px) {
    h1 {
        font-size: 46px;
    }

    .quick-stats {
        grid-template-columns: 1fr;
    }

    .contact-card {
        padding: 28px 20px;
    }
}
