:root {
    --bg: #ffffff;
    --bg-alt: #f6f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #5b6475;
    --border: #e4e7ef;
    --accent: #4f46e5;
    --accent-soft: #eef0ff;
    --success: #059669;
    --danger: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0f19;
        --bg-alt: #111727;
        --surface: #151c2e;
        --text: #e6e9f2;
        --muted: #98a1b5;
        --border: #232b40;
        --accent: #818cf8;
        --accent-soft: #1e2340;
        --shadow: 0 8px 24px rgba(0, 0, 0, .3);
    }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
    margin: 0;
    font: 16px/1.65 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { font-family: Sora, Inter, sans-serif; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
h2 { font-size: clamp(1.75rem, 3vw, 2.4rem); margin-bottom: 2rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
ul, ol { margin: 0; padding: 0; list-style: none; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.section { padding: 96px 0; }
.section.alt { background: var(--bg-alt); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .5rem; }
.accent { color: var(--accent); }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .8rem 1.4rem; border-radius: 10px; border: 1px solid var(--accent);
    background: var(--accent); color: #fff; font: 600 .95rem Inter, sans-serif;
    cursor: pointer; transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 8px 20px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); box-shadow: none; }
.btn-sm { padding: .5rem 1rem; font-size: .875rem; color: #fff !important; }

/* Nav */
.nav {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s;
}
.nav.scrolled { border-bottom-color: var(--border); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; color: var(--text); }
.brand span {
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
    background: var(--accent); color: #fff; font: 700 .85rem Sora, sans-serif;
}
.nav-links { display: flex; align-items: center; gap: 1.75rem; }
.nav-links a { color: var(--muted); font-size: .93rem; font-weight: 500; }
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-toggle { display: none; background: none; border: 0; color: var(--text); font-size: 1.3rem; cursor: pointer; padding: 8px; }

/* Hero */
.hero { padding: 72px 0 64px; }
.hero-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 56px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); margin-bottom: 1.25rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 580px; }
.badge {
    display: inline-flex; align-items: center; gap: .5rem; padding: .35rem .8rem; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 500; margin-bottom: 1.5rem;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 25%, transparent); }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 2rem 0; }
.hero-photo { position: relative; justify-self: center; max-width: 380px; }
.hero-photo::before {
    content: ""; position: absolute; inset: 18px -18px -18px 18px; border-radius: 24px;
    background: linear-gradient(135deg, var(--accent), #06b6d4); opacity: .9;
}
.hero-photo img { position: relative; border-radius: 24px; aspect-ratio: 4/5; object-fit: cover; width: 100%; box-shadow: var(--shadow); }
.socials { display: flex; gap: .6rem; }
.socials a {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px;
    border: 1px solid var(--border); color: var(--muted); transition: .15s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); }
