:root {
    --bg: #f4f6fb;
    --surface: rgba(255, 255, 255, 0.86);
    --surface-strong: #ffffff;
    --text: #111827;
    --muted: #5b6475;
    --line: rgba(17, 24, 39, 0.08);
    --primary: #3f5efb;
    --primary-soft: rgba(63, 94, 251, 0.12);
    --shadow-lg: 0 20px 60px rgba(10, 16, 38, 0.12);
    --shadow-md: 0 12px 28px rgba(10, 16, 38, 0.1);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 14px;
    --container: 1160px;
    --header-offset: 74px;
    --scroll-pad: 12px;
    --space-section: clamp(2.2rem, 4vw, 3.2rem);
    --space-section-inner: clamp(1.2rem, 2.4vw, 1.8rem);
    --space-grid: clamp(0.9rem, 1.8vw, 1.2rem);
    --space-stack: clamp(0.9rem, 1.5vw, 1.15rem);
    --line-height-uniform: 1.45;
}

body[data-theme="dark"] {
    --bg: #090d16;
    --surface: rgba(17, 23, 36, 0.86);
    --surface-strong: #111827;
    --text: #e7ebf5;
    --muted: #99a4bd;
    --line: rgba(231, 235, 245, 0.12);
    --primary: #88a2ff;
    --primary-soft: rgba(136, 162, 255, 0.14);
    --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 12px 36px rgba(0, 0, 0, 0.35);
}

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

html {
    scroll-behavior: smooth;
}

section[id],
footer[id] {
    scroll-margin-top: calc(var(--header-offset) + var(--scroll-pad));
}

body {
    margin: 0;
    font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(circle at 10% -10%, #dbe7ff 0%, transparent 40%),
        radial-gradient(circle at 90% 0%, #e5dcff 0%, transparent 44%), var(--bg);
    color: var(--text);
    line-height: var(--line-height-uniform);
    transition: background 0.35s ease, color 0.35s ease;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1 0 auto;
}

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

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

.bg-orb {
    position: fixed;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.5;
}

.orb-1 { top: -220px; right: -140px; background: #7c93ff; }
.orb-2 { left: -160px; bottom: -240px; background: #9d7cff; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: color-mix(in srgb, var(--surface-strong), transparent 4%);
    border-bottom: 1px solid var(--line);
}

body.is-menu-open .site-header {
    border-bottom-color: transparent;
}

.nav-shell {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 74px;
}

.brand {
    font-weight: 800;
    letter-spacing: -0.03em;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.nav-flyout {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
    position: relative;
}

.nav-backdrop {
    display: none;
}

.nav-panel {
    display: contents;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
    justify-content: center;
}

.site-nav a {
    color: var(--muted);
    font-weight: 500;
    padding: 0.5rem 0.85rem;
    border-radius: 10px;
    transition: 0.25s ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a.is-active {
    color: var(--text);
    background: var(--primary-soft);
}

.site-nav a:focus-visible,
.btn:focus-visible,
.theme-btn:focus-visible,
.menu-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-btn {
    border: 0;
    background: transparent;
    color: var(--text);
    width: 58px;
    height: 36px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.2s ease;
}

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

.theme-btn:active {
    transform: translateY(0) scale(0.98);
}

.theme-btn-track {
    width: 58px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--primary), var(--line) 55%);
    background: color-mix(in srgb, var(--surface-strong), var(--bg) 28%);
    box-shadow: inset 0 1px 2px rgba(10, 16, 38, 0.08), 0 4px 14px rgba(10, 16, 38, 0.14);
    position: relative;
    display: block;
    transition: background 0.28s ease, border-color 0.28s ease, box-shadow 0.28s ease;
}

.theme-btn-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, #ebedf4 100%);
    box-shadow: 0 2px 8px rgba(10, 16, 38, 0.24);
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1), background 0.28s ease;
}

.theme-btn-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    line-height: 1;
    pointer-events: none;
    transition: opacity 0.22s ease;
}

.theme-btn-icon-sun {
    left: 8px;
    opacity: 0;
    color: #f59e0b;
}

.theme-btn-icon-moon {
    right: 9px;
    opacity: 1;
    color: #64748b;
}

body[data-theme="dark"] .theme-btn-track {
    background: color-mix(in srgb, var(--primary-soft), var(--surface-strong) 80%);
}

