/* ─── Design tokens ─────────────────────────────────────────────── */
:root {
    --bg: #0f1117;
    --bg2: #161b27;
    --bg3: #1e2433;
    --border: #2a3045;
    --text: #e2e8f0;
    --text-muted: #8892a4;
    --accent: #7c6af7;
    --accent2: #a78bfa;
    --accent-glow: rgba(124, 106, 247, 0.25);
    --green: #34d399;
    --shadow: 0 4px 32px rgba(0, 0, 0, 0.5);
    --radius: 10px;
    --font-mono:
        "JetBrains Mono", "Fira Code", "Cascadia Code",
        ui-monospace, monospace;
    --font-sans:
        -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
        sans-serif;
}

[data-theme="light"] {
    --bg: #f4f6fb;
    --bg2: #ffffff;
    --bg3: #eef1f8;
    --border: #d0d7e3;
    --text: #1a1f2e;
    --text-muted: #5a6278;
    --accent: #5b4edc;
    --accent2: #7c6af7;
    --accent-glow: rgba(91, 78, 220, 0.15);
    --green: #059669;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

/* ─── Reset & base ──────────────────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}
html {
    scroll-behavior: smooth;
}
body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition:
        background 0.25s,
        color 0.25s;
}
a {
    color: var(--accent2);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}
.container {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ─── Navbar ────────────────────────────────────────────────────── */
nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition:
        background 0.25s,
        border-color 0.25s;
}
.nav-logo {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent2);
    letter-spacing: 0.04em;
    text-decoration: none;
}
.nav-logo:hover {
    text-decoration: none;
    opacity: 0.85;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    list-style: none;
}
.nav-links a {
    font-size: 0.875rem;
    color: var(--text-muted);
    transition: color 0.15s;
}
.nav-links a:hover {
    color: var(--text);
    text-decoration: none;
}

/* ─── Theme toggle ──────────────────────────────────────────────── */
.theme-toggle {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    width: 48px;
    height: 26px;
    position: relative;
    transition:
        background 0.25s,
        border-color 0.25s;
    flex-shrink: 0;
    outline: none;
}
.theme-toggle:focus-visible {
    box-shadow: 0 0 0 3px var(--accent-glow);
}
.theme-toggle::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent2);
    transition: transform 0.25s;
}
[data-theme="light"] .theme-toggle::before {
    transform: translateX(22px);
}
.toggle-icon {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    line-height: 1;
    user-select: none;
    transition: opacity 0.2s;
}
.toggle-icon.moon {
    right: 5px;
    opacity: 1;
}
.toggle-icon.sun {
    left: 5px;
    opacity: 0;
}
[data-theme="light"] .toggle-icon.moon {
    opacity: 0;
}
[data-theme="light"] .toggle-icon.sun {
    opacity: 1;
}

/* ─── Hero ──────────────────────────────────────────────────────── */
.hero {
    padding: 6rem 1.5rem 5rem;
    text-align: center;
}
.hero-avatar {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    object-fit: cover;
    object-position: center top;
    border: 2px solid var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
    margin-bottom: 1.75rem;
    filter: grayscale(100%);
}
.hero-name {
    font-family: var(--font-mono);
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}
.hero-title {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 2vw, 0.95rem);
    color: var(--accent2);
    margin-bottom: 1.25rem;
    letter-spacing: 0.04em;
}
.hero-bio {
    font-size: clamp(0.95rem, 2vw, 1.05rem);
    color: var(--text-muted);
    max-width: 580px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}
.hero-social {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
}
.hero-social a {
    color: var(--text-muted);
    font-size: 1.4rem;
    transition:
        color 0.2s,
        transform 0.2s;
}
.hero-social a:hover {
    transform: translateY(-2px);
    text-decoration: none;
}
.social-bluesky:hover {
    color: #0085ff;
}
.social-linkedin:hover {
    color: #0077b5;
}
.social-mastodon:hover {
    color: #6364ff;
}
.social-github:hover {
    color: #a78bfa;
}

