:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --surface-strong: #ffffff;
    --ink: #18181b;
    --muted: #52525b;
    --soft: #a1a1aa;
    --line: #e4e4e7;
    --line-strong: #d4d4d8;
    --accent: #3b82f6;
    --accent-ink: #1d4ed8;
    --accent-soft: #dbeafe;
    --rust: #f97316;
    --blue: #0891b2;
    --slate: #64748b;
    --yellow: #f59e0b;
    --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
    --page-start: #ffffff;
    --nav-bg: rgba(250, 250, 250, 0.88);
    --profile-card-bg: #f4f4f5;
    --contact-start: #0f172a;
    --contact-end: #1e3a8a;
    --button-primary-text: #ffffff;
    --accent-wash: rgba(59, 130, 246, 0.1);
    --accent-border: rgba(59, 130, 246, 0.2);
    --chip-bg: rgba(219, 234, 254, 0.65);
    --radius: 12px;
    --max: 1180px;
    --font-body: "Instrument Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-strong: #f8fafc;
    --ink: #f8fafc;
    --muted: #94a3b8;
    --soft: #64748b;
    --line: #334155;
    --line-strong: #475569;
    --accent: #60a5fa;
    --accent-ink: #bfdbfe;
    --accent-soft: rgba(59, 130, 246, 0.18);
    --rust: #fb923c;
    --blue: #22d3ee;
    --slate: #94a3b8;
    --yellow: #fbbf24;
    --shadow: 0 18px 52px rgba(0, 0, 0, 0.34);
    --page-start: #111827;
    --nav-bg: rgba(15, 23, 42, 0.9);
    --profile-card-bg: #0f172a;
    --contact-start: #020617;
    --contact-end: #1e3a8a;
    --button-primary-text: #ffffff;
    --accent-wash: rgba(59, 130, 246, 0.15);
    --accent-border: rgba(59, 130, 246, 0.28);
    --chip-bg: rgba(59, 130, 246, 0.12);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 92px;
}

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background:
        linear-gradient(180deg, var(--page-start) 0, var(--bg) 680px),
        var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 300ms ease, color 300ms ease;
}

body.nav-open {
    overflow: hidden;
}

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

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

button {
    font: inherit;
}

::selection {
    color: var(--surface);
    background: var(--accent);
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.35);
    outline-offset: 3px;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: min(calc(100% - 32px), var(--max));
    height: 72px;
    margin: 14px auto 0;
    padding: 0 12px 0 18px;
    background: var(--nav-bg);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 12px 34px rgba(16, 24, 40, 0.08);
    backdrop-filter: blur(18px);
    transition: background-color 300ms ease, border-color 300ms ease;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    letter-spacing: 0;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    color: #ffffff;
    background: var(--accent);
    border-radius: 50%;
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

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

.site-nav a {
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 650;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--accent-ink);
    background: var(--accent-wash);
}

.site-nav .btn-resume {
    display: inline-flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    margin-left: 6px;
    color: var(--accent-ink);
    background: var(--accent-wash);
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 700;
    transition: background 160ms ease;
}

.site-nav .btn-resume:hover {
    background: var(--accent-soft);
    color: var(--accent-ink);
}

.nav-toggle {
    display: none;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface);
}

.theme-toggle {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
}

.theme-toggle-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ink);
    box-shadow: inset -6px -4px 0 var(--surface);
}

:root[data-theme="dark"] .theme-toggle-icon {
    background: var(--yellow);
    box-shadow:
        0 0 0 3px rgba(251, 191, 36, 0.2),
        0 -8px 0 0 var(--yellow),
        0 8px 0 0 var(--yellow),
        8px 0 0 0 var(--yellow),
        -8px 0 0 0 var(--yellow);
    border-radius: 50%;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--ink);
    transition: transform 180ms ease;
}

.nav-toggle span + span {
    margin-top: 5px;
}

.section-pad {
    width: min(calc(100% - 32px), var(--max));
    margin: 0 auto;
    padding: 86px 0;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) 390px;
    gap: 58px;
    align-items: center;
    min-height: calc(100vh - 90px);
    padding-top: 70px;
}