body[data-theme="dark"] .theme-btn-thumb {
    transform: translateX(26px);
    background: linear-gradient(145deg, #cfd7ff 0%, #a9bcff 100%);
}

body[data-theme="dark"] .theme-btn-icon-sun {
    opacity: 1;
}

body[data-theme="dark"] .theme-btn-icon-moon {
    opacity: 0.35;
}

.nav-trailing {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

body.is-menu-open .brand,
body.is-menu-open .nav-trailing {
    position: relative;
    z-index: 320;
}

.menu-toggle {
    display: none;
    width: 46px;
    height: 46px;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 14px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.menu-toggle:hover {
    border-color: color-mix(in srgb, var(--primary), var(--line));
    box-shadow: 0 6px 18px rgba(10, 16, 38, 0.08);
}

.menu-toggle__bar {
    display: block;
    width: 20px;
    height: 2px;
    border-radius: 999px;
    background: var(--text);
    transform-origin: center;
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
}

.menu-toggle.is-open .menu-toggle__bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.hero { padding: var(--space-section) 0 var(--space-section-inner); }

.hero-grid {
    display: grid;
    grid-template-columns: 1.35fr 0.85fr;
    gap: var(--space-grid);
    align-items: stretch;
}

.hero-content,
.photo-card,
.case-card,
.timeline-card,
.info-card,
.site-footer {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
}

.hero-content {
    padding: 2.4rem;
    min-height: 0;
}

.eyebrow {
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    margin: 0 0 0.9rem;
}

.hero-name {
    margin: 0 0 0.65rem;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text);
}

h1 {
    margin: 0;
    font-size: clamp(2.05rem, 4vw, 3.4rem);
    letter-spacing: -0.04em;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
li,
a,
button,
span,
input,
textarea,
label {
    line-height: var(--line-height-uniform);
}

.hero-content h1 {
    line-height: 1.2;
}

.hero-lead { margin: 1.2rem 0 0; color: var(--muted); max-width: 62ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--space-stack); margin-top: var(--space-section-inner); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 0.78rem 1.15rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 10px 22px rgba(63, 94, 251, 0.3); }
.btn-secondary { border-color: var(--line); background: var(--surface-strong); color: var(--text); }

.hero-metrics {
    margin: var(--space-section-inner) 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-stack);
}

.hero-metrics li { padding: 0.9rem; border-radius: 14px; background: var(--surface-strong); border: 1px solid var(--line); }
.hero-metrics strong { display: block; font-size: 1.05rem; letter-spacing: -0.02em; }
.hero-metrics span { color: var(--muted); font-size: 0.9rem; }

.photo-card {
    padding: clamp(0.85rem, 2.2vw, 1.25rem);
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    width: 100%;
    height: 100%;
    align-self: stretch;
}

.photo-frame {
    position: relative;
    flex: 1 1 0;
    min-height: 0;
    width: 100%;
    border-radius: clamp(14px, 2.2vw, 20px);
    overflow: hidden;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-strong), var(--bg) 35%);
}

.photo-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 18%;
    display: block;
}

.section { padding: var(--space-section-inner) 0; }
.section:last-of-type { padding-bottom: var(--space-section); }
.section-head { margin-bottom: var(--space-stack); }
.section-head p { color: var(--muted); margin-top: 0.45rem; }
.narrow { max-width: 860px; }
.section-title { margin: 0; font-size: clamp(1.5rem, 2.4vw, 2.15rem); letter-spacing: -0.03em; }
.narrow p { margin: 0.95rem 0 0; color: var(--muted); }

#cases .section-head,
#experience .section-head,
#skills .section-head {
    padding-left: clamp(0.7rem, 1.6vw, 1.35rem);
}

.section-about {
    padding: 0;
}

.about-band {
    padding: var(--space-section-inner) 0;
}

.about-shell {
    max-width: min(100%, calc(var(--container) + 2rem));
}

.about-card {
    position: relative;
    border-radius: var(--radius-xl);
    border: 1px solid var(--line);
    background: var(--surface-strong);
    box-shadow: var(--shadow-lg);
    padding: clamp(1.5rem, 4.2vw, 2.85rem);
    overflow: hidden;
}

