:root {
    --bg: #DAF1DE;
    --card: #eaf7ed;
    --ink: #051F20;
    --mute: #235347;
    --acc: #235347;
    --hi: #8EB69B;
    --line: #b5d6bf;
    --ph: #c4e3cb
}

@media (prefers-color-scheme:dark) {
    :root:not([data-theme="light"]) {
        --bg: #051F20;
        --card: #0B2B26;
        --ink: #DAF1DE;
        --mute: #8EB69B;
        --acc: #8EB69B;
        --hi: #235347;
        --line: #235347;
        --ph: #163832
    }
}

:root[data-theme="dark"] {
    --bg: #051F20;
    --card: #0B2B26;
    --ink: #DAF1DE;
    --mute: #8EB69B;
    --acc: #8EB69B;
    --hi: #235347;
    --line: #235347;
    --ph: #163832
}

* {
    box-sizing: border-box;
    margin: 0
}

:root {
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px)
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px
}

body {
    background: var(--bg);
    color: var(--ink);
    font: 400 1rem/1.65 "DM Sans", system-ui, sans-serif
}

h1,
h2,
h3 {
    font-family: "Bricolage Grotesque", system-ui, sans-serif;
    line-height: 1.1
}

a {
    color: inherit
}

:focus-visible {
    outline: 3px solid var(--acc);
    outline-offset: 3px
}

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px
}

section {
    padding: 88px 0
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    text-align: center;
    margin-bottom: 48px
}

h2::after {
    content: "";
    display: block;
    width: 56px;
    height: 4px;
    background: var(--acc);
    margin: 14px auto 0;
    border-radius: 2px
}

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

header .wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px
}

.logo {
    font: 800 1.1rem "Bricolage Grotesque", sans-serif;
    text-decoration: none;
    letter-spacing: .02em
}

nav a {
    margin-left: 24px;
    text-decoration: none;
    font-weight: 500;
    color: var(--mute);
    position: relative
}

nav a:hover {
    color: var(--ink)
}

nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    height: 2px;
    width: 100%;
    background: var(--acc);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s
}

nav a:hover::after {
    transform: scaleX(1)
}

/* hero */
.hero {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 48px;
    align-items: center;
    padding: 72px 0 88px
}

.hero h1 {
    font-size: clamp(2.6rem, 7vw, 4.8rem);
    font-weight: 800
}

.hero .hi {
    display: block;
    font-size: .45em;
    font-weight: 500;
    color: var(--mute);
    margin-bottom: 8px
}

.word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom
}

.word span {
    display: inline-block;
    transform: translateY(105%);
    animation: up .8s cubic-bezier(.2, .8, .2, 1) forwards
}

.word:nth-child(2) span {
    animation-delay: .12s
}

.word:nth-child(3) span {
    animation-delay: .24s
}

@keyframes up {
    to {
        transform: none
    }
}

.role {
    display: inline-block;
    background: var(--ink);
    color: var(--bg);
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 500;
    margin: 20px 0 16px
}

.hero p.lead {
    color: var(--mute);
    max-width: 44ch
}

.btns {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 28px
}

.btn {
    display: inline-block;
    padding: 13px 26px;
    border-radius: 999px;
    font-weight: 500;
    text-decoration: none;
    border: 2px solid var(--ink);
    transition: transform .2s, background .2s, color .2s
}

.btn.pri {
    background: var(--acc);
    border-color: var(--acc);
    color: #fff
}

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

.btn.sec:hover {
    background: var(--ink);
    color: var(--bg)
}

.photo {
    position: relative;
    aspect-ratio: 1/1.05;
    border-radius: 18px;
    background: var(--ph);
    display: grid;
    place-items: center;
    color: var(--mute);
    text-align: center;
    font-size: .9rem;
    animation: float 6s ease-in-out infinite
}

.photo::before {
    content: "";
    position: absolute;
    inset: 0;
    transform: translate(14px, 14px);
    border: 2px solid var(--acc);
    border-radius: 18px;
    z-index: -1
}

.photo b {
    display: block;
    font: 800 4rem "Bricolage Grotesque", sans-serif;
    color: var(--acc)
}

@keyframes float {
    50% {
        transform: translateY(-10px)
    }
}

/* what i do */
.grid3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 24px;
    transition: transform .25s, border-color .25s
}

