/* ---------- Design tokens ---------- */

:root {
    --bg: #f8fafc;
    --bg-alt: #f1f5f9;
    --surface: #ffffff;
    --text: #0f172a;
    --text-muted: #475569;
    --border: #e2e8f0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-soft: #dbeafe;
    --accent-contrast: #ffffff;
    --shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px rgb(15 23 42 / 0.06);
    --shadow-hover: 0 2px 4px rgb(15 23 42 / 0.06), 0 16px 40px rgb(15 23 42 / 0.12);
    --radius: 16px;
    --header-height: 64px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1120;
        --bg-alt: #0f172a;
        --surface: #131c2e;
        --text: #e2e8f0;
        --text-muted: #94a3b8;
        --border: #1e293b;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --accent-soft: #172554;
        --accent-contrast: #0b1120;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
        --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.35), 0 16px 40px rgb(0 0 0 / 0.4);
    }
}

:root[data-theme="dark"] {
    --bg: #0b1120;
    --bg-alt: #0f172a;
    --surface: #131c2e;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --border: #1e293b;
    --accent: #60a5fa;
    --accent-hover: #93c5fd;
    --accent-soft: #172554;
    --accent-contrast: #0b1120;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    --shadow-hover: 0 2px 4px rgb(0 0 0 / 0.35), 0 16px 40px rgb(0 0 0 / 0.4);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

p {
    margin: 0;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    color: var(--accent-hover);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

ul, ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -48px;
    z-index: 100;
    padding: 8px 16px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-contrast);
}

.skip-link:focus {
    top: 12px;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.lead {
    color: var(--text-muted);
    font-size: 1.125rem;
}

/* ---------- Buttons ---------- */

.button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font-weight: 600;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}

.button:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
}

.button-primary {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-contrast);
}

.button-primary:hover {
    border-color: var(--accent-hover);
    background: var(--accent-hover);
    color: var(--accent-contrast);
}

.button-lg {
    padding: 14px 28px;
    font-size: 1.0625rem;
}

