/*  Banghua Zhao — personal site
    No frameworks: ~1 stylesheet, system fonts, inline SVG icons.  */

/* ---------- Tokens ---------- */

:root {
    --bg:            #ffffff;
    --bg-alt:        #f6f7f9;
    --surface:       #ffffff;
    --surface-hover: #fbfcfd;
    --border:        #e3e6ea;
    --border-strong: #cfd4db;
    --text:          #16191d;
    --text-soft:     #454b54;
    /* 5.10:1 on --bg-alt, 5.47:1 on --surface. The previous #6b7280 cleared
       WCAG AA by 0.01 while carrying 12.5px dates — no useful headroom. */
    --muted:         #626a76;
    --accent:        #2b59c3;
    --accent-soft:   rgba(43, 89, 195, .10);
    --shadow-sm:     0 1px 2px rgba(16, 24, 40, .05);
    --shadow-md:     0 6px 20px -6px rgba(16, 24, 40, .16);
    --nav-bg:        rgba(255, 255, 255, .82);
    --skeleton-base:  #eceef2;
    --skeleton-sheen: rgba(255, 255, 255, .85);

    --radius:    12px;
    --radius-sm: 8px;
    --nav-h:     58px;
    --wrap:      1120px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
            Arial, "PingFang SC", "Microsoft YaHei", sans-serif;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) { color-scheme: dark; }
}

/* Dark palette — applied by OS preference or by the explicit toggle. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:            #0f1115;
        --bg-alt:        #14171d;
        --surface:       #171b22;
        --surface-hover: #1c212a;
        --border:        #272d38;
        --border-strong: #39414f;
        --text:          #e8eaee;
        --text-soft:     #c2c8d2;
        --muted:         #939cab;
        --accent:        #8ba7f0;
        --accent-soft:   rgba(139, 167, 240, .14);
        --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
        --shadow-md:     0 8px 24px -8px rgba(0, 0, 0, .6);
        --nav-bg:        rgba(15, 17, 21, .82);
        --skeleton-base:  #1b202a;
        --skeleton-sheen: rgba(255, 255, 255, .07);
    }
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg:            #0f1115;
    --bg-alt:        #14171d;
    --surface:       #171b22;
    --surface-hover: #1c212a;
    --border:        #272d38;
    --border-strong: #39414f;
    --text:          #e8eaee;
    --text-soft:     #c2c8d2;
    --muted:         #939cab;
    --accent:        #8ba7f0;
    --accent-soft:   rgba(139, 167, 240, .14);
    --shadow-sm:     0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md:     0 8px 24px -8px rgba(0, 0, 0, .6);
    --nav-bg:        rgba(15, 17, 21, .82);
    --skeleton-base:  #1b202a;
    --skeleton-sheen: rgba(255, 255, 255, .07);
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text-soft);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

h1, h2, h3 {
    margin: 0;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -.015em;
    font-weight: 650;
}

p { margin: 0; }

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover { text-decoration: underline; }

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

ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.icon {
    width: 1.125em;
    height: 1.125em;
    flex: none;
    fill: none;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    padding: .5rem .9rem;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

.wrap {
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: clamp(1.15rem, 4vw, 2rem);
}

/* ---------- Navigation ---------- */