.stats {
    display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 72px;
    border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.stats div { padding: 1.5rem; text-align: center; border-left: 1px solid var(--border); }
.stats div:first-child { border-left: 0; }
.stats strong { display: block; font: 700 1.9rem Sora, sans-serif; }
.stats span { color: var(--muted); font-size: .9rem; }

/* About */
.about-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 56px; }
.about-grid p { color: var(--muted); }
.about-grid strong { color: var(--text); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; margin: 2rem 0 0; padding-top: 2rem; border-top: 1px solid var(--border); }
.facts dt { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.facts dd { margin: .2rem 0 0; font-weight: 500; word-break: break-word; }

/* Experience */
.cv-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 48px; align-items: start; }
.timeline { position: relative; padding-left: 28px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.job {
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 1.5rem; margin-bottom: 1.25rem; box-shadow: var(--shadow);
}
.job::before {
    content: ""; position: absolute; left: -28px; top: 1.8rem; width: 14px; height: 14px; border-radius: 50%;
    background: var(--bg-alt); border: 3px solid var(--accent);
}
.job-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.job h3 { margin: 0; }
.company { color: var(--accent); font-weight: 500; margin: .2rem 0 0; font-size: .93rem; }
.period { font-size: .82rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.period.current { color: var(--success); background: color-mix(in srgb, var(--success) 12%, transparent); padding: .2rem .6rem; border-radius: 999px; }
.job-project + .job-project { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px dashed var(--border); }
.job-project h4 { font: 600 .95rem Inter, sans-serif; margin: 0 0 .35rem; }
.job-project h4 a { color: var(--text); }
.job-project h4 a:hover { color: var(--accent); }
.job-project h4 i { font-size: .7rem; color: var(--muted); margin-left: .2rem; }
.job-desc { font-size: .95rem; margin-bottom: .6rem; }
.highlights { margin-bottom: 1rem; }
.highlights li { position: relative; padding-left: 1.1rem; color: var(--muted); font-size: .95rem; margin-bottom: .35rem; }
.highlights li::before { content: ""; position: absolute; left: 0; top: .7em; width: 6px; height: 2px; background: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: .4rem; }
.tags li {
    font-size: .8rem; padding: .25rem .65rem; border-radius: 999px;
    background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.aside-title { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.25rem; }
.aside-title i { color: var(--accent); }
.edu li { display: flex; flex-direction: column; padding: 1rem 0; border-bottom: 1px solid var(--border); }
.edu li:first-child { padding-top: 0; }
.edu strong { font-size: .95rem; margin: .15rem 0; }
.edu li > span:last-child { color: var(--muted); font-size: .88rem; }

/* Cards / skills / services */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem; }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.skills h3 { margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem; }
.skills h3 i { color: var(--accent); font-size: .95rem; }
.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.service { transition: transform .2s, border-color .2s; }
.service:hover { transform: translateY(-3px); border-color: var(--accent); }
.service i {
    display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
    background: var(--accent-soft); color: var(--accent); font-size: 1.2rem; margin-bottom: 1.1rem;
}
.service p { color: var(--muted); margin: 0; font-size: .95rem; }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: -0.75rem 0 2rem; }
.filters button {
    padding: .5rem 1.1rem; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface); color: var(--muted); font: 500 .9rem Inter, sans-serif; cursor: pointer;
}
.filters button.active, .filters button:hover { background: var(--text); color: var(--bg); border-color: var(--text); }
.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; }
.project {
    display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; transition: transform .2s, box-shadow .2s;
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.project.hidden { display: none; }
.project-img { aspect-ratio: 16/10; overflow: hidden; background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.project-img img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s; }
.project:hover .project-img img { transform: scale(1.04); }
.project-body { padding: 1.25rem 1.4rem 1.4rem; display: flex; flex-direction: column; flex: 1; }
.project-type { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 600; }
.project h3 { margin: .3rem 0 .6rem; }
.project p { color: var(--muted); font-size: .9rem; }
.project-link { margin-top: auto; font-weight: 600; font-size: .9rem; }
.project-link i { font-size: .75rem; transition: transform .15s; }
.project-link:hover i { transform: translateX(3px); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 56px; align-items: start; }
.contact-grid > div > p { color: var(--muted); }
.contact-list li { display: flex; align-items: center; gap: .8rem; padding: .55rem 0; word-break: break-word; }
.contact-list i { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; border-radius: 9px; background: var(--accent-soft); color: var(--accent); }
.contact-list a { color: var(--text); }
.form { display: grid; gap: 1rem; padding: 2rem; box-shadow: var(--shadow); }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form label { display: grid; gap: .35rem; font-size: .85rem; font-weight: 500; color: var(--muted); }
.form input, .form textarea {
    width: 100%; padding: .75rem .9rem; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg); color: var(--text); font: 400 1rem Inter, sans-serif; transition: border-color .15s, box-shadow .15s;
}
.form input:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form .btn { justify-self: start; }
.alert { padding: .8rem 1rem; border-radius: 10px; font-size: .92rem; margin: 0; }
.alert.success { background: color-mix(in srgb, var(--success) 12%, transparent); color: var(--success); }
.alert.error { background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

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

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s ease, transform .6s ease; }
.reveal.visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
}

/* Responsive */
@media (max-width: 960px) {
    .hero-grid, .about-grid, .cv-grid, .contact-grid { grid-template-columns: 1fr; gap: 40px; }
    .hero-photo { order: -1; max-width: 260px; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stats div:nth-child(3) { border-left: 0; }
    .stats div:nth-child(n+3) { border-top: 1px solid var(--border); }
}
@media (max-width: 820px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none; position: absolute; top: 68px; left: 0; right: 0; flex-direction: column; align-items: stretch;
        gap: 0; padding: .5rem 20px 1.25rem; background: var(--bg); border-bottom: 1px solid var(--border);
    }
    .nav-links.open { display: flex; }
    .nav-links a { padding: .8rem 0; }
    .nav-links .btn { margin-top: .5rem; justify-content: center; }
}
@media (max-width: 560px) {
    .wrap { padding: 0 16px; }
    .section { padding: 72px 0; }
    .hero { padding-top: 40px; }
    .projects { grid-template-columns: 1fr; }
    .form { padding: 1.4rem; }
    .form .row, .facts { grid-template-columns: 1fr; }
    .job-head { flex-direction: column; gap: .25rem; }
}