.about-card :is(
    .about-kicker,
    .about-title,
    .about-sub,
    .about-lead,
    .about-copy p,
    .about-focus-label,
    .about-focus-body,
    .pillar-index,
    .about-pillars strong,
    .about-pillars li span:last-child
) {
    font-size: 1rem;
    font-weight: 500;
    line-height: var(--line-height-uniform);
    letter-spacing: normal;
    text-transform: none;
}

.about-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), #a78bfa, #c084fc);
    opacity: 0.95;
}

.about-card-head {
    max-width: none;
}

.about-kicker {
    margin: 0 0 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary);
}

.about-title {
    margin: 0;
    font-size: clamp(1.75rem, 3vw, 2.35rem);
    letter-spacing: -0.035em;
    line-height: 1.15;
}

.about-head-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    gap: clamp(1rem, 3vw, 2.5rem);
    align-items: center;
    margin-top: 0.85rem;
}

.about-sub {
    margin: 0;
    max-width: 52ch;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.55;
}

.about-body {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: clamp(1.2rem, 2.6vw, 2.2rem);
    margin-top: var(--space-section-inner);
    padding-top: var(--space-section-inner);
    border-top: 1px solid var(--line);
}

.about-copy p {
    margin: 0;
    color: var(--muted);
}

.about-copy p + p {
    margin-top: var(--space-stack);
}

.about-lead {
    font-size: 1.08rem;
    line-height: 1.7;
    color: var(--text);
}

.about-focus {
    margin: 0;
    justify-self: end;
    align-self: center;
    width: fit-content;
    max-width: min(100%, min(36.3rem, 63.8vw));
    padding: 1.05rem 1.15rem;
    border-radius: var(--radius-md);
    background: var(--primary-soft);
    border: 1px solid color-mix(in srgb, var(--primary), var(--line) 55%);
    color: var(--text);
    line-height: 1.55;
    text-align: right;
}

.about-focus-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
    text-align: right;
}

.about-focus-body {
    display: block;
    text-align: right;
}

@media (min-width: 721px) {
    .about-focus-body {
        max-width: clamp(31ch, 44ch, 51ch);
        margin-inline-start: auto;
        text-wrap: balance;
    }
}

@media (max-width: 720px) {
    .about-head-pair {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .about-sub {
        max-width: none;
    }

    .about-focus {
        justify-self: stretch;
        width: auto;
        max-width: none;
        text-align: right;
    }

    .about-focus-body {
        max-width: none;
        margin-inline-start: 0;
        text-wrap: unset;
    }
}

.about-aside {
    display: flex;
    flex-direction: column;
    gap: var(--space-grid);
}

.about-pillars {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-stack);
}

.about-pillars li {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    align-items: start;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface), var(--surface-strong));
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
}

.about-pillars li:hover {
    border-color: color-mix(in srgb, var(--primary), var(--line) 40%);
    box-shadow: var(--shadow-md);
}

.pillar-index {
    font-weight: 800;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--primary);
    line-height: 1.6;
}

.about-pillars strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.98rem;
    letter-spacing: -0.02em;
}

.about-pillars li span:last-child {
    font-size: 0.88rem;
    color: var(--muted);
    line-height: 1.45;
}

.cards-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-grid); }

.case-card { padding: 1.25rem 1.3rem; transition: transform 0.28s ease, box-shadow 0.28s ease; }
.case-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); }
.case-card h3, .timeline-card h3, .info-card h3 { margin: 0; letter-spacing: -0.02em; }
.case-card p, .timeline-card p, .timeline-card li, .info-card p { color: var(--muted); }

.timeline {
    position: relative;
    display: grid;
    gap: var(--space-grid);
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 17px;
    width: 2px;
    background: color-mix(in srgb, var(--primary), transparent 70%);
}

.timeline-card { position: relative; padding: 1.1rem 1.25rem 1.15rem 2.4rem; }
.timeline-card::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 20px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    background: var(--surface-strong);
}

.timeline-card header p { margin: 0.25rem 0 0.3rem; font-weight: 600; font-size: 0.95rem; }
.timeline-card ul { margin: 0.4rem 0 0; padding-left: 1rem; display: grid; gap: 0.4rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.tags span {
    padding: 0.48rem 0.86rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 0.9rem;
}

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-grid); }
.info-card { padding: 1.4rem; }
.info-card .section-title { font-size: 1.1rem; margin-bottom: 0.65rem; }