.icon-button {
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.icon-button:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.icon-button .icon {
    width: 18px;
    height: 18px;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid transparent;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    transition: border-color 0.2s;
}

.site-header.is-scrolled {
    border-bottom-color: var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: var(--header-height);
}

.brand {
    color: var(--text);
    font-size: 1.125rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand span {
    color: var(--accent);
}

.brand:hover {
    color: var(--text);
}

.site-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.site-nav a {
    padding: 8px 14px;
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.site-nav a:hover,
.site-nav a.is-active {
    background: var(--accent-soft);
    color: var(--accent);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.menu-toggle {
    display: none;
}

.icon-sun,
:root[data-theme="dark"] .icon-moon {
    display: none;
}

:root[data-theme="dark"] .icon-sun {
    display: block;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-moon {
        display: none;
    }

    :root:not([data-theme="light"]) .icon-sun {
        display: block;
    }
}

@media (max-width: 800px) {
    .header-actions {
        margin-left: auto;
    }

    .menu-toggle {
        display: inline-grid;
    }

    .site-nav {
        position: absolute;
        top: var(--header-height);
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        gap: 2px;
        padding: 12px 16px 16px;
        border-bottom: 1px solid var(--border);
        background: var(--bg);
    }

    .site-nav.is-open {
        display: flex;
    }

    .site-nav a {
        padding: 12px 16px;
        border-radius: 12px;
    }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    overflow: hidden;
    padding: 96px 0 112px;
}

.hero::before {
    content: "";
    position: absolute;
    inset: -40% -10% auto auto;
    width: 720px;
    height: 720px;
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 65%);
    pointer-events: none;
}

.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 56px;
}

.hero h1 {
    margin-bottom: 20px;
    font-size: clamp(2.25rem, 5.5vw, 3.75rem);
    font-weight: 800;
    letter-spacing: -0.035em;
}

.accent {
    color: var(--accent);
}

.hero .lead {
    max-width: 560px;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.hero-photo {
    justify-self: center;
    width: min(100%, 480px);
}

.hero-photo img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border: 6px solid var(--surface);
    border-radius: 28px;
    box-shadow: var(--shadow-hover);
    transform: rotate(2deg);
}

.social {
    display: flex;
    gap: 8px;
    margin-top: 28px;
}

.social a {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    color: var(--text-muted);
    transition: background-color 0.2s, color 0.2s;
}

.social a:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

@media (max-width: 800px) {
    .hero {
        padding: 48px 0 72px;
    }

    .hero-inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .hero-photo {
        grid-row: 1;
        justify-self: stretch;
        width: 100%;
    }

    .hero-photo img {
        border-width: 4px;
        border-radius: 20px;
        transform: none;
    }
}

/* ---------- Sections ---------- */

.section {
    padding: 96px 0;
}

.section-alt {
    background: var(--bg-alt);
}

.section-header {
    margin-bottom: 48px;
}

.section-header h2,
.contact h2 {
    font-size: clamp(1.75rem, 3.5vw, 2.5rem);
    font-weight: 800;
}

@media (max-width: 800px) {
    .section {
        padding: 72px 0;
    }

    .section-header {
        margin-bottom: 32px;
    }
}

.card {
    padding: 28px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags li {
    padding: 4px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* ---------- About ---------- */

.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    align-items: start;
    gap: 48px;
}

.prose {
    color: var(--text-muted);
    font-size: 1.0625rem;
}

.prose p + p {
    margin-top: 1.25em;
}

.skills h3 {
    margin-bottom: 20px;
    font-size: 1.25rem;
}

.skills h4 {
    margin: 20px 0 10px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.skills h3 + h4 {
    margin-top: 0;
}

@media (max-width: 800px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Experience timeline ---------- */

.timeline {
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    top: 8px;
    bottom: 8px;
    left: 219px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    padding-bottom: 40px;
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-item::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 214px;
    width: 12px;
    height: 12px;
    border: 3px solid var(--bg-alt);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--accent);
}

.timeline-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
}

.timeline-body h3 {
    font-size: 1.25rem;
}

.org {
    margin: 4px 0 12px;
    color: var(--accent);
    font-weight: 600;
}

.timeline-body p:last-child {
    max-width: 680px;
    color: var(--text-muted);
}

.more {
    margin-top: 48px;
}

.more summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    transition: border-color 0.2s, color 0.2s;
}

.more summary::-webkit-details-marker {
    display: none;
}

.more summary::after {
    content: "";
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s;
}

.more[open] summary::after {
    transform: translateY(2px) rotate(-135deg);
}

.more summary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.more[open] .timeline {
    margin-top: 40px;
}

@media (max-width: 800px) {
    .timeline::before {
        left: 5px;
    }

    .timeline-item {
        grid-template-columns: 1fr;
        gap: 4px;
        padding-left: 32px;
    }

    .timeline-item::before {
        left: 0;
    }

    .timeline-meta {
        text-align: left;
    }
}

/* ---------- Featured role & ventures ---------- */

.featured-role {
    padding: 36px;
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: inset 0 4px 0 var(--accent), var(--shadow);
}

.featured-role-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px 24px;
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.featured-role-header h3 {
    font-size: clamp(1.375rem, 2.5vw, 1.75rem);
    font-weight: 800;
}

.featured-role-meta {
    color: var(--text-muted);
    font-weight: 500;
}

.featured-role .timeline-item::before {
    border-color: var(--surface);
}

.featured-role .timeline-body h4 {
    margin-bottom: 8px;
    font-size: 1.1875rem;
}

.subsection-title {
    margin: 56px 0 20px;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ventures {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.venture {
    display: flex;
    flex-direction: column;
    padding: 24px;
    box-shadow: none;
}

.venture .year {
    margin-bottom: 8px;
}

.venture h4 {
    font-size: 1.0625rem;
}

.venture .org {
    margin: 2px 0 10px;
    font-size: 0.9375rem;
}

.venture p:not(.year):not(.org) {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.venture-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
    font-size: 0.9375rem;
    font-weight: 600;
}

.venture-link .icon {
    width: 1em;
    height: 1em;
}

@media (max-width: 800px) {
    .featured-role {
        padding: 24px 20px;
    }
}

/* ---------- Projects ---------- */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 32px;
}

.filters[hidden] {
    display: none;
}

.filter {
    padding: 8px 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text-muted);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.filter:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.filter.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: var(--accent-contrast);
}

.projects {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.project[hidden] {
    display: none;
}

.project a {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    color: inherit;
    transition: box-shadow 0.25s, transform 0.25s, border-color 0.25s;
}

.project a:hover {
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.project img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition: transform 0.4s;
}

.project a:hover img {
    transform: scale(1.04);
}

.project-body {
    position: relative;
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 12px;
    padding: 24px;
    background: var(--surface);
}

.project h3 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 1.125rem;
}

.project h3 .icon {
    color: var(--text-muted);
    transition: color 0.2s, transform 0.2s;
}

.project a:hover h3 .icon {
    color: var(--accent);
    transform: translate(2px, -2px);
}

.project p {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.9375rem;
}

/* ---------- Education ---------- */

.education {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    align-items: stretch;
    gap: 24px;
}

.degree {
    display: flex;
    flex-direction: column;
}

.degree:not(.degree-secondary) {
    padding: 36px;
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    box-shadow: inset 0 4px 0 var(--accent), var(--shadow);
}

.degree h3 {
    font-size: clamp(1.375rem, 2.5vw, 1.75rem);
    font-weight: 800;
}

.degree .org {
    margin: 6px 0 4px;
    font-size: 1.0625rem;
}

.degree-detail {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

.degree-secondary {
    box-shadow: none;
}

.degree-secondary h3 {
    font-size: 1.125rem;
    font-weight: 700;
}

.degree-secondary .org {
    font-size: 0.9375rem;
}

.honors {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
    padding-top: 20px;
}

.honors li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    border-radius: 999px;
    color: var(--accent);
    font-size: 0.875rem;
    font-weight: 600;
}

.honors li::before {
    content: "★";
    font-size: 0.8em;
}

@media (max-width: 800px) {
    .education {
        grid-template-columns: 1fr;
    }

    .degree:not(.degree-secondary) {
        padding: 24px 20px;
    }
}

.year {
    margin-bottom: 12px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ---------- Contact ---------- */

.contact-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 640px;
    text-align: center;
}

.contact h2 {
    margin-bottom: 16px;
}

.contact .lead {
    margin-bottom: 32px;
}

.contact .button {
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* ---------- Footer ---------- */

.site-footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.875rem;
    text-align: center;
}

/* ---------- Motion ---------- */

.reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
