:root {
    color-scheme: light dark;
    --bg: light-dark(#f7f8fb, #101318);
    --surface: light-dark(#ffffff, #181d24);
    --surface2: light-dark(#eef3f7, #202733);
    --text: light-dark(#17202a, #f5f7fb);
    --muted: light-dark(#657184, #a7b1c2);
    --line: light-dark(#d9e1ea, #303946);
    --accent: light-dark(#0f8f7c, #39d6bd);
    --accent2: light-dark(#e95f45, #ff9b78);
    --gold: #f6bd45;
    --shadow: light-dark(#ccd6e3, #080a0e);
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, transparent), transparent 36%),
        linear-gradient(225deg, color-mix(in srgb, var(--accent2) 12%, transparent), transparent 34%),
        var(--bg);
    color: var(--text);
}

.wrap {
    width: min(1120px, calc(100% - 40px));
    margin: auto;
}

.nav,
.section-head,
.project-top,
.project-foot,
.progress-head,
.modal-head,
footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.nav {
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 18px 0;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

a {
    color: inherit;
    text-decoration: none;
}

.brand {
    font-size: 1.05rem;
    font-weight: 900;
}

.brand span,
h1 strong {
    color: var(--accent);
}

.navlinks {
    display: flex;
    gap: 20px;
    color: var(--muted);
    font-size: 0.92rem;
}

.navlinks a,
footer a,
.text-link {
    transition: color 0.2s ease, transform 0.2s ease;
}

.navlinks a:hover,
footer a:hover,
.text-link:hover {
    color: var(--accent);
}

.pill,
.btn,
.stat,
.project,
.profile-card,
.contact,
.skill,
.modal {
    border: 1px solid var(--line);
    box-shadow: 0 14px 32px color-mix(in srgb, var(--shadow) 32%, transparent);
}

.pill {
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 800;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 44px;
    align-items: center;
    min-height: calc(100vh - 86px);
    padding: 48px 0;
}

.hero-copy {
    max-width: 760px;
}

.eyebrow {
    color: var(--accent);
    font-weight: 900;
    font-size: 0.76rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0 0 10px;
}

h1,
h2,
h3,
p {
    overflow-wrap: anywhere;
}

h1 {
    max-width: 760px;
    font-size: clamp(2.6rem, 6vw, 5.4rem);
    line-height: 0.98;
    margin: 16px 0;
}

h2 {
    font-size: clamp(1.55rem, 3vw, 2.3rem);
    line-height: 1.1;
}

.lead {
    max-width: 660px;
    color: var(--muted);
    font-size: 1.08rem;
    line-height: 1.8;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 18px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 850;
    font-size: 0.92rem;
    font-family: inherit;
}

.btn.primary {
    border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
    background: linear-gradient(135deg, var(--accent), #4fc7a2);
    color: #051a17;
}

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

.profile-card {
    padding: 26px;
    border-radius: 8px;
    background: linear-gradient(145deg, var(--surface), var(--surface2));
}

.avatar {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    font-weight: 950;
    font-size: 1.45rem;
}

.profile-card p,
.project p,
.milestone p,
.contact p,
.modal p {
    color: var(--muted);
    line-height: 1.65;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 22px;
}

.stat {
    padding: 12px 10px;
    border-radius: 8px;
    background: var(--surface);
}

.stat strong,
.stat small {
    display: block;
}

.stat small {
    color: var(--muted);
    font-size: 0.72rem;
}

section {
    padding: 42px 0 54px;
}

.section-head {
    margin-bottom: 22px;
}

.section-head h2 {
    margin: 0;
}

.section-head > p {
    max-width: 340px;
    color: var(--muted);
    font-size: 0.92rem;
    text-align: right;
}

.village-shell {
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: linear-gradient(#b6e3d7, #e7d49b);
    box-shadow: 0 18px 36px color-mix(in srgb, var(--shadow) 36%, transparent);
}

#villageCanvas {
    display: block;
    width: 100%;
    height: 440px;
    touch-action: pan-y;
}

.village-hud {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    display: flex;
    justify-content: space-between;
    gap: 8px;
    pointer-events: none;
    color: #21352e;
}

.village-hud > * {
    padding: 8px 10px;
    border: 1px solid #77a491;
    border-radius: 8px;
    background: #ffffffe8;
    font-size: 0.76rem;
}

.village-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: calc(100% - 24px);
    margin: 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: #ffffffe8;
    color: #21352e;
    font-size: 0.76rem;
    font-weight: 800;
    text-align: center;
}

.fallback {
    display: none;
    color: #21352e;
    padding: 14px;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.project {
    display: flex;
    flex-direction: column;
    min-height: 285px;
    padding: 22px;
    border-radius: 8px;
    background: var(--surface);
}

.project-icon {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 16%, var(--surface2));
    color: var(--accent);
    font-weight: 950;
}

.status,
.tag {
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface2);
    color: var(--muted);
    font-size: 0.74rem;
    padding: 5px 9px;
}

.tags,
.skills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.progress-head {
    color: var(--muted);
    font-size: 0.8rem;
    margin-bottom: 8px;
}

.progress {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--surface2);
}

.progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--accent), var(--gold), var(--accent2));
}

.project-foot {
    margin-top: auto;
    padding-top: 20px;
}

.project-foot small {
    color: var(--muted);
}

.text-link {
    border: 0;
    background: none;
    color: var(--accent);
    cursor: pointer;
    font: inherit;
    font-weight: 850;
    padding: 0;
}

.timeline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.milestone {
    padding: 20px;
    border-left: 4px solid var(--accent);
    border-radius: 0 8px 8px 0;
    background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.milestone small {
    color: var(--accent);
    font-weight: 900;
}

.skill {
    padding: 10px 13px;
    border-radius: 8px;
    background: var(--surface);
    color: var(--muted);
    font-weight: 750;
}

.contact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--surface), var(--surface2));
}

.contact h2 {
    margin: 0;
}

footer {
    padding: 26px 0 34px;
    margin-top: 18px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.82rem;
}

footer span:last-child {
    display: flex;
    gap: 14px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    place-items: center;
    padding: 18px;
    background: #080b12cc;
    z-index: 10;
}

.modal-backdrop.open {
    display: grid;
}

.modal {
    width: min(560px, 100%);
    max-height: 85vh;
    overflow: auto;
    padding: 24px;
    border-radius: 8px;
    background: var(--surface);
}

.modal-head {
    align-items: flex-start;
}

.modal-head h2 {
    margin: 0;
}

.close {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface2);
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
}

@media (max-width: 820px) {
    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
    }

    .profile-card {
        max-width: 540px;
    }

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

@media (max-width: 620px) {
    .wrap {
        width: calc(100% - 28px);
    }

    .nav {
        align-items: flex-start;
        flex-direction: column;
    }

    .navlinks {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
        font-size: 0.8rem;
    }

    .pill {
        display: none;
    }

    h1 {
        font-size: 2.65rem;
    }

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

    .section-head,
    .contact,
    footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .section-head > p {
        text-align: left;
    }

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

    #villageCanvas {
        height: 350px;
    }

    .village-hud {
        flex-direction: column;
        right: auto;
    }

    .village-hud > * {
        font-size: 0.68rem;
        padding: 6px 8px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
