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

:root {
    --navy-950: #070f1f;
    --navy-900: #0b1730;
    --navy-800: #11224a;
    --navy-700: #1a3163;
    --gold: #d9b25f;
    --gold-bright: #f0cf85;
    --brown: #8a5a3b;
    --brown-light: #c39a74;
    --brown-deep: #1d1410;
    --cream: #f4ecdc;
    --muted: #a9b3c7;
    --line: rgba(217, 178, 95, 0.18);
    --line-soft: rgba(244, 236, 220, 0.09);

    --font-display: 'Fraunces', Georgia, serif;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;

    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --wrap: 1120px;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    font-family: var(--font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    color: var(--cream);
    background-color: var(--navy-950);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

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

ul,
ol {
    list-style: none;
}

::selection {
    background: var(--gold);
    color: var(--navy-950);
}

:focus-visible {
    outline: 2px solid var(--gold-bright);
    outline-offset: 3px;
    border-radius: 4px;
}

.wrap {
    width: min(var(--wrap), 100% - 3rem);
    margin-inline: auto;
}

.gold-text {
    background: linear-gradient(100deg, var(--gold-bright), var(--gold) 45%, var(--brown-light));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -4rem;
    z-index: 200;
    padding: 0.6rem 1rem;
    background: var(--gold);
    color: var(--navy-950);
    border-radius: 6px;
    font-weight: 600;
}

.skip-link:focus {
    top: 1rem;
}

/* Scroll progress */
.scroll-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 120;
    background: linear-gradient(90deg, var(--brown), var(--gold), var(--gold-bright));
    transform: scaleX(0);
    transform-origin: left;
}

/* Reveal on scroll (only hidden when JS is running) */
.js .reveal {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
    transition-delay: var(--d, 0ms);
}

.js .reveal.in {
    opacity: 1;
    transform: none;
}

/* NAV */
.nav {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    transition: background-color 0.4s, border-color 0.4s, backdrop-filter 0.4s;
    border-bottom: 1px solid transparent;
}

.nav.scrolled {
    background-color: rgba(7, 15, 31, 0.78);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom-color: var(--line-soft);
}

.nav-inner {
    width: min(var(--wrap), 100% - 3rem);
    margin-inline: auto;
    height: 4.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    color: var(--gold);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
    font-size: 0.92rem;
    font-weight: 500;
}

.nav-links a {
    position: relative;
    color: var(--muted);
    transition: color 0.25s;
}

.nav-links a:not(.nav-cta)::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    height: 1px;
    background: var(--gold);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.35s var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--cream);
}

.nav-links a.active::after,
.nav-links a:hover::after {
    transform: scaleX(1);
}

.nav-links .nav-cta {
    padding: 0.45rem 1.05rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--gold);
    transition: background-color 0.25s, color 0.25s;
}

.nav-links .nav-cta:hover,
.nav-links .nav-cta.active {
    background: var(--gold);
    color: var(--navy-950);
}

.nav-toggle {
    display: none;
    width: 2.75rem;
    height: 2.75rem;
    -webkit-tap-highlight-color: transparent;
    background: none;
    border: 0;
    cursor: pointer;
    position: relative;
}

.nav-toggle span {
    position: absolute;
    left: 0.65rem;
    right: 0.65rem;
    height: 2px;
    background: var(--cream);
    transition: transform 0.3s var(--ease), top 0.3s var(--ease);
}

.nav-toggle span:first-child {
    top: 1.05rem;
}

.nav-toggle span:last-child {
    top: 1.6rem;
}

.nav-toggle[aria-expanded='true'] span:first-child {
    top: 1.33rem;
    transform: rotate(45deg);
}

.nav-toggle[aria-expanded='true'] span:last-child {
    top: 1.33rem;
    transform: rotate(-45deg);
}

/* HERO */
.hero {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4rem;
    padding: 8rem 0 4rem;
    background:
        radial-gradient(120% 80% at 80% 0%, var(--navy-800) 0%, transparent 60%),
        linear-gradient(180deg, var(--navy-900), var(--navy-950));
    overflow: hidden;
}

.hero-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.7;
}

.hero-glow {
    position: absolute;
    width: 46rem;
    height: 46rem;
    right: -14rem;
    top: -10rem;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(138, 90, 59, 0.34), transparent 62%);
    filter: blur(20px);
    animation: drift 16s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes drift {
    to {
        transform: translate(-5rem, 4rem) scale(1.12);
    }
}