.card:hover {
    transform: translateY(-6px);
    border-color: var(--acc)
}

.card .ph {
    height: 130px;
    border-radius: 10px;
    background: var(--ph);
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    font-size: 2.4rem
}

.card h3 {
    font-size: 1.1rem;
    margin-bottom: 8px
}

.card p {
    color: var(--mute);
    font-size: .94rem
}

/* about */
.about {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 56px;
    align-items: center
}

.about h2 {
    text-align: left
}

.about h2::after {
    margin-left: 0
}

.about .photo {
    animation: none;
    aspect-ratio: 1/1
}

.checks {
    list-style: none;
    padding: 0;
    margin-top: 22px;
    display: grid;
    gap: 10px
}

.checks li {
    display: flex;
    gap: 12px;
    align-items: center;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 14px
}

.checks li::before {
    content: "✓";
    display: grid;
    place-items: center;
    flex: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--hi);
    color: #1b1730;
    font-weight: 700;
    font-size: .8rem
}

/* portfolio */
.pf {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 28px
}

.pf a {
    text-decoration: none;
    text-align: center;
    font-weight: 500
}

.pf .thumb {
    aspect-ratio: 16/10;
    border-radius: 14px;
    background: var(--ph);
    margin-bottom: 14px;
    display: grid;
    place-items: center;
    color: var(--mute);
    position: relative;
    overflow: hidden
}

.pf .thumb::after {
    content: "View project";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: var(--acc);
    color: #fff;
    font-weight: 500;
    transform: translateY(101%);
    transition: transform .35s cubic-bezier(.2, .8, .2, 1)
}

.pf a:hover .thumb::after,
.pf a:focus-visible .thumb::after {
    transform: none
}

.more {
    text-align: center;
    margin-top: 40px
}

/* blog */
.blog {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px
}

.post {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    color: inherit;
    font: inherit;
    padding: 0;
    transition: transform .25s, border-color .25s
}

.post:hover {
    transform: translateY(-6px);
    border-color: var(--acc)
}

.post .cover {
    aspect-ratio: 16/10;
    background: var(--ph);
    display: grid;
    place-items: center;
    color: var(--mute);
    font-size: .85rem
}

.post .body {
    padding: 18px 20px 22px
}

.post time {
    font-size: .82rem;
    color: var(--mute)
}

.post h3 {
    font-size: 1.1rem;
    margin: 6px 0
}

.post p {
    color: var(--mute);
    font-size: .92rem
}

dialog {
    max-width: 640px;
    width: calc(100% - 32px);
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--card);
    color: var(--ink);
    padding: 32px;
    margin: auto
}

dialog::backdrop {
    background: rgba(20, 17, 42, .6)
}

dialog[open] {
    animation: pop .3s cubic-bezier(.2, .8, .2, 1)
}

@keyframes pop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(.98)
    }
}

dialog h3 {
    font-size: 1.7rem;
    margin: 6px 0 16px
}

dialog p {
    margin-bottom: 14px;
    max-width: 60ch
}

dialog .btn {
    margin-top: 8px;
    background: none;
    color: var(--ink);
    cursor: pointer;
    font: inherit;
    font-weight: 500
}

/* skills */
.rail {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 6px 2px 18px
}

.rail .card {
    flex: 0 0 250px;
    scroll-snap-align: start
}

.rail h3 {
    margin: 10px 0 6px
}

.ico {
    font-size: 1.6rem
}

.arrows {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 8px
}

.arrows button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--ink);
    background: none;
    color: var(--ink);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background .2s, color .2s
}

.arrows button:hover {
    background: var(--ink);
    color: var(--bg)
}

/* cta */
.cta {
    background: var(--ink);
    color: var(--bg);
    text-align: center;
    padding: 80px 0;
    overflow: hidden
}

.cta h2 {
    color: var(--bg);
    margin-bottom: 28px
}

.cta h2::after {
    background: var(--hi)
}

.cta .btn {
    border-color: var(--bg)
}

.cta .pri {
    background: var(--hi);
    border-color: var(--hi);
    color: #1b1730
}

.cta .sec {
    color: var(--bg)
}

.cta .sec:hover {
    background: var(--bg);
    color: var(--ink)
}

.cta .btns {
    justify-content: center
}

/* footer */
footer .wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    padding-top: 56px;
    padding-bottom: 40px
}