.eyebrow,
.mono-label,
.project-label,
.date {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.eyebrow,
.project-label,
.date {
    color: var(--accent);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    max-width: 780px;
    margin-bottom: 24px;
    font-size: clamp(3.1rem, 6.4vw, 6.2rem);
    line-height: 0.95;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 18px;
    font-size: clamp(2rem, 3.4vw, 3.35rem);
    line-height: 1.05;
    letter-spacing: 0;
}

h3 {
    margin-bottom: 10px;
    font-size: 1.28rem;
    line-height: 1.2;
}

.hero-text {
    max-width: 760px;
    margin-bottom: 28px;
    color: var(--muted);
    font-size: 1.16rem;
}

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

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-weight: 750;
    box-shadow: none;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.button:hover {
    transform: translateY(-2px);
}

.button-primary {
    color: var(--button-primary-text);
    background: var(--accent);
}

.button-primary:hover {
    background: var(--accent-ink);
}

.button-secondary {
    color: var(--accent-ink);
    background: var(--accent-wash);
    border-color: var(--accent-border);
}

.button-quiet {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line-strong);
}

.hero-proof {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    max-width: 760px;
    margin-top: 28px;
}

.hero-proof div {
    min-height: 104px;
    padding: 16px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 12px 30px rgba(16, 24, 40, 0.05);
}

.hero-proof strong,
.hero-proof span {
    display: block;
}

.hero-proof strong {
    margin-bottom: 8px;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 2.4vw, 1.55rem);
    line-height: 1.1;
}

.hero-proof span {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.35;
}

.profile-panel {
    position: relative;
    display: grid;
    gap: 14px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: var(--shadow);
    transition: background-color 300ms ease, border-color 300ms ease;
}

.portrait-wrap {
    overflow: hidden;
    aspect-ratio: 4 / 5;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: none;
}

.portrait-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 28%;
    filter: saturate(0.96) contrast(1.03);
}

.profile-card {
    position: static;
    width: auto;
    padding: 18px;
    background: var(--profile-card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: none;
    transition: background-color 300ms ease, border-color 300ms ease;
}

.signal-card {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 2px;
    color: var(--accent-ink);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.signal-card span {
    padding: 5px 9px;
    background: var(--accent-soft);
    border-radius: 999px;
}

.profile-card ul {
    display: grid;
    gap: 10px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.profile-card li {
    color: var(--muted);
    font-size: 0.94rem;
}

.profile-card span {
    display: inline-block;
    min-width: 74px;
    color: var(--ink);
    font-weight: 750;
}

.section-heading {
    max-width: 780px;
    margin-bottom: 34px;
}

.section-heading h2 {
    margin-bottom: 0;
}

.bento-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 14px;
}

.bento-card,
.project-card,
.timeline-item,
.education-panel,
.skills-panel,
.contact-inner {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 14px 38px rgba(16, 24, 40, 0.06);
    transition: background-color 300ms ease, border-color 300ms ease;
}

.bento-card {
    min-height: 220px;
    padding: 26px;
}

.bento-large {
    grid-row: span 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-height: 454px;
    color: var(--surface-strong);
    background: linear-gradient(135deg, #111827, #1e3a8a);
    border-color: transparent;
}

.bento-large .mono-label,
.bento-large p {
    color: rgba(255, 250, 241, 0.76);
}

.bento-large h3 {
    max-width: 690px;
    font-size: clamp(2rem, 4vw, 4rem);
    line-height: 1;
}

.bento-card:not(.bento-large) h3 {
    color: var(--accent-ink);
}

.bento-card p {
    color: var(--muted);
}

.project-stack {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.project-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 300ms ease, color 300ms ease;
}

.project-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent-border);
    box-shadow: 0 22px 50px rgba(16, 24, 40, 0.1);
}

.project-copy {
    padding: 32px;
}

.project-copy p {
    color: var(--muted);
}

.project-note {
    padding-left: 14px;
    color: var(--ink) !important;
    border-left: 3px solid var(--accent);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
}

.tag-row span,
.focus-grid span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 10px;
    border: 1px solid var(--accent-border);
    border-radius: 999px;
    color: var(--accent-ink);
    background: var(--chip-bg);
    font-family: var(--font-mono);
    font-size: 0.76rem;
    font-weight: 600;
}

.project-course {
    margin-top: 12px;
    margin-bottom: 0;
    color: var(--soft);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
}

.github-more {
    margin-top: 12px;
    text-align: right;
    color: var(--muted);
    font-size: 0.92rem;
}

.github-more a {
    color: var(--accent-ink);
    font-weight: 750;
}


.timeline {
    display: grid;
    gap: 14px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    gap: 28px;
    padding: 28px;
}

.timeline-item h3 {
    margin-bottom: 4px;
}

.place,
.timeline-item p,
.timeline-item li {
    color: var(--muted);
}

.timeline-item ul {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding-left: 18px;
}

.education-skills {
    display: grid;
    grid-template-columns: 1fr;
    gap: 22px;
    align-items: start;
}

.education-panel,
.skills-panel {
    padding: 32px;
}

.degree {
    color: var(--muted);
    font-weight: 650;
}

.focus-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 24px 0;
}