.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--nav-bg);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color .2s ease, box-shadow .2s ease;
}
.nav.is-stuck {
    border-bottom-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.nav__inner {
    max-width: var(--wrap);
    margin-inline: auto;
    padding-inline: clamp(1.15rem, 4vw, 2rem);
    height: var(--nav-h);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav__brand {
    font-weight: 660;
    font-size: .975rem;
    letter-spacing: -.01em;
    color: var(--text);
    margin-right: auto;
}
.nav__brand:hover { text-decoration: none; color: var(--accent); }

.nav__links {
    display: flex;
    align-items: center;
    gap: .15rem;
}

.nav__links a {
    position: relative;
    padding: .45rem .7rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--muted);
    transition: color .15s ease, background-color .15s ease;
}
.nav__links a:hover {
    color: var(--text);
    background: var(--accent-soft);
    text-decoration: none;
}
.nav__links a[aria-current="true"] {
    color: var(--accent);
    font-weight: 600;
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: .25rem;
    margin-left: .35rem;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color .15s ease, background-color .15s ease;
}
.icon-btn:hover { color: var(--text); background: var(--accent-soft); }
.icon-btn:active { transform: scale(.92); }
.icon-btn .icon {
    width: 19px;
    height: 19px;
    grid-area: 1 / 1;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
#theme-toggle:hover .icon { transform: rotate(35deg); }

/* Only one glyph per toggle is visible at a time. */
.icon--moon, .icon--close { display: none; }
:root[data-theme="dark"] .icon--sun { display: none; }
:root[data-theme="dark"] .icon--moon { display: block; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon--sun { display: none; }
    :root:not([data-theme="light"]) .icon--moon { display: block; }
}

.nav__burger { display: none; }

@media (max-width: 800px) {
    .nav__burger { display: inline-grid; }

    .nav__links {
        position: absolute;
        top: var(--nav-h);
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: .4rem clamp(1.15rem, 4vw, 2rem) .8rem;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow-md);
        /* Collapsed by default; opened via .is-open. */
        display: none;
        opacity: 0;
        transform: translateY(-8px);
        transition:
            opacity .2s ease,
            transform .2s cubic-bezier(.2, .8, .3, 1),
            display .2s allow-discrete;
    }
    .nav__links.is-open {
        display: flex;
        opacity: 1;
        transform: none;
    }
    @starting-style {
        .nav__links.is-open { opacity: 0; transform: translateY(-8px); }
    }
    .nav__links a { padding: .65rem .7rem; font-size: .95rem; }

    .nav__burger[aria-expanded="true"] .icon--menu { display: none; }
    .nav__burger[aria-expanded="true"] .icon--close { display: block; }
}

/* ---------- Hero ---------- */

.hero {
    position: relative;
    display: grid;
    place-items: center;
    min-height: min(78vh, 620px);
    padding: clamp(3rem, 8vw, 5rem) clamp(1.15rem, 4vw, 2rem);
    background: #0b0d12 url("../img/hero.jpg") center / cover no-repeat;
    scroll-margin-top: var(--nav-h);
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 10, 14, .5), rgba(8, 10, 14, .72));
}

.hero__card {
    position: relative;
    width: 100%;
    max-width: 480px;
    padding: clamp(1.75rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.25rem);
    text-align: center;
    color: #fff;
    background: rgba(12, 15, 20, .42);
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 18px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .7);
}

.hero__pic {
    width: 112px;
    height: 112px;
    margin: 0 auto .95rem;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, .85);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
    cursor: pointer;
}

.hero__name {
    color: #fff;
    font-size: clamp(1.85rem, 5.5vw, 2.5rem);
    font-weight: 680;
    letter-spacing: -.025em;
}

.hero__role {
    margin-top: .5rem;
    font-size: 1rem;
    font-weight: 500;
    color: rgba(255, 255, 255, .92);
}

.hero__meta {
    margin-top: .2rem;
    font-size: .85rem;
    color: rgba(255, 255, 255, .68);
}

.hero__cta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .6rem;
    margin-top: 1.5rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    padding: .6rem 1.15rem;
    border-radius: 999px;
    font-size: .9rem;
    font-weight: 600;
    border: 1px solid transparent;
    transition: transform .15s ease, background-color .15s ease,
                border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }

