/* ---------- Design tokens ---------- */
:root {
    --bg: #fbfaf8;
    --bg-alt: #f3f1ed;
    --surface: #ffffff;
    --text: #16181d;
    --muted: #4a4f5c;
    --border: #e4e1db;
    --accent: #d9601c;
    --accent-strong: #b94f14;
    --accent-soft: rgba(217, 96, 28, 0.1);
    --shadow: 0 1px 2px rgba(16, 18, 24, 0.04), 0 8px 24px rgba(16, 18, 24, 0.06);
    --radius: 14px;
    --max: 1120px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f1115;
        --bg-alt: #151820;
        --surface: #181b23;
        --text: #eceef3;
        --muted: #adb3c0;
        --border: #262a35;
        --accent: #f0823f;
        --accent-strong: #ff9a5c;
        --accent-soft: rgba(240, 130, 63, 0.12);
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px rgba(0, 0, 0, 0.35);
        color-scheme: dark;
    }
}

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

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 18px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

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

a {
    color: inherit;
}

ul {
    list-style: none;
}

h1,
h2,
h3 {
    line-height: 1.15;
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(1.95rem, 3.8vw, 2.6rem);
    font-weight: 800;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

p + p {
    margin-top: 1rem;
}

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

.wrap {
    width: 100%;
    max-width: var(--max);
    margin: 0 auto;
    padding: 0 24px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    background: var(--accent);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    text-decoration: none;
}

.skip-link:focus {
    top: 12px;
}

/* ---------- Header / nav ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.site-header.scrolled {
    border-bottom-color: var(--border);
}

.nav-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.logo span {
    color: var(--accent);
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 32px;
}

.site-nav a {
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    color: var(--muted);
    transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
    color: var(--text);
}

.site-nav .nav-cta {
    color: var(--text);
    border: 1px solid var(--border);
    padding: 7px 16px;
    border-radius: 999px;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.site-nav .nav-cta:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 0;
    background: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
}

.nav-toggle span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 1.03rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

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

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-strong);
}

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

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

/* ---------- Hero ---------- */
.hero {
    padding: 72px 0 96px;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    align-items: center;
    gap: 64px;
}

.eyebrow,
.section-label,
.project-kind {
    font-family: var(--mono);
    font-size: 0.88rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.eyebrow {
    margin-bottom: 18px;
}

.hero h1 {
    font-size: clamp(2.3rem, 5.2vw, 3.9rem);
    font-weight: 800;
    letter-spacing: -0.035em;
    margin-bottom: 24px;
}

.hero h1 .accent {
    color: var(--muted);
}

.lede {
    font-size: 1.22rem;
    color: var(--muted);
    max-width: 58ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

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

.hero-links {
    display: flex;
    gap: 20px;
    margin-top: 28px;
}

.hero-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
}

.hero-links a:hover {
    color: var(--text);
}

.hero-links svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}

.hero-photo {
    position: relative;
}

.hero-photo::before {
    content: "";
    position: absolute;
    inset: 18px -18px -18px 18px;
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    opacity: 0.5;
}

.hero-photo img {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: center 20%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- Sections ---------- */
.section {
    padding: 96px 0;
}

.section-alt {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.section-label {
    margin-bottom: 12px;
}

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

/* About */
.about-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 64px;
    align-items: start;
}

.about-grid > div > p {
    max-width: 62ch;
}

.facts {
    display: grid;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.facts > div {
    background: var(--surface);
    padding: 18px 22px;
}

.facts dt {
    font-size: 0.86rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 4px;
}

.facts dd {
    font-weight: 600;
}

.facts dd span {
    font-weight: 400;
    color: var(--muted);
}

/* Skills */
.skill-groups {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 12px;
}

.skill-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
}

.skill-group h3 {
    margin-bottom: 16px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tags li {
    font-size: 0.95rem;
    font-weight: 500;
    padding: 5px 12px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--text);
}

.tags-sm li {
    font-size: 0.86rem;
    padding: 3px 10px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--muted);
}

/* Projects */
.featured {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin: 12px 0 20px;
}

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

.project {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 26px;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.project:hover {
    border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.project p {
    font-size: 1.05rem;
    flex: 1;
}

.project-featured {
    padding: 32px;
}

.project-featured h3 {
    font-size: 1.55rem;
    margin-top: 6px;
}

.project-featured p {
    font-size: 1.1rem;
}

.project-links {
    display: flex;
    gap: 20px;
    margin-top: 4px;
}

.project-links a {
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.project-links a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.project-more {
    flex-direction: row;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border-style: dashed;
    background: transparent;
}

.project-more:hover {
    color: var(--accent);
}

/* Achievements */
.achievements {
    list-style: none;
    display: grid;
    gap: 1px;
    margin-top: 12px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.achievement {
    display: grid;
    grid-template-columns: 136px 1fr;
    gap: 24px;
    background: var(--surface);
    padding: 26px 28px;
}

.achievement-kind {
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--accent);
    padding-top: 2px;
}

.achievement h3 {
    margin-bottom: 2px;
}

.achievement .achievement-org {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0;
}

.achievement p + p {
    margin-top: 6px;
}

/* Beyond */
.beyond-grid {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
    gap: 64px;
    align-items: center;
}

.beyond-grid img {
    width: 100%;
    border-radius: var(--radius);
    aspect-ratio: 1;
    object-fit: cover;
    box-shadow: var(--shadow);
}

.beyond-grid .tags {
    margin-top: 24px;
}

/* Contact */
.contact-inner {
    text-align: center;
    max-width: 720px;
}

.contact .lede {
    margin: 0 auto;
}

.contact .contact-email {
    margin-top: 20px;
    font-family: var(--mono);
    font-size: 1rem;
    user-select: all;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    font-size: 0.95rem;
    color: var(--muted);
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-inner a {
    text-decoration: none;
}

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

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .skill-groups {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 800px) {
    .nav-toggle {
        display: flex;
    }

    .site-nav {
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 24px 20px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        display: none;
    }

    .site-nav.open {
        display: flex;
    }

    .site-nav a {
        padding: 12px 0;
        font-size: 1.1rem;
    }

    .site-nav .nav-cta {
        border: 0;
        padding: 12px 0;
        border-radius: 0;
    }

    .hero {
        padding: 40px 0 72px;
    }

    .hero-grid,
    .about-grid,
    .beyond-grid,
    .featured {
        grid-template-columns: minmax(0, 1fr);
        gap: 40px;
    }

    .hero-photo {
        order: -1;
        max-width: 280px;
    }

    .hero-photo::before {
        inset: 12px -12px -12px 12px;
    }

    .section {
        padding: 72px 0;
    }

    .beyond-grid img {
        max-width: 420px;
    }
}

@media (max-width: 560px) {
    .wrap {
        padding: 0 16px;
    }

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

    .project-more {
        padding: 18px;
    }

    .achievement {
        grid-template-columns: 1fr;
        gap: 6px;
        padding: 22px;
    }

    .hero-actions .btn {
        flex: 1;
    }
}

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

    * {
        transition: none !important;
    }
}
