/* ---------- Theme tokens ---------- */
:root {
    --bg: #f6f8f7;
    --surface: #ffffff;
    --surface-2: #eef2f0;
    --text: #16201b;
    --muted: #5a6a62;
    --border: #e1e7e4;
    --accent: #1b9470;
    --accent-hover: #157a5c;
    --accent-soft: rgba(27, 148, 112, 0.1);
    --on-accent: #ffffff;
    --shadow: 0 1px 2px rgba(16, 24, 20, 0.04), 0 8px 24px rgba(16, 24, 20, 0.06);
    --radius: 14px;
    --max: 1080px;
    color-scheme: light;
}

:root[data-theme="dark"] {
    --bg: #0f1412;
    --surface: #171e1b;
    --surface-2: #1d2622;
    --text: #e6eeea;
    --muted: #93a49c;
    --border: #26312c;
    --accent: #2ec495;
    --accent-hover: #4fd6ab;
    --accent-soft: rgba(46, 196, 149, 0.12);
    --on-accent: #0c1a14;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 1rem;
    line-height: 1.65;
    background: var(--bg);
    color: var(--text);
    transition: background-color 0.25s, color 0.25s;
}

main { flex: 1; }

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; letter-spacing: -0.02em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 700; }
p { margin: 0 0 1em; }

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

.section { padding: 72px 0; }
.section + .section { padding-top: 0; }

.page-head { padding: 64px 0 32px; }
.page-head p { color: var(--muted); max-width: 620px; font-size: 1.1rem; }
.jump-links { display: flex; gap: 10px; align-items: center; font-weight: 600; font-size: 0.98rem; }
.jump-links span { color: var(--border); }
html { scroll-behavior: smooth; }
section[id] { scroll-margin-top: 84px; } /* keep headings clear of the sticky header */

.eyebrow {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.9rem;
}

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

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5em;
    padding: 0.75em 1.5em;
    border-radius: 999px;
    font-family: inherit;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); color: var(--on-accent); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    -webkit-backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--border);
}
.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
    gap: 16px;
}
.wordmark {
    font-weight: 800;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
    color: var(--text);
    white-space: nowrap;
}
.wordmark:hover { color: var(--text); }
.wordmark span { color: var(--accent); }

.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.2s, background-color 0.2s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; }

.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-toggle { display: none; }

@media (max-width: 760px) {
    .menu-toggle { display: inline-flex; }
    .nav {
        position: absolute;
        top: 68px;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        padding: 8px 16px 16px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        display: none;
    }
    .nav.open { display: flex; }
    .nav a { padding: 12px; }
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    margin-top: 48px;
}
.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.site-footer small { color: var(--muted); font-size: 0.9rem; }

.socials { display: flex; gap: 8px; }
.socials a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--muted);
    transition: color 0.2s, background-color 0.2s;
}
.socials a:hover { color: var(--accent); background: var(--accent-soft); }
.socials svg { width: 20px; height: 20px; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    transition: border-color 0.2s, transform 0.2s;
}
.card p { color: var(--muted); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.project-card { display: flex; flex-direction: column; }
.project-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.project-card .thumb {
    height: 150px;
    margin: -28px -28px 22px;
    border-radius: var(--radius) var(--radius) 0 0;
    background: var(--surface-2);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid var(--border);
}
.project-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-card .thumb svg { width: 56px; height: 56px; color: var(--accent); }
/* Brand logos: keep their own colors, never stretch or crop */
.project-card .thumb.logo-light { background: #ffffff; padding: 20px 32px; }
.project-card .thumb.logo-light img { object-fit: contain; }
.project-card .thumb .logo-icon { width: 96px; height: 96px; border-radius: 20px; box-shadow: var(--shadow); }
.project-card p { flex: 1; }
.project-card .card-link { font-weight: 600; margin-top: 8px; display: inline-flex; gap: 6px; align-items: center; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.tag {
    font-size: 0.8rem;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
}

/* ---------- Home ---------- */
.hero { padding: 88px 0 72px; }
.hero .container {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
    gap: 56px;
}
.hero p.lead { font-size: 1.15rem; color: var(--muted); max-width: 520px; margin-bottom: 1.8rem; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-photo {
    justify-self: end;
    width: 100%;
    max-width: 360px;
    aspect-ratio: 1;
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--surface-2);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; }

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    margin-bottom: 28px;
}
.section-head h2 { margin: 0; }

.skills { display: flex; flex-wrap: wrap; gap: 10px; }
.skill {
    padding: 8px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-weight: 500;
    font-size: 0.95rem;
}

@media (max-width: 800px) {
    .hero { padding: 48px 0; }
    .hero .container { grid-template-columns: 1fr; gap: 32px; }
    .hero-photo { justify-self: start; max-width: 220px; order: -1; }
}

/* ---------- About ---------- */
.about-intro {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 40px;
    align-items: center;
}
.about-intro img {
    width: 200px;
    height: 200px;
    object-fit: cover;
    border-radius: 20px;
    border: 1px solid var(--border);
}
.about-intro p { color: var(--muted); font-size: 1.1rem; }

.timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.timeline li { position: relative; padding: 0 0 28px 28px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}
.timeline h3 { margin: 0; }
.timeline .org-name { font-weight: 700; font-size: 1.15rem; }

/* Roles held at the same company, newest first */
.roles { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.timeline .roles li {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
}
.timeline .roles li::before { display: none; }
.timeline .roles li.current { border-color: var(--accent); background: var(--accent-soft); }
.timeline .roles li.current h3 { color: var(--accent); }
.timeline .roles h3 { font-size: 1rem; }
.timeline .org { font-weight: 500; }
.timeline .date { color: var(--muted); font-size: 0.9rem; }

@media (max-width: 640px) {
    .about-intro { grid-template-columns: 1fr; gap: 24px; }
    .about-intro img { width: 140px; height: 140px; }
}

/* ---------- Resume ---------- */
.resume-frame {
    width: 100%;
    height: 80vh;
    min-height: 500px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
}

/* ---------- Contact ---------- */
.contact-layout {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 40px;
    align-items: start;
}
.contact-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.contact-list a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-weight: 500;
}
.contact-list a:hover { border-color: var(--accent); color: var(--accent); }
.contact-list svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--accent); }

.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field input, .field textarea {
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    color: var(--text);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus, .field textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field textarea { resize: vertical; min-height: 140px; }

@media (max-width: 760px) {
    .contact-layout { grid-template-columns: 1fr; }
}

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
