:root {
    --bg: #f7f4f2;
    --bg-soft: #efeae6;
    --surface: #ffffff;
    --ink: #1b1918;
    --ink-soft: #5d5754;
    --line: #e4ddd8;
    --accent: #c9898b;
    --accent-deep: #b36d70;
    --accent-soft: #f3e4e4;
    --shadow: 0 18px 50px rgba(40, 32, 28, 0.08);
    --shadow-soft: 0 8px 24px rgba(40, 32, 28, 0.05);
    --radius: 22px;
    --radius-sm: 14px;
    --header: 84px;
    --serif: "Cormorant Garamond", Georgia, serif;
    --sans: "Poppins", sans-serif;
    --max: 1220px;
}

html[data-theme="dark"] {
    --bg: #121110;
    --bg-soft: #1a1817;
    --surface: #1e1c1b;
    --ink: #f4efe9;
    --ink-soft: #b7aea7;
    --line: #2c2927;
    --accent: #e0b0b2;
    --accent-deep: #c9898b;
    --accent-soft: #2a2222;
    --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 8px 24px rgba(0, 0, 0, 0.18);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.7;
    font-size: 16px;
    min-height: 100vh;
}

body.nav-open { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
h1, h2, h3, h4, .display { font-family: var(--serif); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; }

::selection { background: var(--accent-soft); color: var(--ink); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-soft); }
::-webkit-scrollbar-thumb { background: #c9b8b4; border-radius: 99px; }
html[data-theme="dark"] ::-webkit-scrollbar-thumb { background: #4a423e; }

.container { width: min(var(--max), calc(100% - 48px)); margin: 0 auto; }
.section { padding: 108px 0; }
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent-deep);
    font-weight: 500;
    margin: 0 0 16px;
}

.kicker::before {
    content: "";
    width: 22px;
    height: 1px;
    background: var(--accent);
}

.section-head { max-width: 640px; margin-bottom: 48px; }
.section-head h2 { font-size: clamp(36px, 5vw, 56px); margin: 0 0 14px; }
.section-head p { margin: 0; color: var(--ink-soft); }

.section-head.center,
.center { text-align: center; margin-left: auto; margin-right: auto; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 24px;
    border-radius: 999px;
    border: 1px solid transparent;
    background: var(--ink);
    color: var(--bg);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: transform .25s ease, background .25s ease, color .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink); }
.btn-accent { background: var(--accent); color: #2a1c1c; }
.btn-accent:hover { background: var(--accent-deep); color: #fff; }
.btn-small { min-height: 42px; padding: 0 16px; font-size: 13px; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    height: var(--header);
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid transparent;
    transition: border-color .25s ease, background .25s ease;
}

.site-header.scrolled { border-bottom-color: var(--line); }

.nav-shell {
    width: min(1340px, calc(100% - 40px));
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark, .footer-brand .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    border: 1px solid var(--ink);
    font-family: var(--serif);
    font-size: 18px;
}
.brand-name { font-family: var(--serif); font-size: 24px; }

.nav-desktop ul {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-desktop a {
    display: block;
    padding: 8px 10px;
    font-size: 12.5px;
    letter-spacing: 0.04em;
    color: var(--ink-soft);
    position: relative;
}

.nav-desktop a:hover,
.nav-desktop a.active { color: var(--ink); }

.nav-desktop a.active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 3px;
    height: 1px;
    background: var(--accent);
}

.nav-actions { display: flex; align-items: center; gap: 8px; }

.theme-toggle,
.menu-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    display: grid;
    place-items: center;
}

.theme-toggle svg { width: 18px; height: 18px; }
html[data-theme="light"] .icon-sun,
html[data-theme="dark"] .icon-moon { display: none; }

.menu-toggle { display: none; }
.menu-toggle span {
    display: block;
    width: 16px;
    height: 1.4px;
    background: currentColor;
    margin: 3px 0;
    transition: .25s ease;
}

.mobile-nav {
    position: fixed;
    inset: var(--header) 0 0 0;
    background: var(--bg);
    z-index: 35;
    overflow: auto;
    padding: 28px 24px 48px;
}

.mobile-nav[hidden] { display: none; }
.mobile-kicker { letter-spacing: 0.2em; text-transform: uppercase; font-size: 12px; color: var(--accent-deep); }
.mobile-nav ul { list-style: none; padding: 0; margin: 12px 0 32px; }
.mobile-nav a { display: block; padding: 12px 0; font-family: var(--serif); font-size: 32px; border-bottom: 1px solid var(--line); }
.mobile-nav a.active { color: var(--accent-deep); }
.mobile-socials { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--ink-soft); }

.preloader {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 90;
    display: grid;
    place-items: center;
    transition: opacity .5s ease, visibility .5s ease;
}

.preloader.hide { opacity: 0; visibility: hidden; }
.preloader-mark {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 1px solid var(--ink);
    display: grid;
    place-items: center;
    font-family: var(--serif);
    font-size: 30px;
    margin-bottom: 18px;
}
.preloader-bar { width: 84px; height: 1px; background: var(--line); overflow: hidden; }
.preloader-bar span {
    display: block;
    height: 100%;
    width: 40%;
    background: var(--accent);
    animation: load 1s ease infinite;
}