.achievement-list {
    display: grid;
    gap: 8px;
    padding-bottom: 20px;
    margin-bottom: 4px;
    border-bottom: 1px solid var(--line);
}

.achievement-list p {
    margin-bottom: 0;
    color: var(--muted);
}

.skill-domain-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 18px;
}

.skill-domain {
    padding: 18px 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.05);
    transition: transform 160ms ease, box-shadow 160ms ease, background-color 300ms ease, border-color 300ms ease;
}

.skill-domain:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 42px rgba(16, 24, 40, 0.1);
}

.skill-domain--backend { border-left-color: var(--accent); }
.skill-domain--systems { border-left-color: var(--slate); }
.skill-domain--data    { border-left-color: var(--rust); }
.skill-domain--tools   { border-left-color: var(--blue); }

.skill-domain h3 {
    margin-bottom: 4px;
    font-size: 1rem;
    color: var(--ink);
}

.skill-domain-desc {
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 14px;
}

.contact {
    padding-bottom: 60px;
}

.contact-inner {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(340px, 0.7fr);
    gap: 36px;
    align-items: start;
    padding: clamp(32px, 6vw, 64px);
    color: var(--surface-strong);
    background: linear-gradient(135deg, var(--contact-start), var(--contact-end));
    border-color: transparent;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.16);
}

.contact-inner .eyebrow,
.contact-inner p {
    color: rgba(255, 250, 241, 0.72);
}

.contact-inner h2 {
    max-width: 900px;
}

.contact-copy {
    max-width: 680px;
}

.contact-email {
    display: inline-block;
    margin: 12px 0 20px;
    color: var(--surface-strong);
    font-weight: 600;
    font-size: 1rem;
    opacity: 0.9;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.contact-inner .button-secondary {
    color: var(--surface-strong);
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.18);
}

.contact-form {
    display: grid;
    gap: 14px;
    padding: 22px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.contact-form label {
    display: grid;
    gap: 7px;
}

.contact-form span {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 750;
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 12px 13px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: none;
    resize: vertical;
}

.contact-form input:focus,
.contact-form textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-wash);
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    width: min(calc(100% - 32px), var(--max));
    margin: 0 auto;
    padding: 26px 0 42px;
    color: var(--muted);
    border-top: 1px solid var(--line);
    font-size: 0.92rem;
}

.site-footer p {
    margin: 0;
}

.site-footer a {
    color: var(--accent-ink);
    font-weight: 750;
}

.back-to-top {
    padding: 0;
    color: var(--accent-ink);
    background: none;
    border: 0;
    cursor: pointer;
    font-weight: 750;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 920px) {
    .site-header {
        height: 64px;
    }

    .nav-toggle {
        display: grid;
    }

    .site-nav {
        position: fixed;
        top: 88px;
        left: 16px;
        right: 16px;
        display: none;
        flex-direction: column;
        align-items: stretch;
        padding: 12px;
        background: var(--surface-strong);
        border: 1px solid var(--line);
        border-radius: 16px;
        box-shadow: var(--shadow);
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 14px;
    }

    .site-nav .btn-resume {
        margin-left: 0;
        height: auto;
        padding: 14px;
        border-radius: 6px;
        text-align: center;
        justify-content: center;
    }

    .hero,
    .timeline-item,
    .contact-inner,
    .education-skills {
        grid-template-columns: 1fr;
    }

    .project-stack {
        grid-template-columns: 1fr;
    }

    .hero {
        gap: 42px;
        min-height: auto;
    }

    .profile-panel {
        max-width: 460px;
    }

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

    .profile-card {
        margin: 0;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .bento-large {
        min-height: 360px;
    }

    .timeline-item {
        gap: 12px;
    }
}

@media (max-width: 640px) {
    .section-pad {
        width: min(calc(100% - 24px), var(--max));
        padding: 62px 0;
    }

    .site-header {
        width: min(calc(100% - 24px), var(--max));
        margin-top: 12px;
    }

    .brand span:last-child {
        display: none;
    }

    h1 {
        font-size: clamp(3rem, 16vw, 4.2rem);
    }

    h2 {
        font-size: 2.2rem;
    }

    .hero-actions,
    .contact-actions {
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .hero-proof div {
        min-height: auto;
    }

    .signal-card {
        margin: 0;
    }

    .bento-card,
    .project-copy,
    .timeline-item,
    .education-panel,
    .skills-panel,
    .contact-form {
        padding: 22px;
    }

    .bento-large h3 {
        font-size: 2.3rem;
    }

    .skill-domain-grid {
        grid-template-columns: 1fr;
    }

    .site-footer {
        flex-direction: column;
        width: min(calc(100% - 24px), var(--max));
    }
}

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