/* ─── Section shared ────────────────────────────────────────────── */
section {
    padding: 4rem 1.5rem;
}
section + section {
    border-top: 1px solid var(--border);
}
.section-label {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--accent2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}
.section-title {
    font-size: clamp(1.4rem, 3vw, 1.9rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}
.section-desc {
    color: var(--text-muted);
    max-width: 560px;
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

/* ─── Projects ──────────────────────────────────────────────────── */
.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 640px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 900px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.project-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    height: 100%;
}
.project-card:hover {
    border-color: var(--accent);
    box-shadow:
        0 0 0 1px var(--accent-glow),
        var(--shadow);
}
.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.project-icon {
    width: 1.1em;
    height: 1.1em;
    flex-shrink: 0;
    color: var(--accent2);
}
.project-name {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent2);
}
.project-link-icon {
    color: var(--text-muted);
    font-size: 0.9rem;
    transition: color 0.15s;
}
.project-card:hover .project-link-icon {
    color: var(--accent2);
}
.project-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.65;
    flex: 1;
}
.project-url {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.35rem 0.65rem;
    display: inline-block;
    transition:
        color 0.15s,
        border-color 0.15s;
    text-decoration: none;
}
.project-url:hover {
    color: var(--accent2);
    border-color: var(--accent);
    text-decoration: none;
}

/* ─── About ─────────────────────────────────────────────────────── */
.about-inner {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 3rem;
    align-items: start;
}
.about-photo {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    object-position: center top;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    filter: grayscale(100%);
}
.about-content p {
    color: var(--text-muted);
    line-height: 1.75;
    margin-bottom: 1.5rem;
}
.about-meta {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    display: grid;
    grid-template-columns: max-content 1fr;
    gap: 0.3rem 1.5rem;
}
.about-meta .meta-val {
    color: var(--accent2);
}
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.skill-tag {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 6px;
    padding: 0.25rem 0.6rem;
}

.about-subheading {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent2);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 0.6rem;
    margin-top: 1.5rem;
}
.about-subheading:first-of-type {
    margin-top: 0;
}

/* ─── Timeline ──────────────────────────────────────────────────── */
.timeline {
    margin-bottom: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.tl-row {
    display: grid;
    grid-template-columns: 7.5rem 1fr auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s;
}
.tl-row:last-child {
    border-bottom: none;
}
.tl-row:hover {
    background: var(--bg3);
}
.tl-years {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.tl-role {
    font-size: 0.82rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.35em;
}
.tl-company {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--accent2);
    text-align: right;
    white-space: nowrap;
}
@media (max-width: 500px) {
    .tl-row {
        grid-template-columns: 1fr;
        gap: 0.15rem;
        padding: 0.65rem 1rem;
    }
    .tl-company {
        text-align: left;
    }
}
.tl-icon {
    width: 1em;
    height: 1em;
    vertical-align: -0.15em;
    stroke-width: 2;
    flex-shrink: 0;
}

.project-card.is-link {
    text-decoration: none;
    color: inherit;
}

/* ─── Footer ────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    padding: 1.5rem;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}
footer a {
    color: var(--text-muted);
}
footer a:hover {
    color: var(--accent2);
}
footer code {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    font-size: 0.72rem;
}

/* ─── Hamburger ─────────────────────────────────────────────────── */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.4rem;
    color: var(--text-muted);
    font-size: 1.25rem;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
}
.hamburger:hover {
    color: var(--text);
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    .hero {
        padding: 4rem 1.25rem 3rem;
    }
    section {
        padding: 3rem 1.25rem;
    }

    .hamburger {
        display: flex;
    }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        background: var(--bg2);
        border-bottom: 1px solid var(--border);
        padding: 0.5rem 1.5rem 1rem;
        z-index: 99;
    }
    .nav-links.open {
        display: flex;
    }
    .nav-links li {
        width: 100%;
    }
    .nav-links a {
        display: block;
        padding: 0.65rem 0;
        font-size: 1rem;
        border-bottom: 1px solid var(--border);
        min-height: 44px;
        display: flex;
        align-items: center;
    }
    .nav-links li:last-child {
        padding-top: 0.75rem;
        border-bottom: none;
    }
    nav {
        position: relative;
    }
}
@media (max-width: 680px) {
    .about-inner {
        grid-template-columns: 1fr;
    }
    .about-photo {
        width: 140px;
        border-radius: 50%;
    }
}