.hero-grid {
    position: relative;
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    align-items: center;
    gap: 4rem;
}

.eyebrow,
.section-kicker,
.card-tag,
.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--gold);
}

.hero-name {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3.2rem, 9vw, 6.5rem);
    line-height: 0.98;
    letter-spacing: -0.03em;
    margin-top: 1rem;
}

.hero-role {
    margin-top: 1.4rem;
    min-height: 2em;
    font-family: var(--font-mono);
    font-size: clamp(1rem, 2.2vw, 1.3rem);
    color: var(--brown-light);
}

.caret {
    display: inline-block;
    width: 0.55em;
    height: 1.1em;
    margin-left: 0.15em;
    vertical-align: text-bottom;
    background: var(--gold);
    animation: blink 1.05s steps(1) infinite;
}

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

.hero-lede {
    margin-top: 1.2rem;
    max-width: 34rem;
    font-size: 1.14rem;
    color: var(--muted);
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.97rem;
    border: 1px solid transparent;
    transition: transform 0.3s var(--ease), box-shadow 0.3s, background-color 0.3s, border-color 0.3s, color 0.3s;
}

.btn svg {
    width: 1.1rem;
    height: 1.1rem;
    fill: currentColor;
}

@media (hover: hover) {
    .btn:hover {
        transform: translateY(-3px);
    }
}

.btn-primary {
    background: linear-gradient(120deg, var(--gold-bright), var(--gold));
    color: var(--navy-950);
    box-shadow: 0 10px 30px -12px rgba(217, 178, 95, 0.7);
}

.btn-primary:hover {
    box-shadow: 0 16px 36px -10px rgba(217, 178, 95, 0.85);
}

.btn-ghost {
    border-color: var(--line);
    color: var(--cream);
}

.btn-ghost:hover {
    border-color: var(--gold);
    color: var(--gold-bright);
}

/* Portrait */
.hero-portrait {
    position: relative;
    width: min(100%, 21rem);
    aspect-ratio: 1;
    justify-self: end;
}

.portrait-ring {
    position: absolute;
    inset: -14px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--gold-bright), transparent 28%, var(--brown) 52%, transparent 76%, var(--gold-bright));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
    animation: spin 14s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.portrait-frame {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background: var(--navy-800);
    box-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
}

/* The source photo has a dark oval mat; zoom in so only the photo shows. */
.portrait-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 48%;
    transform: scale(1.16);
}

/* Stats */
.stats {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--line);
}

.stats li {
    padding: 1.6rem 1.5rem 0 0;
}

.stats li + li {
    padding-left: 1.5rem;
    border-left: 1px solid var(--line-soft);
}

.stat-num {
    display: block;
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 2.9rem);
    font-weight: 600;
    line-height: 1.1;
    color: var(--gold-bright);
    font-variant-numeric: tabular-nums;
}

.stat-label {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--muted);
}

/* SECTIONS */
.section {
    position: relative;
    padding: clamp(5rem, 11vw, 8.5rem) 0;
}

.section-warm {
    background:
        radial-gradient(90% 70% at 0% 0%, rgba(138, 90, 59, 0.2), transparent 60%),
        linear-gradient(180deg, var(--brown-deep), #120f14 55%, var(--navy-950));
    border-block: 1px solid var(--line-soft);
}

.section-title {
    margin-top: 0.9rem;
    max-width: 18ch;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(2.1rem, 5vw, 3.4rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
}

/* Chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.chips li {
    padding: 0.38rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.87rem;
    color: var(--cream);
    background: rgba(217, 178, 95, 0.05);
    transition: transform 0.3s var(--ease), background-color 0.3s, border-color 0.3s;
}

@media (hover: hover) {
    .chips li:hover {
        transform: translateY(-2px);
        background: rgba(217, 178, 95, 0.14);
        border-color: var(--gold);
    }
}

.chips-sm li {
    padding: 0.22rem 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--brown-light);
    border-color: rgba(195, 154, 116, 0.28);
    background: transparent;
}

/* ABOUT */
.about-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: clamp(2.5rem, 6vw, 5rem);
    margin-top: 3.2rem;
}

.about-copy p {
    color: var(--muted);
    font-size: 1.1rem;
}

.about-copy p + p {
    margin-top: 1.3rem;
}

.about-copy p:first-child {
    color: var(--cream);
}

.skills {
    display: grid;
    gap: 2rem;
    align-content: start;
}

.skill-group h3,
.edu-card h4 {
    margin-bottom: 0.9rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--brown-light);
}

