:root {
    --paper: #eef2f4;
    --ink: #14232f;
    --muted: #4f626e;
    --accent: #0b6b7a;
    --signal: #d98a1f;
    --line: #c6d1d8;
    --error: #a3261b;
    --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
    --text: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #101c25;
        --ink: #e4ecf0;
        --muted: #9aafbb;
        --accent: #4fc1d1;
        --signal: #f2b24d;
        --line: #25384a;
        --error: #ff9a8e;
    }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1.0625rem/1.65 var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--ink); }

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

code { font-size: 0.9em; }

.wrap { width: min(1040px, 100% - 2.5rem); margin-inline: auto; }

/* Top bar */
.topbar {
    position: sticky; top: 0; z-index: 10;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 3.5rem; }
.brand { font: 700 1.1rem var(--display); color: var(--ink); text-decoration: none; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.topbar nav a:hover { color: var(--ink); text-decoration: underline; }

@media (max-width: 640px) {
    .topbar-inner { flex-direction: column; align-items: flex-start; gap: 0.2rem; padding-block: 0.6rem; }
    html { scroll-padding-top: 6.5rem; }
}

/* Hero */
.hero { padding-top: clamp(3.5rem, 9vw, 7rem); }
.hero h1 {
    margin: 0;
    font: 700 clamp(3.2rem, 11vw, 7.5rem)/0.95 var(--display);
    letter-spacing: -0.03em;
}
.lead { max-width: 28ch; margin: 1.5rem 0 0; font: 500 clamp(1.35rem, 3vw, 1.9rem)/1.3 var(--display); color: var(--muted); }
.hero-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.75rem; margin-top: 2rem; }

.button {
    display: inline-block;
    padding: 0.7rem 1.3rem;
    border: 0; border-radius: 4px;
    background: var(--ink); color: var(--paper);
    font: 500 1rem var(--text);
    text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--accent); color: var(--paper); }

.trace { display: block; width: 100%; height: clamp(90px, 14vw, 140px); margin-top: clamp(2.5rem, 6vw, 4.5rem); }
.trace polyline { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }

/* Sections */
.section {
    display: grid;
    grid-template-columns: minmax(140px, 220px) minmax(0, 1fr);
    gap: 1.5rem 3rem;
    padding-block: 4rem;
    border-top: 1px solid var(--line);
}
.section:first-of-type { border-top: 0; }
.section h2 { margin: 0; font: 700 1.5rem/1.2 var(--display); }
.section .body { max-width: 68ch; }
.section .body > :first-child { margin-top: 0; }

@media (max-width: 760px) {
    .section { grid-template-columns: 1fr; padding-block: 2.75rem; }
}

h3 { margin: 0; font: 700 1.2rem/1.3 var(--display); }
.meta { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.body ul { margin: 0.9rem 0 0; padding-left: 1.2rem; }
.body li + li { margin-top: 0.45rem; }

/* Experience: a real sequence, so a rail is meaningful */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { position: relative; padding: 0 0 2.5rem 1.75rem; border-left: 2px solid var(--line); }
.timeline > li:last-child { padding-bottom: 0; }
.timeline > li::before {
    content: ""; position: absolute; left: -7px; top: 0.45rem;
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--signal);
}
.timeline ul { list-style: disc; }

/* Projects */
.project + .project { margin-top: 2.75rem; padding-top: 2.75rem; border-top: 1px solid var(--line); }
.project img { display: block; max-width: 100%; height: auto; margin-bottom: 1rem; border: 1px solid var(--line); border-radius: 4px; }
.project p { margin: 0.5rem 0 0; }
.tech { color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.links { display: flex; gap: 1.25rem; margin-top: 1rem !important; }

/* Skills */
.skills { margin: 0; }
.skills > div { display: grid; grid-template-columns: minmax(120px, 190px) 1fr; gap: 0.25rem 1.5rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.skills > div:first-child { padding-top: 0; }
.skills dt { font-weight: 500; }
.skills dd { margin: 0; color: var(--muted); }
@media (max-width: 560px) { .skills > div { grid-template-columns: 1fr; } }

.credential + .credential { margin-top: 1.5rem; }

/* Contact form */
.contact-form { margin-top: 1.75rem; display: grid; gap: 1.1rem; }
.field { display: grid; gap: 0.35rem; }
.field label { font-weight: 500; font-size: 0.95rem; }
.field input, .field textarea {
    width: 100%; padding: 0.7rem 0.8rem;
    border: 1px solid var(--muted); border-radius: 4px;
    background: transparent; color: var(--ink);
    font: inherit;
}
.field input:focus-visible, .field textarea:focus-visible { outline-offset: 1px; border-color: var(--ink); }
.field.invalid input, .field.invalid textarea { border-color: var(--error); }
.err { color: var(--error); font-size: 0.9rem; }
.contact-form .button { justify-self: start; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.notice { margin: 1.25rem 0 0; padding: 0.8rem 1rem; border-left: 4px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.notice.error { border-left-color: var(--error); background: color-mix(in srgb, var(--error) 12%, transparent); }

.footer { padding: 2.5rem 0 3rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.95rem; }

.empty { padding-block: 5rem; }