.site-footer { margin-bottom: var(--space-section-inner); padding: clamp(1.1rem, 2.2vw, 1.45rem); border-radius: var(--radius-lg); }
.footer-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-grid); align-items: center; }
.site-footer h2 { margin: 0.1rem 0 0.55rem; font-size: 1.35rem; letter-spacing: -0.02em; }
.site-footer p { margin: 0; color: var(--muted); }
.contact-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 0.45rem; justify-items: end; }
.contact-list a { color: var(--text); }
.contact-list a:hover { color: var(--primary); }

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

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

@media (max-width: 1024px) {
    .hero-grid,
    .footer-grid,
    .two-col { grid-template-columns: 1fr; }
    .hero-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .contact-list { justify-items: start; }
    .about-body { grid-template-columns: 1fr; }

    .photo-card {
        height: auto;
        max-width: none;
        margin-inline: 0;
    }

    .photo-frame {
        flex: none;
        width: 100%;
        margin-inline: 0;
        aspect-ratio: 3 / 4;
        max-height: min(58dvh, 28rem);
    }
}

@media (max-width: 860px) {
    .menu-toggle { display: inline-flex; }

    .nav-flyout {
        flex: 0 0 auto;
        position: fixed;
        inset: 0;
        z-index: 260;
        display: block;
        pointer-events: none;
        visibility: hidden;
        opacity: 0;
        transition: opacity 0.3s ease, visibility 0.3s linear;
    }

    .nav-flyout.is-open {
        pointer-events: auto;
        visibility: visible;
        opacity: 1;
    }

    .nav-backdrop {
        display: block;
        position: absolute;
        inset: 0;
        margin: 0;
        padding: 0;
        border: 0;
        cursor: pointer;
        background: rgba(6, 10, 22, 0.48);
        opacity: 0;
        transition: opacity 0.32s ease;
        -webkit-tap-highlight-color: transparent;
    }

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

    .nav-flyout.is-open .nav-backdrop {
        opacity: 1;
    }

    .nav-panel {
        display: block;
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: min(100%, 360px);
        max-width: 100vw;
        background: var(--surface-strong);
        border-left: 1px solid var(--line);
        box-shadow: -28px 0 80px rgba(10, 16, 38, 0.22);
        transform: translate3d(100%, 0, 0);
        transition: transform 0.38s cubic-bezier(0.22, 1, 0.36, 1);
        padding: calc(var(--header-offset) + 1.1rem) 0 max(1.5rem, env(safe-area-inset-bottom));
    }

    body[data-theme="dark"] .nav-panel {
        box-shadow: -28px 0 90px rgba(0, 0, 0, 0.55);
    }

    .nav-flyout.is-open .nav-panel {
        transform: translate3d(0, 0, 0);
    }

    .site-nav {
        flex-direction: column;
        align-items: stretch;
        flex-wrap: nowrap;
        gap: 0.35rem;
        padding: 0 1rem 0 1.15rem;
    }

    .site-nav a {
        display: block;
        padding: 1.05rem 1.15rem;
        border-radius: 14px;
        font-size: 1.08rem;
        font-weight: 600;
        letter-spacing: -0.01em;
    }

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

body.is-menu-open {
    overflow: hidden;
    touch-action: none;
}

body.is-menu-open.is-scroll-locked {
    position: fixed;
    top: var(--scroll-lock-top, 0);
    left: 0;
    right: 0;
    width: 100%;
}

@media (max-width: 680px) {
    :root {
        --space-section: 1.9rem;
        --space-section-inner: 1rem;
        --space-grid: 0.82rem;
        --space-stack: 0.8rem;
    }

    .container { width: min(100% - 1.4rem, var(--container)); }
    .hero-content { padding: 1.25rem; }
    .hero-metrics { grid-template-columns: 1fr; }
    .about-band { padding: 0.35rem 0 var(--space-section-inner); }

    #cases .section-head,
    #experience .section-head,
    #skills .section-head {
        padding-left: 0.35rem;
    }

    .photo-frame {
        width: 100%;
        max-height: min(52dvh, 26rem);
    }
    .timeline::before { display: none; }
    .timeline-card { padding: 1rem; }
    .timeline-card::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; animation: none !important; }
}