footer ul {
    list-style: none;
    padding: 0;
    display: grid;
    gap: 12px
}

footer a {
    text-decoration: none;
    color: var(--mute)
}

footer a:hover {
    color: var(--acc)
}

.copy {
    color: var(--mute);
    font-size: .85rem;
    margin-top: 14px
}

/* scroll reveal (one gentle effect on grids only) */
.rv {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity .7s, transform .7s
}

.rv.in {
    opacity: 1;
    transform: none
}

@media (max-width:820px) {

    .hero,
    .about {
        grid-template-columns: 1fr
    }

    .grid3,
    .pf,
    .blog {
        grid-template-columns: 1fr
    }

    .photo {
        max-width: 340px
    }

    footer .wrap {
        grid-template-columns: 1fr
    }
}

@media (prefers-reduced-motion:reduce) {

    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important
    }

    .word span {
        transform: none
    }

    .rv {
        opacity: 1;
        transform: none
    }

    html {
        scroll-behavior: auto
    }
}

/* center the navbar */
header .wrap {
    justify-content: center
}

nav {
    display: flex;
    justify-content: center
}

nav a {
    margin: 0 12px
}

/* center the hero */
.hero {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center
}

.hero .btns {
    justify-content: center
}

.hero .photo {
    margin: 0 auto;
    width: min(360px, 80%)
}

.skills-sub {
    text-align: center;
    margin: -32px 0 48px;
    color: var(--mute);
    font-weight: 600;
    font-size: .9rem
}

.skill-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px
}

.skill-group {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 22px
}

.skill-group h3 {
    font-size: 1rem;
    margin-bottom: 14px
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px
}

.tags span {
    font-size: .78rem;
    padding: 5px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--mute)
}

.skill-group {
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease
}

.skill-group:hover {
    transform: translateY(-4px);
    border-color: var(--acc);
    box-shadow: 0 0 22px color-mix(in srgb, var(--acc) 35%, transparent)
}

.tags span {
    cursor: pointer;
    transition: all .2s ease
}

.tags span:hover,
.tags span.on {
    color: var(--bg);
    background: var(--acc);
    border-color: var(--acc);
    box-shadow: 0 0 14px var(--acc)
}

.filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: -16px 0 40px;
    flex-wrap: wrap
}

.fbtn {
    font: inherit;
    font-weight: 500;
    padding: 9px 22px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--ink);
    cursor: pointer;
    transition: all .2s ease
}

.fbtn:hover {
    border-color: var(--acc);
    box-shadow: 0 0 14px color-mix(in srgb, var(--acc) 40%, transparent)
}

.fbtn.on {
    background: var(--acc);
    border-color: var(--acc);
    color: var(--bg)
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center
}

.thumb.fit img {
    object-fit: contain;
    padding: 14px
}

/* ===== cleanup additions ===== */

/* hero role pills */
.roles {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin: 22px 0 6px
}

.roles .role {
    margin: 0
}

/* about photo */
.photo img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 18px
}

/* project cards: title, description, status badge */
.pf strong {
    display: block;
    font: 700 1.05rem "Bricolage Grotesque", system-ui, sans-serif
}

.pf .pd {
    display: block;
    max-width: 46ch;
    margin: 4px auto 0;
    font-size: .9rem;
    font-weight: 400;
    color: var(--mute)
}

.badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    border: 1px solid var(--acc);
    border-radius: 999px;
    font: 500 .7rem "DM Sans", system-ui, sans-serif;
    color: var(--acc);
    vertical-align: middle
}

/* thumbnail without a screenshot: show the tech stack */
.thumb.txt {
    padding: 0 16px;
    font: 700 1.15rem "Bricolage Grotesque", system-ui, sans-serif;
    color: var(--acc)
}

/* navigation on small screens: keep every link, let them wrap */
@media (max-width:820px) {
    header .wrap {
        height: auto;
        min-height: 64px;
        padding-top: 8px;
        padding-bottom: 8px
    }

    nav {
        flex-wrap: wrap
    }

    nav a {
        margin: 4px 7px;
        font-size: .88rem
    }
}

/* keep the full name on screen on narrow phones */
@media (max-width:480px) {
    .hero h1 {
        font-size: clamp(1.7rem, 8.4vw, 2.6rem)
    }
}