@keyframes load {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}

.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    z-index: 95;
}

.page-enter .site-main { animation: rise .7s ease; }
@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
}

.reveal { opacity: 0; transform: translateY(28px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

.hero {
    padding: 48px 0 88px;
    position: relative;
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 64px;
    align-items: center;
}

.hero-visual img {
    width: 100%;
    border-radius: 28px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    background: var(--surface);
    object-fit: cover;
    aspect-ratio: 4/3;
}

.hero h1 {
    font-size: clamp(52px, 8vw, 92px);
    margin: 8px 0 10px;
}

.hero .title { font-size: 18px; color: var(--accent-deep); margin: 0 0 18px; font-weight: 500; }
.hero .lede { font-size: 17px; color: var(--ink-soft); max-width: 520px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 32px 0 28px; }

.social-row { display: flex; gap: 10px; flex-wrap: wrap; }
.social-chip {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    display: grid;
    place-items: center;
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: var(--surface);
    transition: .25s ease;
}
.social-chip:hover { border-color: var(--accent); color: var(--accent-deep); transform: translateY(-2px); }

.portrait-wrap { position: relative; }
.portrait-frame {
    background: var(--surface);
    border-radius: 160px 160px 36px 36px;
    padding: 16px;
    box-shadow: var(--shadow);
    position: relative;
}
.portrait-frame img {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: cover;
    border-radius: 140px 140px 24px 24px;
    background: var(--bg-soft);
}
.portrait-caption {
    position: absolute;
    left: -18px;
    bottom: 48px;
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 14px 18px;
    border-radius: 18px;
    box-shadow: var(--shadow-soft);
    font-size: 13px;
}
.portrait-ornament {
    position: absolute;
    right: -20px;
    top: 40px;
    width: 110px;
    height: 110px;
    border: 1px solid var(--accent);
    border-radius: 50%;
    opacity: .55;
}

.card, .project-card, .service-card, .skill-card, .cert-card, .info-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
}

.projects-grid,
.services-grid,
.certs-grid,
.skills-grid {
    display: grid;
    gap: 22px;
}

.projects-grid { grid-template-columns: repeat(3, 1fr); }
.services-grid { grid-template-columns: repeat(4, 1fr); }
.certs-grid { grid-template-columns: repeat(3, 1fr); }
.skills-grid { grid-template-columns: repeat(2, 1fr); }

.project-card { overflow: hidden; transition: transform .3s ease, box-shadow .3s ease; }
.project-card:hover { transform: translateY(-6px); box-shadow: var(--shadow); }
.project-media { position: relative; overflow: hidden; }
.project-media img { width: 100%; aspect-ratio: 16/11; object-fit: cover; transition: transform .6s ease; }
.project-card:hover .project-media img { transform: scale(1.04); }
.project-body { padding: 22px 22px 24px; }
.project-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink-soft); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; }
.project-body h3 { margin: 0 0 8px; font-size: 28px; }
.project-body p { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; }
.tech-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tech-list span, .chip {
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: 1px solid var(--line);
    padding: 5px 9px;
    border-radius: 999px;
    color: var(--ink-soft);
}
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.filter-bar, .search-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 28px;
    align-items: center;
}

.filter-btn {
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    border-radius: 999px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
}

.filter-btn.active, .filter-btn:hover { border-color: var(--ink); color: var(--ink); }

.search-bar input,
.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    border-radius: 14px;
    padding: 13px 16px;
    outline: none;
}

.search-bar input { max-width: 280px; }
.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-size: 13px; margin-bottom: 7px; color: var(--ink-soft); }
.form-field textarea { min-height: 150px; resize: vertical; }
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus { border-color: var(--accent); }

.service-card, .skill-card, .cert-card, .info-card { padding: 28px; transition: transform .3s ease, box-shadow .3s ease; }
.service-card:hover, .skill-card:hover, .cert-card:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
.icon-box {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent-deep);
    margin-bottom: 18px;
    font-family: var(--serif);
    font-size: 22px;
}
.service-card h3, .info-card h3 { margin: 0 0 10px; font-size: 26px; }
.service-card p, .info-card p { color: var(--ink-soft); margin: 0; }

.skill-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.skill-top h3 { margin: 0; font-size: 22px; }
.bar { height: 5px; background: var(--bg-soft); border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-deep)); transition: width 1.1s ease; }
.skill-card.in .bar span { width: var(--value); }

.timeline { position: relative; margin: 0; padding: 0; list-style: none; }
.timeline::before {
    content: "";
    position: absolute;
    left: 17px;
    top: 8px;
    bottom: 8px;
    width: 1px;
    background: var(--line);
}

.timeline-item { position: relative; padding: 0 0 36px 64px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute;
    left: 10px;
    top: 10px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--accent);
}
.timeline-card { padding: 24px 26px; }
.timeline-card .when { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-deep); }
.timeline-card h3 { margin: 6px 0 4px; font-size: 28px; }
.timeline-card .org { margin: 0 0 10px; color: var(--ink-soft); }

