:root {
    --bg: #f7f8fb;
    --paper: #ffffff;
    --paper-soft: #f3f6fa;
    --primary: #14345f;
    --primary-soft: #e8eef7;
    --text: #172033;
    --muted: #5f6b7a;
    --line: #d8dee8;
    --line-dark: #9aa8ba;
    --nav-bg: rgba(247, 248, 251, 0.94);
    --surface-bg: rgba(255, 255, 255, 0.7);
    --strip-bg: rgba(255, 255, 255, 0.64);
    --contact-bg: rgba(243, 246, 250, 0.68);
    --scatter-color: 20, 52, 95;
}

[data-theme="dark"] {
    --bg: #08111f;
    --paper: #101b2d;
    --paper-soft: #14233a;
    --primary: #8fb8ff;
    --primary-soft: #1d3454;
    --text: #eef4ff;
    --muted: #9eabc0;
    --line: #24344d;
    --line-dark: #3b506f;
    --nav-bg: rgba(8, 17, 31, 0.88);
    --surface-bg: rgba(16, 27, 45, 0.72);
    --strip-bg: rgba(16, 27, 45, 0.58);
    --contact-bg: rgba(12, 24, 42, 0.72);
    --scatter-color: 143, 184, 255;
}

* {
    box-sizing: border-box;
}

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

body {
    position: relative;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.6;
}

body,
.nav,
.section,
.strip,
.panel,
.card,
.data-block,
.contact-section,
.education-row,
.cert-row,
.footer,
.role-card,
.contact-pill,
.theme-toggle,
.timeline-item::before,
.timeline-item,
.explore-item,
.nav-toggle,
.mobile-nav a,
.tag-row span {
    transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease, box-shadow 220ms ease;
}

h1,
h2,
h3,
h4,
.brand,
.nav-links,
.meta-list,
.block-heading,
.intro-small,
.card p,
ul,
.date,
.talk,
.contact-kicker,
.footer-bottom,
.theme-toggle-icon,
.stack-item,
.explore-icon,
.meta-label,
.stack-list li,
.tag-row span {
    transition: color 220ms ease, border-color 220ms ease, opacity 220ms ease, transform 220ms ease;
}

#scatter-background {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.95;
}

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

a:hover {
    text-decoration: underline;
}

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

.container {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
}

.nav {
    position: sticky;
    top: 0;
    z-index: 10;
    width: 100%;
    border-bottom: 1px solid var(--line);
    background: var(--nav-bg);
    backdrop-filter: blur(12px);
}

main,
.contact-section,
.footer {
    position: relative;
    z-index: 1;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 0;
}

.brand {
    color: var(--primary);
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 28px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: transparent;
    color: var(--primary);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    padding: 8px 16px;
    cursor: pointer;
    transition: border-color 200ms ease, color 200ms ease, background-color 220ms ease;
}

.nav-toggle:hover {
    border-color: var(--primary);
}

.mobile-nav {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease, border-color 220ms ease;
    border-top: 1px solid transparent;
}

.mobile-nav.is-open {
    max-height: 320px;
    border-top-color: var(--line);
}

.mobile-nav .container {
    display: flex;
    flex-direction: column;
}

.mobile-nav a {
    display: block;
    padding: 14px 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    transition: color 180ms ease;
}

.mobile-nav a:last-child {
    border-bottom: none;
}

.mobile-nav a:hover {
    color: var(--primary);
    text-decoration: none;
}

.nav-links a.is-active,
.mobile-nav a.is-active {
    color: var(--primary);
}

main {
    padding-top: 0;
}