/* TIMELINE */
.timeline {
    position: relative;
    margin-top: 3.5rem;
    padding-left: 2.6rem;
    display: grid;
    gap: 3.2rem;
}

.timeline::before,
.timeline-fill {
    content: '';
    position: absolute;
    left: 6px;
    top: 0.5rem;
    bottom: 0;
    width: 2px;
    border-radius: 2px;
}

.timeline::before {
    background: var(--line-soft);
}

.timeline-fill {
    background: linear-gradient(180deg, var(--gold-bright), var(--brown));
    transform: scaleY(var(--progress, 0));
    transform-origin: top;
}

.timeline-item {
    position: relative;
    max-width: 46rem;
}

.timeline-dot {
    position: absolute;
    left: -2.6rem;
    top: 0.42rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brown-deep);
    border: 2px solid var(--gold);
    box-shadow: 0 0 0 5px rgba(217, 178, 95, 0.12);
    z-index: 1;
}

.timeline-item h3,
.edu-card h3 {
    margin-top: 0.5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.55rem;
    line-height: 1.25;
}

.timeline-org {
    margin-top: 0.15rem;
    font-weight: 500;
    color: var(--brown-light);
}

.timeline-item ul {
    margin-top: 1rem;
    display: grid;
    gap: 0.6rem;
}

.timeline-item li,
.card-points li,
.edu-list li {
    position: relative;
    padding-left: 1.25rem;
    color: var(--muted);
    font-size: 0.99rem;
    line-height: 1.6;
}

.timeline-item li::before,
.card-points li::before,
.edu-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.68em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0.75;
}

/* PROJECTS */
.projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-top: 3.2rem;
}

.card {
    --mx: 50%;
    --my: 0%;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 2rem;
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    background: linear-gradient(160deg, rgba(26, 49, 99, 0.42), rgba(11, 23, 48, 0.6));
    overflow: hidden;
    transition: opacity 0.9s var(--ease), transform 0.5s var(--ease), border-color 0.4s, box-shadow 0.4s;
}

/* Gold spotlight that follows the pointer */
.card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(420px circle at var(--mx) var(--my), rgba(217, 178, 95, 0.16), transparent 60%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.card:hover {
    border-color: var(--line);
    box-shadow: 0 30px 60px -35px rgba(0, 0, 0, 0.9);
}

@media (hover: hover) {
    .js .card.in:hover {
        transform: translateY(-6px);
        transition-delay: 0ms;
    }
}

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

.card > * {
    position: relative;
}

.card-body {
    flex: 1;
}

.card h3 {
    margin-top: 0.6rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.75rem;
    line-height: 1.2;
}

.card-desc {
    margin-top: 0.8rem;
    color: var(--muted);
    font-size: 1rem;
}

.card-points {
    margin: 1.2rem 0 1.4rem;
    display: grid;
    gap: 0.45rem;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.6rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--line-soft);
}

.repo-meta {
    font-family: var(--font-mono);
    font-size: 0.74rem;
    color: var(--muted);
}

.card-link {
    margin-left: auto;
    font-weight: 600;
    font-size: 0.93rem;
    color: var(--gold);
    white-space: nowrap;
    transition: color 0.25s;
}

.card-link span {
    display: inline-block;
    transition: transform 0.3s var(--ease);
}

.card-link:hover {
    color: var(--gold-bright);
}

.card-link:hover span {
    transform: translate(3px, -3px);
}

.card-featured {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    column-gap: 2.5rem;
    border-color: var(--line);
    background: linear-gradient(140deg, rgba(138, 90, 59, 0.22), rgba(17, 34, 74, 0.55) 55%);
}

.card-featured h3 {
    font-size: 2.2rem;
}

.card-featured .card-foot {
    grid-column: 1 / -1;
}

.card-side {
    display: flex;
    align-items: center;
}

.testrun {
    width: 100%;
    padding: 1.2rem 1.3rem 1.4rem;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
    background: rgba(7, 15, 31, 0.75);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 2;
    color: var(--muted);
}

.testrun-head {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0.5rem;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.testrun-head span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--brown);
}

.testrun-head span:nth-child(3) {
    margin-right: 0.5rem;
    background: var(--gold);
}

.testrun p {
    display: flex;
    gap: 0.6rem;
}