.btn--primary { background: #fff; color: #12151a; }
.btn--primary:hover { background: #e9ecf2; }

.btn--ghost {
    color: #fff;
    border-color: rgba(255, 255, 255, .42);
}
.btn--ghost:hover {
    background: rgba(255, 255, 255, .12);
    border-color: rgba(255, 255, 255, .7);
}

/* Variants for use against the page background rather than the hero. */
.btn--solid {
    background: var(--accent);
    color: #fff;
}
.btn--solid:hover { filter: brightness(1.08); }

.btn--outline {
    color: var(--text);
    border-color: var(--border-strong);
}
.btn--outline:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.hero__social {
    display: flex;
    justify-content: center;
    gap: .35rem;
    margin-top: 1.35rem;
}
.hero__social a {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: rgba(255, 255, 255, .8);
    transition: color .15s ease, background-color .15s ease, transform .15s ease;
}
.hero__social a:hover {
    color: #fff;
    background: rgba(255, 255, 255, .14);
    transform: translateY(-2px);
}
.hero__social .icon { width: 20px; height: 20px; }

/* ---------- Sections ---------- */

.section {
    padding-block: clamp(3.5rem, 8vw, 5.5rem);
    scroll-margin-top: var(--nav-h);
}
.section--alt {
    background: var(--bg-alt);
    border-block: 1px solid var(--border);
}

.eyebrow {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--accent);
}

.section__title {
    margin-top: .45rem;
    margin-bottom: 2rem;
    font-size: clamp(1.5rem, 3.4vw, 2rem);
}

.lede {
    max-width: 68ch;
    font-size: 1.05rem;
    color: var(--text-soft);
    text-wrap: pretty;
}

/* ---------- About & skills ---------- */

.about {
    display: grid;
    gap: clamp(2rem, 5vw, 3.5rem);
}
@media (min-width: 860px) {
    .about { grid-template-columns: minmax(0, 1fr) minmax(0, .85fr); }
}

.about__bio p + p {
    margin-top: 1rem;
    font-size: .97rem;
    color: var(--text-soft);
    text-wrap: pretty;
}
.about__bio .lede { max-width: none; }

.skills__heading {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.skills {
    display: grid;
    gap: .85rem;
    margin: .9rem 0 0;
}

.skills__group dt {
    font-size: .72rem;
    font-weight: 650;
    color: var(--text);
}

.skills__group dd { margin: 0; }

.skills__group ul {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: .35rem;
}

.skills__group li {
    padding: .15rem .45rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: .72rem;
    line-height: 1.5;
    font-weight: 500;
    color: var(--text-soft);
    white-space: nowrap;
}

/* ---------- Card grid (experience & education) ---------- */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    /* Cards size to their own content, so expanding one disclosure does not
       leave its row-mates with a column of dead space. */
    align-items: start;
}

.card {
    display: flex;
    flex-direction: column;
    padding: 1.4rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.card__head {
    display: flex;
    align-items: flex-start;
    gap: .85rem;
    margin-bottom: .35rem;
}

/* A white tile keeps the ragged set of brand marks legible in both themes. */
.card__logo {
    display: grid;
    place-items: center;
    flex: none;
    width: 54px;
    height: 54px;
    padding: 7px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.card__logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.card__headText { min-width: 0; }

.card__title {
    font-size: 1.02rem;
    font-weight: 640;
    text-wrap: balance;
}

.card__role {
    margin-top: .2rem;
    font-size: .9rem;
    color: var(--text-soft);
}

.card__date {
    margin-top: .35rem;
    font-size: .78rem;
    font-weight: 500;
    letter-spacing: .01em;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

/* ---------- Detail popovers ---------- */

/* Details open in a floating panel rather than expanding inline, so opening
   one never reflows the cards below it. The panel is a top-layer [popover]:
   the browser handles light-dismiss, Escape, and one-at-a-time for us. */

.disclosure__btn {
    display: inline-flex;
    align-items: center;
    /* The card is a column flexbox, so opt out of the default stretch. */
    align-self: flex-start;
    gap: .3rem;
    margin-top: .9rem;
    padding: .3rem .6rem .3rem .7rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text-soft);
    cursor: pointer;
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.disclosure__btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.disclosure__btn.is-open {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.disclosure__btn .icon {
    width: 14px;
    height: 14px;
    transition: transform .25s cubic-bezier(.4, 0, .2, 1);
}
.disclosure__btn.is-open .icon { transform: rotate(180deg); }

.popover {
    /* JS positions the panel against its button; these reset the UA centring. */
    position: fixed;
    inset: auto;
    width: 340px;
    max-width: calc(100vw - 24px);
    margin: 0;
    padding: 0;
    overflow: visible;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text-soft);
    box-shadow: 0 16px 40px -12px rgba(16, 24, 40, .3), 0 4px 10px -4px rgba(16, 24, 40, .16);

    /* Hidden by default so browsers without [popover] support do not leak the
       content onto the page; JS re-shows it via .is-shown in that case. */
    display: none;

    --caret-x: 24px;
    --lift: -6px;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .popover {
        box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .7), 0 4px 10px -4px rgba(0, 0, 0, .5);
    }
}
:root[data-theme="dark"] .popover {
    box-shadow: 0 18px 44px -12px rgba(0, 0, 0, .7), 0 4px 10px -4px rgba(0, 0, 0, .5);
}

/* Flex column so the scrolling body absorbs whatever the header leaves,
   rather than the JS having to guess the header's height. */
.popover:popover-open,
.popover.is-shown {
    display: flex;
    flex-direction: column;
}

/* The caret ties the panel back to the button that opened it. */
.popover::before,
.popover::after {
    content: "";
    position: absolute;
    left: var(--caret-x);
    width: 11px;
    height: 11px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    transform: translateX(-50%) rotate(45deg);
}
.popover::before { top: -6.5px; border-width: 1px 0 0 1px; }
.popover::after  { display: none; }
.popover.is-flipped::before { display: none; }
.popover.is-flipped::after {
    display: block;
    bottom: -6.5px;
    border-width: 0 1px 1px 0;
}

.popover__head {
    flex: none;
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .8rem .5rem .7rem .95rem;
    border-bottom: 1px solid var(--border);
}
.popover__title {
    font-size: .9rem;
    font-weight: 650;
    color: var(--text);
    line-height: 1.3;
}
.popover__sub {
    margin-top: .1rem;
    font-size: .78rem;
    color: var(--muted);
}
.popover__headText { min-width: 0; }
.popover__close {
    flex: none;
    width: 28px;
    height: 28px;
    margin-left: auto;
}
.popover__close .icon { width: 15px; height: 15px; }

.popover__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: .9rem .95rem 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.popover ul {
    display: grid;
    gap: .5rem;
    font-size: .85rem;
    line-height: 1.55;
}
.popover li {
    position: relative;
    padding-left: 1rem;
    color: var(--text-soft);
}
.popover li::before {
    content: "";
    position: absolute;
    left: 0;
    top: .55em;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent);
    opacity: .65;
}

.disclosure__lead {
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--muted);
}
.disclosure__lead + ul { margin-top: .45rem; }
.popover__body > * + .disclosure__lead { margin-top: 1rem; }

.disclosure__note {
    font-size: .85rem;
    color: var(--text-soft);
}
.disclosure__note strong { color: var(--text); font-weight: 620; }

/* Entry/exit animation. `allow-discrete` lets display and the top layer
   animate too, so the panel fades out instead of vanishing. */
.popover {
    opacity: 0;
    transform: translateY(var(--lift)) scale(.97);
    transition:
        opacity .18s ease,
        transform .18s cubic-bezier(.2, .8, .3, 1),
        display .18s allow-discrete,
        overlay .18s allow-discrete;
}
.popover:popover-open,
.popover.is-shown {
    opacity: 1;
    transform: none;
}
@starting-style {
    .popover:popover-open,
    .popover.is-shown {
        opacity: 0;
        transform: translateY(var(--lift)) scale(.97);
    }
}
.popover.is-flipped { --lift: 6px; }

/* ---------- Projects ---------- */

.grid--projects { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.project {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: inherit;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.project:hover {
    text-decoration: none;
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Thumbnails are figures and app icons, so nothing is cropped: they are
   contained on a neutral plate instead. */
.project__media {
    aspect-ratio: 16 / 9;
    display: grid;
    /* Stretch, not center: the image fills the grid area so `contain` has a
       definite box to fit into. A percentage height would not resolve here. */
    place-items: stretch;
    overflow: hidden;
    padding: .85rem;
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
}
.project__media img {
    min-width: 0;
    min-height: 0;
    object-fit: contain;
    transition: transform .35s ease;
}
/* App icons carry their own artwork to the edge, so give them more air. The
   white plate matches the white background baked into the icon artwork. */
.project__media--contain {
    padding: 1.5rem;
    background: #fff;
}
.project:hover .project__media img { transform: scale(1.04); }

.project__body { padding: 1.1rem 1.25rem 1.35rem; }

.project__kicker {
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
}

.project__title {
    margin-top: .35rem;
    font-size: 1.02rem;
    font-weight: 640;
}
.project__title a {
    color: inherit;
    text-decoration: none;
}
/* Stretched link: the heading is the real link, but its overlay makes the
   whole card clickable. Anything that needs its own link sits above it. */
.project__link::after {
    content: "";
    position: absolute;
    inset: 0;
}
.project:focus-within { border-color: var(--border-strong); }

.project__desc {
    margin-top: .4rem;
    font-size: .875rem;
    color: var(--text-soft);
    text-wrap: pretty;
}

/* Secondary destinations, lifted above the stretched-link overlay. */
.project__links {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
    margin-top: .75rem;
    /* Only the chips themselves should intercept clicks; the gaps between
       them fall through to the card's stretched link. */
    pointer-events: none;
}
.project__links a { pointer-events: auto; }
.project__links a {
    display: inline-block;
    padding: .25rem .6rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-alt);
    font-size: .75rem;
    font-weight: 600;
    color: var(--text-soft);
    transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.project__links a:hover {
    text-decoration: none;
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

/* The flagship project earns a double-width cell where the grid allows it,
   laid out side-by-side so the icon keeps a sensible plate. */
@media (min-width: 700px) {
    .project--wide {
        grid-column: span 2;
        display: grid;
        grid-template-columns: minmax(180px, 250px) 1fr;
    }
    .project--wide .project__media {
        aspect-ratio: auto;
        min-height: 100%;
        padding: 1.75rem;
        border-bottom: 0;
        border-right: 1px solid var(--border);
    }
    .project--wide .project__body { padding: 1.35rem 1.5rem 1.5rem; }
}

.project__arrow {
    position: absolute;
    top: .8rem;
    right: .8rem;
    width: 30px;
    height: 30px;
    padding: 7px;
    border-radius: 50%;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity .18s ease, transform .18s ease;
}
.project:hover .project__arrow,
.project:focus-visible .project__arrow { opacity: 1; transform: translateY(0); }

/* ---------- Hobby chips ---------- */

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: 1.6rem;
}
.chips a {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .5rem .85rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: .85rem;
    color: var(--text);
    transition: border-color .15s ease, background-color .15s ease, transform .15s ease;
}
.chips a:hover {
    text-decoration: none;
    border-color: var(--accent);
    background: var(--accent-soft);
    transform: translateY(-1px);
}
.chips span { font-weight: 620; }
.chips em { font-style: normal; color: var(--muted); }
.chips .icon { width: 13px; height: 13px; color: var(--muted); }

/* ---------- Footer ---------- */

.footer {
    padding-block: 1.75rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.footer__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    font-size: .82rem;
    color: var(--muted);
}
.footer__social { display: flex; gap: .1rem; }
.footer__social a {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    transition: color .15s ease, background-color .15s ease;
}
.footer__social a:hover { color: var(--accent); background: var(--accent-soft); }
.footer__social .icon { width: 17px; height: 17px; }

/* ---------- 404 ---------- */

.body--centered {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

.notfound {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
    max-width: var(--wrap);
    margin-inline: auto;
    padding: clamp(3rem, 10vw, 6rem) clamp(1.15rem, 4vw, 2rem);
}

.notfound__code {
    font-size: clamp(3.5rem, 14vw, 6.5rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.05em;
    color: var(--accent);
    opacity: .18;
}

.notfound__title {
    margin-top: -.35em;
    font-size: clamp(1.6rem, 5vw, 2.4rem);
}

.notfound__text {
    max-width: 46ch;
    margin-top: .9rem;
    font-size: 1.03rem;
    color: var(--text-soft);
    text-wrap: pretty;
}

.notfound__cta {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    margin-top: 1.75rem;
}

.notfound__links { margin-top: 2.25rem; }

/* ---------- Image loading skeletons ---------- */

/* JS adds .skeleton to a media box whose image has not decoded yet and
   removes it on load, so with JS off the images simply appear as normal. */
.skeleton { position: relative; }

.skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    background:
        linear-gradient(90deg,
            transparent 0%,
            var(--skeleton-sheen) 50%,
            transparent 100%) 0 0 / 220% 100% no-repeat,
        var(--skeleton-base);
    animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
    from { background-position: 160% 0, 0 0; }
    to   { background-position: -160% 0, 0 0; }
}

.project__media img,
.card__logo img {
    opacity: 1;
    transition: opacity .35s ease;
}
/* Qualified so it outweighs the rule above, which is otherwise equally
   specific and would win on source order. */
.project__media.skeleton img,
.card__logo.skeleton img { opacity: 0; }

/* ---------- Scroll reveal ---------- */

.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition:
        opacity .55s cubic-bezier(.2, .7, .3, 1),
        transform .55s cubic-bezier(.2, .7, .3, 1);
    transition-delay: var(--d, 0ms);
}
.reveal.is-visible { opacity: 1; transform: none; }

/* Cards in a row arrive in sequence rather than all at once. The delay is
   capped so a long grid never feels like it is waiting on itself. */
.grid > .reveal:nth-child(3n + 2) { --d: 70ms; }
.grid > .reveal:nth-child(3n + 3) { --d: 140ms; }

/* The hero is above the fold, so it animates on load instead of on scroll. */
@keyframes rise {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: none; }
}
.hero__card > * {
    animation: rise .6s cubic-bezier(.2, .7, .3, 1) backwards;
}
.hero__pic    { animation-delay: .05s; }
.hero__name   { animation-delay: .12s; }
.hero__role   { animation-delay: .18s; }
.hero__meta   { animation-delay: .23s; }
.hero__cta    { animation-delay: .29s; }
.hero__social { animation-delay: .35s; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-delay: 0ms !important;
        transition-duration: .01ms !important;
        transition-delay: 0ms !important;
    }
    .reveal { opacity: 1; transform: none; }
    .project:hover .project__media img,
    .icon-btn:active,
    #theme-toggle:hover .icon { transform: none; }
    /* Keep the placeholder, drop the sweep. */
    .skeleton::after { animation: none; background: var(--skeleton-base); }
}

/* ---------- Print ---------- */

@media print {
    .nav, .skip-link, .hero, .footer__social, .project__arrow { display: none !important; }
    .reveal { opacity: 1; transform: none; }
    .section, .section--alt { background: #fff; padding-block: 1.25rem; border: 0; }
    .card, .project { break-inside: avoid; box-shadow: none; }
}