.page-hero { padding: 56px 0 20px; }
.page-hero h1 { font-size: clamp(44px, 7vw, 78px); margin: 0 0 12px; }
.page-hero p { max-width: 620px; color: var(--ink-soft); }

.about-layout { display: grid; grid-template-columns: .85fr 1.15fr; gap: 48px; }
.about-photo { border-radius: 36px; overflow: hidden; border: 1px solid var(--line); }
.about-photo img { width: 100%; aspect-ratio: 4/5; object-fit: cover; }
.detail-list { display: grid; gap: 10px; margin: 24px 0 0; }
.detail-list div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 10px; font-size: 14px; }
.detail-list span { color: var(--ink-soft); }

.interest-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.interest-pills span { padding: 10px 16px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }

.cta-band {
    background: var(--ink);
    color: var(--bg);
    border-radius: 36px;
    padding: 64px;
    display: flex;
    justify-content: space-between;
    gap: 32px;
    align-items: center;
}

html[data-theme="dark"] .cta-band { background: #2a2422; color: var(--ink); }
.cta-band h2 { font-size: clamp(36px, 5vw, 58px); margin: 0 0 10px; }
.cta-band p { margin: 0; opacity: .75; }

.contact-grid { display: grid; grid-template-columns: .85fr 1.15fr; gap: 28px; }
.contact-aside { padding: 32px; }
.contact-aside a { color: var(--accent-deep); }

.testimonial-slider { position: relative; }
.testimonial-track { display: grid; gap: 22px; }
.testimonial-card { padding: 32px; min-height: 280px; }
.testimonial-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.testimonial-top img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--bg-soft); }
.stars { color: #c9b08a; letter-spacing: 2px; }
.star { opacity: .3; }
.star.filled { opacity: 1; color: #c9a36a; }
.slider-nav { display: flex; gap: 8px; margin-top: 18px; }
.slider-nav button {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
}

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(18, 16, 15, .78);
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 24px;
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: min(920px, 100%); max-height: 80vh; border-radius: 18px; }
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.site-footer { border-top: 1px solid var(--line); padding: 64px 0 0; margin-top: 40px; }
.footer-grid { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 32px; padding-bottom: 48px; }
.footer-brand h3 { margin: 12px 0 4px; font-size: 32px; }
.footer-brand p, .footer-links { color: var(--ink-soft); }
.footer-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.site-footer h4 { margin: 0 0 14px; font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase; font-family: var(--sans); font-weight: 500; }
.footer-base {
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 16px;
    width: min(var(--max), calc(100% - 48px));
    margin: 0 auto;
    padding: 20px 0 28px;
    font-size: 13px;
    color: var(--ink-soft);
}

.back-to-top {
    position: fixed;
    right: 22px;
    bottom: 22px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: .25s ease;
    z-index: 30;
}
.back-to-top.show { opacity: 1; pointer-events: auto; }
.back-to-top svg { width: 20px; height: 20px; }

.toast {
    position: fixed;
    right: 22px;
    bottom: 80px;
    background: var(--ink);
    color: var(--bg);
    padding: 14px 18px;
    border-radius: 14px;
    z-index: 70;
    animation: rise .4s ease;
}
.toast-error { background: #8a3a3a; color: #fff; }
.toast-success { background: #2f4638; color: #fff; }

.empty-state { padding: 48px; text-align: center; color: var(--ink-soft); }

.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; font-size: 14px; }
.alert-success { background: #e8f2ea; color: #245334; }
.alert-error { background: #f8e8e8; color: #7a2d2d; }
html[data-theme="dark"] .alert-success { background: #1d2a21; color: #cfe3d4; }
html[data-theme="dark"] .alert-error { background: #2c1c1c; color: #f0cfcf; }

.project-detail { display: grid; grid-template-columns: 1.15fr .85fr; gap: 36px; }
.project-detail img { width: 100%; border-radius: 28px; border: 1px solid var(--line); }
.feature-list { margin: 0; padding-left: 18px; color: var(--ink-soft); }

.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 80px 20px; }
.error-page h1 { font-size: 120px; margin: 0; }

@media (max-width: 1100px) {
    .nav-desktop { display: none; }
    .menu-toggle { display: grid; }
    .hero-grid, .about-layout, .contact-grid, .project-detail, .cta-band, .footer-grid {
        grid-template-columns: 1fr;
    }
    .projects-grid, .certs-grid { grid-template-columns: repeat(2, 1fr); }
    .services-grid { grid-template-columns: repeat(2, 1fr); }
    .cta-band { padding: 40px 28px; }
}

@media (max-width: 720px) {
    .container { width: min(var(--max), calc(100% - 32px)); }
    .section { padding: 76px 0; }
    .projects-grid, .certs-grid, .services-grid, .skills-grid { grid-template-columns: 1fr; }
    .hero { padding-top: 24px; }
    .portrait-caption, .portrait-ornament { display: none; }
    .footer-base { flex-direction: column; }
}