.testrun b {
    color: #8fd19e;
    font-weight: 500;
}

.testrun i {
    margin-left: auto;
    font-style: normal;
    color: var(--cream);
}

.testrun-cov {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px dashed var(--line-soft);
}

.testrun-bar {
    height: 6px;
    margin-top: 0.4rem;
    border-radius: 6px;
    background: var(--line-soft);
    overflow: hidden;
}

.testrun-bar span {
    display: block;
    width: 99%;
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, var(--brown), var(--gold-bright));
    transform-origin: left;
}

.js .testrun-bar span {
    transform: scaleX(0);
    transition: transform 1.6s var(--ease) 1.2s;
}

.js .card.in .testrun-bar span {
    transform: none;
}

.js .testrun p:not(.testrun-head) {
    opacity: 0;
    transition: opacity 0.5s;
}

.js .card.in .testrun p {
    opacity: 1;
}

.js .card.in .testrun p:nth-child(2) { transition-delay: 0.3s; }
.js .card.in .testrun p:nth-child(3) { transition-delay: 0.55s; }
.js .card.in .testrun p:nth-child(4) { transition-delay: 0.8s; }
.js .card.in .testrun p:nth-child(5) { transition-delay: 1.05s; }

.card-more {
    background: transparent;
    border-style: dashed;
    border-color: var(--line);
}

/* EDUCATION */
.edu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 3.2rem;
}

.edu-card {
    padding: 2rem;
    border: 1px solid var(--line-soft);
    border-radius: 20px;
    background: rgba(7, 15, 31, 0.45);
}

.edu-card h4 {
    margin-top: 1.8rem;
}

.edu-card h4.edu-first {
    margin-top: 0;
}

.edu-list {
    display: grid;
    gap: 0.45rem;
}

/* CONTACT */
.contact {
    text-align: center;
    background: radial-gradient(70% 90% at 50% 100%, rgba(26, 49, 99, 0.6), transparent 70%);
}

.contact-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contact-title {
    margin-top: 1rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(3rem, 10vw, 6.5rem);
    line-height: 1;
    letter-spacing: -0.03em;
}

.contact-lede {
    margin-top: 1.5rem;
    max-width: 36rem;
    color: var(--muted);
    font-size: 1.1rem;
}

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

/* FOOTER */
.footer {
    border-top: 1px solid var(--line-soft);
    padding: 1.6rem 0;
    font-size: 0.88rem;
    color: var(--muted);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.footer a:hover {
    color: var(--gold);
}

/* RESPONSIVE */
@media only screen and (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .hero-portrait {
        order: -1;
        justify-self: start;
        width: 11rem;
        margin: 14px 0 0 14px;
    }

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

    .stats li {
        padding-bottom: 1.6rem;
    }

    .stats li:nth-child(3) {
        padding-left: 0;
        border-left: 0;
    }

    .stats li:nth-child(n + 3) {
        border-top: 1px solid var(--line-soft);
    }

    .about-grid,
    .edu-grid,
    .projects {
        grid-template-columns: 1fr;
    }

    .card-featured {
        grid-template-columns: 1fr;
    }

    .card-side {
        margin-top: 1.2rem;
    }
}

@media only screen and (max-width: 720px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        position: absolute;
        inset: 4.25rem 0 auto 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 1.2rem;
        padding: 1.5rem;
        background: rgba(7, 15, 31, 0.97);
        border-bottom: 1px solid var(--line-soft);
        font-size: 1.05rem;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
    }

    .nav-links.open {
        visibility: visible;
        opacity: 1;
        transform: none;
    }

    .card,
    .edu-card {
        padding: 1.5rem;
    }

    .card-foot {
        flex-direction: column;
        align-items: flex-start;
    }

    .card-link {
        margin-left: 0;
    }
}

@media only screen and (max-width: 420px) {
    .wrap,
    .nav-inner {
        width: calc(100% - 2.25rem);
    }

    .hero {
        padding-top: 6.5rem;
        gap: 3rem;
    }

    .hero-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .stats li {
        padding-right: 1rem;
    }

    .stats li + li {
        padding-left: 1rem;
    }

    .stats li:nth-child(3) {
        padding-left: 0;
    }

    .timeline {
        padding-left: 2rem;
    }

    .timeline-dot {
        left: -2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
    }

    .js .reveal {
        opacity: 1;
        transform: none;
    }

    .timeline-fill {
        transform: none;
    }
}
