:root {
    --background: 0 0% 98%;
    --foreground: 0 0% 9%;
    --card: 0 0% 100%;
    --muted: 0 0% 45%;
    --border: 0 0% 89%;
    --secondary: 0 0% 94%;
    --gh0: 0 0% 92%;
    --gh1: 120 40% 75%;
    --gh2: 120 40% 56%;
    --gh3: 120 45% 40%;
    --gh4: 120 50% 28%;
}

[data-theme="dark"] {
    --background: 0 0% 4%;
    --foreground: 0 0% 87%;
    --card: 0 0% 7%;
    --muted: 0 0% 58%;
    --border: 0 0% 20%;
    --secondary: 0 0% 14%;
    --gh0: 0 0% 15%;
    --gh1: 120 35% 25%;
    --gh2: 120 40% 35%;
    --gh3: 120 45% 45%;
    --gh4: 120 50% 55%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-family: 'Inter', system-ui, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

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

.container-narrow {
    margin: 0 auto;
    max-width: 48rem;
    padding: 0 1.5rem;
}

.nav-shell {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid hsl(var(--border) / 0.6);
    background: hsl(var(--background) / 0.86);
    backdrop-filter: blur(10px);
}

.nav {
    min-height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.brand {
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.brand span {
    color: hsl(var(--muted));
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    white-space: nowrap;
}

.nav-links a {
    font-size: 0.84rem;
    color: hsl(var(--muted));
    transition: color 150ms ease;
    position: relative;
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -0.2rem;
    height: 1px;
    width: 100%;
    background: hsl(var(--foreground));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 160ms ease;
}

.nav-links a:hover,
.nav-links a.active {
    color: hsl(var(--foreground));
}

.nav-links a:hover::after,
.nav-links a.active::after {
    transform: scaleX(1);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.theme-toggle {
    border: 1px solid hsl(var(--border));
    border-radius: 0.6rem;
    background: hsl(var(--card));
    color: hsl(var(--muted));
    min-height: 1.95rem;
    min-width: 1.95rem;
    padding: 0;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle svg {
    width: 1rem;
    height: 1rem;
}

.theme-toggle .icon-sun {
    display: none;
}

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

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

.theme-toggle:hover {
    background: hsl(var(--secondary));
    color: hsl(var(--foreground));
}

.menu-btn {
    display: none !important;
}

.page {
    padding-top: 2rem;
    padding-bottom: 1rem;
}

.hero {
    position: relative;
}

.banner {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 0.85rem;
    aspect-ratio: 16 / 9;
    border: 1px solid hsl(var(--border));
    background: linear-gradient(145deg, #d9ecdd, #d8e7f9);
}

[data-theme="dark"] .banner {
    background: linear-gradient(145deg, #253039, #2f3340);
}

.banner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(11, 11, 11, 0.54), rgba(11, 11, 11, 0.1));
}

.banner figcaption {
    position: absolute;
    z-index: 3;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: rgba(255, 255, 255, 0.93);
    text-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    white-space: nowrap;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: clamp(0.88rem, 2.2vw, 1.2rem);
}

.fallback-note {
    position: absolute;
    z-index: 3;
    right: 0.7rem;
    bottom: 0.7rem;
    font-size: 0.64rem;
    color: rgba(255, 255, 255, 0.88);
    display: none;
}

.image-shell.is-missing .fallback-note {
    display: block;
}

.avatar-wrap {
    margin-top: -2.8rem;
    position: relative;
    z-index: 5;
    padding-left: 0.2rem;
}

.avatar {
    width: 5rem;
    height: 5rem;
    border-radius: 999px;
    overflow: hidden;
    border: 4px solid hsl(var(--background));
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
    background: linear-gradient(145deg, #bcd1de, #d2deca);
    position: relative;
}

[data-theme="dark"] .avatar {
    background: linear-gradient(145deg, #435266, #55604f);
}

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

.fallback-initials {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #223341;
    font-weight: 600;
    letter-spacing: 0.06em;
    font-size: 1.36rem;
}

.image-shell:not(.is-missing) .fallback-initials {
    display: none;
}

.intro {
    margin-top: 0.78rem;
}

.intro h1 {
    font-family: 'Instrument Serif', 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 6vw, 4rem);
    line-height: 0.95;
    letter-spacing: -0.015em;
    font-weight: 400;
}

.subtitle {
    margin-top: 0.3rem;
    font-size: 0.92rem;
    color: hsl(var(--muted));
}

.social-pills {
    margin-top: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.social-pills a {
    min-height: 2rem;
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    color: hsl(var(--muted));
    display: inline-flex;
    align-items: center;
    padding: 0 0.78rem;
    font-size: 0.78rem;
    transition: all 160ms ease;
}

.social-pills a:hover {
    color: hsl(var(--foreground));
    background: hsl(var(--secondary));
}

.lead {
    margin-top: 0.1rem;
    max-width: 44rem;
    font-size: 0.95rem;
    color: hsl(var(--foreground));
}

.about-section {
    margin-top: 0.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.about-lead {
    font-size: 0.98rem;
    color: hsl(var(--foreground));
    max-width: 48rem;
}

.page-top {
    padding-top: 1.2rem;
}

.page-title {
    font-family: 'Instrument Serif', 'Playfair Display', Georgia, serif;
    font-size: clamp(2rem, 5vw, 3.3rem);
    line-height: 0.98;
    font-weight: 400;
    letter-spacing: -0.015em;
}

.page-subtitle {
    margin-top: 0.45rem;
    color: hsl(var(--muted));
    font-size: 0.95rem;
    max-width: 42rem;
}

.about-copy {
    margin-top: 0.8rem;
    color: hsl(var(--foreground) / 0.94);
    font-size: 0.95rem;
    max-width: 46rem;
}

.about-grid {
    margin-top: 1rem;
    display: grid;
    gap: 0.8rem;
}

.about-grid article {
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    padding: 0.9rem;
}

.about-grid h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.about-grid p {
    margin-top: 0.45rem;
    color: hsl(var(--muted));
    font-size: 0.9rem;
}

.section {
    padding-top: 0.5rem;
    scroll-margin-top: 5.6rem;
}

.section h2 {
    font-size: 1rem;
    font-weight: 500;
    color: hsl(var(--muted));
}

.section h2 span {
    color: hsl(var(--foreground));
}

.section p {
    margin-top: 0.48rem;
}

.muted {
    color: hsl(var(--muted));
    font-size: 0.94rem;
}

.stack-marquee {
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    padding: 1rem 0;
}

.stack-marquee .edge {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 5rem;
    z-index: 5;
    pointer-events: none;
}

.stack-marquee .edge.left {
    left: 0;
    background: linear-gradient(to right, hsl(var(--background)), transparent);
}

.stack-marquee .edge.right {
    right: 0;
    background: linear-gradient(to left, hsl(var(--background)), transparent);
}

.track {
    display: flex;
    gap: 1.4rem;
    width: max-content;
    padding: 0 1.5rem;
    animation: scroll 30s linear infinite;
}

.stack-item {
    width: 4.3rem;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.42rem;
}

.stack-item i {
    width: 3.6rem;
    height: 3.6rem;
    border-radius: 0.75rem;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--background) / 0.6);
    display: grid;
    place-items: center;
    font-size: 1.65rem;
}

[data-theme="dark"] .stack-item .devicon-nextjs-original.colored,
[data-theme="dark"] .stack-item .devicon-express-original.colored,
[data-theme="dark"] .stack-item .devicon-prisma-original.colored,
[data-theme="dark"] .stack-item .devicon-github-original.colored {
    color: #f4f4f5;
}

[data-theme="dark"] .stack-item i {
    background: hsl(var(--background) / 0.35);
}

.stack-item span {
    font-size: 0.72rem;
    color: hsl(var(--foreground));
    white-space: nowrap;
}

@keyframes scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

.heatmap-card {
    margin-top: 0.95rem;
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    padding: 0.9rem;
    overflow-x: auto;
}

.months {
    margin-left: 2.2rem;
    min-width: max-content;
    height: 14px;
    position: relative;
    font-size: 0.64rem;
    color: hsl(var(--muted));
}

.months span {
    position: absolute;
    top: 0;
}

.map-row {
    margin-top: 0.2rem;
    display: flex;
    width: max-content;
    gap: 0.34rem;
}

.days-label {
    width: 1.9rem;
    display: grid;
    grid-template-rows: repeat(7, 11px);
    gap: 3px;
    font-size: 0.62rem;
    color: hsl(var(--muted));
}

.days-label span {
    display: grid;
    align-items: center;
}

.grid {
    display: grid;
    grid-template-columns: repeat(53, 11px);
    grid-template-rows: repeat(7, 11px);
    grid-auto-flow: column;
    gap: 3px;
}

.cell {
    border-radius: 2px;
    width: 11px;
    height: 11px;
    background: hsl(var(--gh0));
}

.cell.lv1 {
    background: hsl(var(--gh1));
}

.cell.lv2 {
    background: hsl(var(--gh2));
}

.cell.lv3 {
    background: hsl(var(--gh3));
}

.cell.lv4 {
    background: hsl(var(--gh4));
}

.map-footer {
    margin-top: 0.8rem;
    padding-top: 0.72rem;
    border-top: 1px solid hsl(var(--border));
    min-width: max-content;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    font-size: 0.65rem;
    color: hsl(var(--muted));
}

[data-theme="dark"] .fallback-initials {
    color: #dce5f0;
}

.legend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.legend .cells {
    display: flex;
    gap: 2px;
}

.legend i {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    display: inline-block;
}

.legend .lv0 {
    background: hsl(var(--gh0));
}

.legend .lv1 {
    background: hsl(var(--gh1));
}

.legend .lv2 {
    background: hsl(var(--gh2));
}

.legend .lv3 {
    background: hsl(var(--gh3));
}

.legend .lv4 {
    background: hsl(var(--gh4));
}

.work-list {
    margin-top: 1rem;
    display: grid;
    gap: 1rem;
}

.work-list article a {
    display: block;
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    padding: 1rem;
    transition: border-color 160ms ease, transform 160ms ease;
}

.work-list article a:hover {
    border-color: hsl(var(--muted) / 0.4);
    transform: translateY(-2px);
}

.work-list .head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 0.6rem;
}

.work-list h3 {
    font-size: 1rem;
    font-weight: 500;
}

.work-list .head span {
    color: hsl(var(--muted));
    font-size: 1rem;
    opacity: 0;
    transition: opacity 160ms ease;
}

.work-list article a:hover .head span {
    opacity: 1;
}

.work-list p {
    margin-top: 0.45rem;
    font-size: 0.9rem;
    color: hsl(var(--muted));
}

.work-list ul {
    list-style: none;
    margin-top: 0.65rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
}

.work-list li {
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--secondary));
    color: hsl(var(--muted));
    padding: 0.2rem 0.55rem;
    font-size: 0.7rem;
}

.quote-card {
    margin-top: 1rem;
    border: 1px dashed hsl(var(--border));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    color: hsl(var(--foreground) / 0.86);
    padding: 1.1rem;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-size: 1.06rem;
}

.blog-list {
    margin-top: 1rem;
    display: grid;
    gap: 0.8rem;
}

.blog-card {
    border: 1px solid hsl(var(--border));
    border-radius: 0.75rem;
    background: hsl(var(--card));
    padding: 0.95rem;
}

.blog-card h3 {
    font-size: 0.96rem;
    font-weight: 600;
}

.blog-card p {
    margin-top: 0.42rem;
    color: hsl(var(--muted));
    font-size: 0.89rem;
}

.blog-card span {
    display: inline-flex;
    margin-top: 0.6rem;
    border-radius: 999px;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--secondary));
    color: hsl(var(--muted));
    font-size: 0.68rem;
    padding: 0.2rem 0.48rem;
}

.cta {
    text-align: center;
}

.cta p {
    color: hsl(var(--muted));
    font-size: 0.95rem;
}

.call-btn {
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 999px;
    background: hsl(var(--foreground));
    color: hsl(var(--background));
    min-height: 2.7rem;
    padding: 0 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    transition: opacity 160ms ease;
}

.call-btn:hover {
    opacity: 0.9;
}

.mini {
    width: 1.3rem;
    height: 1.3rem;
    border-radius: 999px;
    overflow: hidden;
    background: hsl(var(--muted));
    position: relative;
}

.mini img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mini .fallback-initials {
    color: #fff;
    font-size: 0.58rem;
}

.footer {
    border-top: 1px solid hsl(var(--border) / 0.6);
    padding: 2rem 0;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    align-items: center;
}

.footer-inner p {
    font-size: 0.88rem;
    color: hsl(var(--foreground));
}

.footer-inner small {
    color: hsl(var(--muted));
    font-size: 0.82rem;
}

.footer-links {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    min-width: 2.5rem;
    min-height: 2.5rem;
    border-radius: 999px;
    background: hsl(var(--secondary));
    color: hsl(var(--muted));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    padding: 0 0.7rem;
}

.footer-links a:hover {
    color: hsl(var(--foreground));
}

.copyright {
    color: hsl(var(--muted));
    font-size: 0.8rem;
}

.reveal {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 480ms ease, transform 480ms ease;
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (min-width: 640px) {
    .banner {
        aspect-ratio: 21 / 9;
    }

    .avatar-wrap {
        margin-top: -3.4rem;
    }

    .avatar {
        width: 6rem;
        height: 6rem;
    }

    .footer-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }

    .about-grid,
    .blog-list {
        grid-template-columns: 1fr 1fr;
    }

    .blog-list .blog-card:last-child {
        grid-column: 1 / -1;
    }

    .copyright {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1024px) {
    .avatar {
        width: 7rem;
        height: 7rem;
    }
}

@media (max-width: 760px) {
    .nav-links {
        gap: 0.72rem;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }

    .nav-links a {
        font-size: 0.76rem;
    }
}

@media (max-width: 520px) {
    .container-narrow {
        padding: 0 1rem;
    }

    .brand {
        font-size: 0.94rem;
    }

    .nav-links {
        gap: 0.58rem;
    }

    .nav-links a {
        font-size: 0.74rem;
    }

    .stack-item {
        width: 4rem;
    }

    .stack-item i {
        width: 3.2rem;
        height: 3.2rem;
        font-size: 1.5rem;
    }
}

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

    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