.error-main {
    display: flex;
    min-height: 100vh;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.error-hero {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    text-align: center;
}

.error-hero h1 {
    margin-bottom: 18px;
}

.error-hero p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.hero {
    display: flex;
    min-height: calc(100vh - 72px);
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    text-align: center;
}

h1 {
    color: var(--primary);
    margin-bottom: 34px;
    font-size: clamp(4rem, 13vw, 11rem);
    line-height: 0.84;
    letter-spacing: -0.09em;
    text-transform: uppercase;
}

.hero-actions {
    display: flex;
    justify-content: center;
}

.role-card {
    min-width: min(360px, 100%);
    border: 1px solid var(--primary);
    border-radius: 999px;
    padding: 14px 24px;
    background: var(--primary);
    color: #ffffff;
    text-align: center;
}

.role-card strong {
    display: block;
    color: inherit;
    font-size: clamp(0.95rem, 2vw, 1.15rem);
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.strip {
    overflow: hidden;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: var(--strip-bg);
    padding: 18px 0;
}

.strip-track {
    display: flex;
    width: max-content;
    animation: marquee 28s linear infinite;
    color: var(--primary);
    font-size: clamp(1.4rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.strip-track span {
    margin: 0 24px;
}

@keyframes marquee {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.section {
    padding: 96px 0;
    border-bottom: 1px solid var(--line);
}

#exploring {
    transition: border-color 350ms ease;
}

.split {
    display: grid;
    grid-template-columns: 4fr 8fr;
    gap: 56px;
}

.section-title {
    position: sticky;
    top: 104px;
}

h2 {
    color: var(--primary);
    margin-bottom: 24px;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 0.92;
    letter-spacing: -0.08em;
    text-transform: uppercase;
}

.meta-list {
    border-left: 2px solid var(--line-dark);
    padding-left: 16px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.meta-list p {
    margin-bottom: 10px;
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 8px;
}

.meta-label {
    color: var(--muted);
    opacity: 0.7;
    font-weight: 600;
}

.panel {
    border: 1px solid var(--line);
    background: var(--surface-bg);
    padding: clamp(26px, 5vw, 48px);
}

.intro {
    font-size: clamp(1.45rem, 3vw, 2.4rem);
    line-height: 1.35;
    letter-spacing: -0.04em;
}

.intro-small {
    margin-top: 24px;
    color: var(--muted);
    font-size: clamp(1rem, 2vw, 1.2rem);
}

.data-block {
    margin-top: 44px;
    border-top: 1px dashed var(--line-dark);
    padding-top: 32px;
}

.block-heading {
    margin-bottom: 20px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.education-row,
.cert-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid var(--line);
    padding: 20px 0;
}

.education-row:first-of-type,
.cert-row:first-of-type {
    border-top: 0;
    padding-top: 0;
}

.certification-section .panel {
    align-self: start;
    transition: background-color 350ms ease, border-color 350ms ease, box-shadow 350ms ease;
}

.certification-section .cert-row {
    transition: border-color 350ms ease;
}

h3 {
    margin-bottom: 4px;
    font-size: clamp(1.35rem, 3vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.04em;
}

h4 {
    margin-bottom: 10px;
    color: var(--muted);
    font-size: 1.1rem;
}

.date {
    flex: 0 0 auto;
    border: 1px solid var(--primary);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.card {
    min-height: 190px;
    border: 1px solid var(--line);
    background: var(--surface-bg);
    padding: 26px;
}

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

.card h3 {
    min-height: 4.6rem;
}

.timeline {
    border-left: 3px solid var(--primary);
    margin-left: 14px;
}

.timeline-item {
    position: relative;
    padding: 0 0 58px 32px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 8px;
    left: -10px;
    width: 17px;
    height: 17px;
    border: 3px solid var(--paper);
    border-radius: 50%;
    background: var(--primary);
}

.timeline-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 8px;
}

.timeline-item p,
.timeline-item ul {
    max-width: 760px;
}

ul {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

li + li {
    margin-top: 8px;
}

.contact-section {
    padding: 96px 0 76px;
    background: var(--contact-bg);
    text-align: center;
}

.contact-kicker {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.talk {
    color: var(--primary);
    display: block;
    margin-bottom: 24px;
    font-size: clamp(3.5rem, 11vw, 9rem);
    font-weight: 900;
    line-height: 0.9;
    letter-spacing: -0.08em;
    text-transform: uppercase;
    word-break: break-word;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 14px;
}

.contact-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 150px;
    border: 1px solid var(--primary);
    border-radius: 999px;
    padding: 12px 18px;
    color: var(--primary);
    font-size: 0.82rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.contact-pill:hover {
    background: var(--primary);
    color: #ffffff;
    text-decoration: none;
}

.footer {
    border-top: 1px solid var(--line);
    background: var(--surface-bg);
    padding: 24px 0;
}

.theme-toggle {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(18px, env(safe-area-inset-bottom));
    z-index: 20;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-bg);
    color: var(--primary);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 26px rgba(10, 24, 44, 0.16);
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

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

.theme-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.theme-toggle-icon {
    position: absolute;
    display: inline-flex;
    width: 22px;
    height: 22px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 220ms ease, transform 220ms ease;
}

.theme-toggle-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

.theme-toggle-icon-moon {
    opacity: 1;
    transform: scale(1);
}

[data-theme="dark"] .theme-toggle {
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .theme-toggle-icon-moon {
    opacity: 0;
    transform: scale(0.8);
}

[data-theme="dark"] .theme-toggle-icon-sun {
    opacity: 1;
    transform: scale(1);
}

@media (prefers-reduced-motion: reduce) {
    body,
    .nav,
    .section,
    #exploring,
    .strip,
    .panel,
    .certification-section .panel,
    .card,
    .data-block,
    .contact-section,
    .education-row,
    .cert-row,
    .certification-section .cert-row,
    .footer,
    .role-card,
    .contact-pill,
    .theme-toggle,
    .timeline-item::before,
    .timeline-item,
    .explore-item,
    .nav-toggle,
    .mobile-nav a,
    .tag-row span,
    h1,
    h2,
    h3,
    h4,
    .brand,
    .nav-links,
    .meta-list,
    .block-heading,
    .intro-small,
    .card p,
    ul,
    .date,
    .talk,
    .contact-kicker,
    .footer-bottom,
    .theme-toggle-icon,
    .stack-item,
    .explore-icon,
    .meta-label,
    .stack-list li {
        transition: none;
    }
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
}

@media (max-width: 900px) {
    .nav-inner {
        align-items: center;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .nav-links {
        display: none;
    }

    .hero {
        min-height: calc(100vh - 65px);
    }

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

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

    .section-title {
        position: static;
    }

    .education-row,
    .cert-row,
    .timeline-head {
        align-items: flex-start;
        flex-direction: column;
    }

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

@media (max-width: 560px) {
    .container {
        width: min(100% - 24px, 1180px);
    }

    .section,
    .contact-section {
        padding: 72px 0;
    }

    .hero {
        min-height: auto;
        padding: 76px 0 64px;
    }

    h1 {
        margin-bottom: 28px;
        font-size: clamp(3.35rem, 18vw, 5rem);
        letter-spacing: -0.075em;
    }

    .role-card {
        min-width: 0;
        width: 100%;
        padding: 13px 18px;
        text-align: center;
    }

    h2 {
        font-size: clamp(2.6rem, 15vw, 4rem);
    }

    .panel,
    .card {
        padding: 22px;
    }

    .card h3 {
        min-height: 0;
    }

    .certification-section .split {
        gap: 24px;
    }

    .certification-section h2 {
        margin-bottom: 0;
        font-size: clamp(2.25rem, 12vw, 3.6rem);
        letter-spacing: -0.065em;
        overflow-wrap: anywhere;
    }

    .certification-section .panel {
        padding: 20px;
    }

    .cert-row {
        gap: 14px;
        padding: 0;
    }

    .cert-row h3 {
        font-size: clamp(1.25rem, 8vw, 1.75rem);
    }

    .cert-row .date {
        align-self: flex-start;
    }

    .contact-links {
        align-items: stretch;
        flex-direction: column;
    }

    .footer-bottom {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .footer {
        padding-bottom: 88px;
    }

    .explore-item {
        padding: 14px 16px;
    }
}

/* ── Card hover ─────────────────────────────────── */

.card {
    transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease, background-color 220ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        transform: translateY(-4px);
        border-color: var(--primary);
        box-shadow: 0 12px 32px rgba(20, 52, 95, 0.08);
    }

    [data-theme="dark"] .card:hover {
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    }
}

@media (hover: hover) and (pointer: fine) {
    .timeline-item:hover::before {
        transform: scale(1.55);
        box-shadow: 0 0 0 9px rgba(20, 52, 95, 0.12);
    }
    [data-theme="dark"] .timeline-item:hover::before {
        box-shadow: 0 0 0 9px rgba(143, 184, 255, 0.18);
    }
    .timeline-item:hover h3 {
        color: var(--primary);
        text-shadow: 0 0 18px rgba(20, 52, 95, 0.14);
    }
    [data-theme="dark"] .timeline-item:hover h3 {
        text-shadow: 0 0 20px rgba(143, 184, 255, 0.22);
    }
}

/* ── Tech Stack cards ───────────────────────────── */

.stack-cards {
    grid-template-columns: repeat(4, 1fr);
    margin-top: 18px;
}

.stack-card {
    min-height: 0;
}

.stack-card .block-heading {
    margin-bottom: 16px;
}

.stack-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.stack-list li {
    border-top: 1px solid var(--line);
    padding: 8px 0;
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.stack-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

/* ── Work History tags ──────────────────────────── */

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.tag-row span {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 4px 12px;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    transition: border-color 180ms ease, color 180ms ease;
}

@media (hover: hover) and (pointer: fine) {
    .tag-row span:hover {
        border-color: var(--primary);
        color: var(--primary);
    }
}

/* ── Currently Exploring ────────────────────────── */

.explore-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 18px;
}

.explore-item {
    display: flex;
    align-items: center;
    gap: 12px;
    border: 1px solid var(--line);
    padding: 16px 20px;
    font-size: 0.95rem;
    font-weight: 700;
    transition: border-color 350ms ease, background-color 350ms ease, color 350ms ease, box-shadow 350ms ease;
}

.explore-icon {
    flex: 0 0 auto;
    color: var(--primary);
    font-size: 1.1rem;
}

@media (hover: hover) and (pointer: fine) {
    .explore-item:hover {
        border-color: var(--primary);
        background: var(--primary-soft);
    }
}

@media (max-width: 900px) {
    .stack-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 560px) {
    .stack-cards {
        grid-template-columns: 1fr;
    }
}

/* ── Focus-visible ──────────────────────────────── */

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
}

/* ── Scroll reveal ──────────────────────────────── */

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

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

@media (prefers-reduced-motion: reduce) {
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ── Mobile theme toggle ────────────────────────── */

@media (max-width: 560px) {
    .theme-toggle {
        width: 42px;
        height: 42px;
        right: max(14px, env(safe-area-inset-right));
        bottom: max(16px, env(safe-area-inset-bottom));
    }

    .theme-toggle-icon {
        width: 20px;
        height: 20px;
    }
}
