/* The rest of the page uses the complete variable font. */
@font-face {
    font-family: "Mona Sans";
    src: url("../fonts/mona-sans/MonaSans-Variable-latin.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}
/* ---- Shared Subpage Header & Cross-Navigation ---- */

.subpage-hero {
    padding-top: calc(var(--nav-h) + clamp(40px, 6vw, 84px));
    padding-bottom: clamp(40px, 5vw, 68px);
}

.subpage-crumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: clamp(20px, 3vw, 32px);
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-decoration: none;
    transition: color 0.2s ease;
}

.subpage-crumb:hover {
    color: var(--fg);
}

.subpage-crumb .icon {
    transition: translate 0.25s var(--ease-out);
}

.subpage-crumb:hover .icon {
    translate: -3px 0;
}

.subpage-head {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    align-items: end;
    gap: 24px clamp(32px, 6vw, 84px);
}

.subpage-title {
    max-width: 19ch;
    font-size: clamp(2.4rem, 1.2rem + 3.6vw, 4.25rem);
    font-weight: 300;
    line-height: 1.03;
    letter-spacing: -0.04em;
}

.subpage-jumps {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.subpage-jump {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    color: var(--fg-2);
    font-size: 0.8125rem;
    line-height: 1.25;
    text-decoration: none;
    transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

.subpage-jump:hover {
    border-color: var(--rule-2);
    background: color-mix(in srgb, var(--fg) 5%, transparent);
    color: var(--fg);
}

.subpage-hero + .band {
    padding-top: clamp(44px, 6vw, 88px);
}

.subpage-hero--flush {
    padding-bottom: clamp(28px, 4vw, 48px);
}

.subpage-hero--flush + .demos {
    padding-top: 0;
}

@media (max-width: 860px) {
    .subpage-head {
        grid-template-columns: minmax(0, 1fr);
        align-items: start;
    }

    .subpage-jumps {
        justify-content: flex-start;
    }
}
.demos .section-head {
    margin-bottom: clamp(56px, 8vw, 112px);
}

.demo-row,
.demo-block {
    margin-top: clamp(88px, 12vw, 168px);
}

.demos .section-head + .demo-block {
    margin-top: 0;
}

.demo-row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: clamp(32px, 6vw, 96px);
}

.demo-row--flip {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.demo-row--flip .demo-copy {
    order: 2;
}

.demo-copy {
    display: grid;
    justify-items: start;
    gap: 20px;
}

.demo-title {
    font-size: clamp(1.9rem, 1.2rem + 2.3vw, 3.1rem);
    font-weight: 300;
    line-height: 1.04;
    letter-spacing: -0.035em;
}

.demo-copy p,
.demo-block-head p {
    max-width: 72ch;
    color: var(--fg-2);
}

.demo-block-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: clamp(24px, 3.4vw, 40px);
}

.demo-block-head > div:first-child {
    display: grid;
    gap: 16px;
}

/* ---- Pipeline: pose + frame -> video ---- */

/* The two inputs and the output are one line across the page: the output is
   the largest, because it is what the line is for. */
.pipe {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto minmax(0, 1.62fr);
    align-items: center;
    gap: clamp(10px, 2.2vw, 32px);
}

.pipe[hidden] {
    display: none;
}

.pipe-cell {
    display: grid;
    gap: 10px;
}

.pipe-cell {
    gap: 12px;
}

.pipe-cell .clip {
    border-radius: var(--radius-m);
}

.pipe-cell--out .clip {
    border-radius: var(--radius-l);
}

.pipe-cell figcaption {
    color: var(--fg-3);
    font-size: 0.875rem;
    line-height: 1.3;
}

.pipe-cell--out figcaption {
    color: var(--fg);
}

.pipe-op {
    padding-bottom: 1.9rem;
    color: var(--fg-dim);
    font-size: clamp(1.4rem, 1rem + 1.6vw, 2.6rem);
    font-weight: 200;
    line-height: 1;
}

.pipe-op--out {
    color: var(--red);
}

/* ---- Carousel: one clip in focus, its neighbours waiting ---- */

.carousel-nav {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.carousel-track {
    --slide-w: min(820px, 76vw);
    position: relative;
    display: flex;
    gap: clamp(12px, 2vw, 28px);
    margin-inline: calc(50% - 50vw);
    padding-inline: calc(50vw - var(--slide-w) / 2);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.carousel-track::-webkit-scrollbar {
    display: none;
}

.slide {
    display: grid;
    flex: 0 0 var(--slide-w);
    gap: 14px;
    scroll-snap-align: center;
    opacity: 0.32;
    transition: opacity 0.5s ease;
}

.slide.is-active {
    opacity: 1;
}

.slide .clip {
    border-radius: var(--radius-l);
    cursor: pointer;
}

.slide.is-active .clip {
    cursor: default;
}

.slide figcaption {
    display: flex;
    align-items: baseline;
    gap: 12px;
    font-size: clamp(1.1rem, 1rem + 0.5vw, 1.4rem);
    letter-spacing: -0.02em;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.slide figcaption .mono {
    color: var(--fg-3);
    font-size: 0.75rem;
}

.slide.is-active figcaption {
    opacity: 1;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.carousel-dot {
    position: relative;
    width: 30px;
    height: 24px;
}

.carousel-dot::before {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    margin-top: -1px;
    border-radius: 2px;
    background: var(--fg);
    content: "";
    opacity: 0.2;
    transition: opacity 0.2s ease, background-color 0.2s ease;
}

.carousel-dot:hover::before {
    opacity: 0.45;
}

.carousel-dot.is-active::before {
    background: var(--red);
    opacity: 1;
}

/* ---- Roaming: one player, many worlds ----

   The worlds of a set sit in one row behind a window of fixed size: a few
   whole frames and the edge of the next. The window slides, a click plays.
   The row is as tall with five worlds as with fifty, and it does not say how
   many there are. */

.demo-copy:has(.roam-strip) {
    grid-template-columns: minmax(0, 1fr);
}

.roam-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.roam-nav {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
}

.roam-nav[hidden] {
    display: none;
}

.roam-nav .round-button {
    width: 40px;
    height: 40px;
}

.roam-strip {
    /* Three whole frames and a part of the fourth. */
    --roam-w: 27%;
    width: 100%;
    min-width: 0;
}

/* The row keeps a little room around itself for the ring of the chosen world. */
.roam-list {
    --fade: 0px;
    position: relative;
    display: flex;
    gap: 10px;
    margin: -5px;
    padding: 5px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding-inline: 5px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - var(--fade)), transparent);
    mask-image: linear-gradient(90deg, #000 calc(100% - var(--fade)), transparent);
}

.roam-list::-webkit-scrollbar {
    display: none;
}

.roam-list[hidden] {
    display: none;
}

/* While the row runs on, its last frame fades out instead of being cut. */
.roam-list.has-after {
    --fade: 56px;
}

.roam-item {
    display: grid;
    flex: 0 0 var(--roam-w);
    align-content: start;
    gap: 6px;
    min-width: 0;
    color: var(--fg-3);
    font-size: 0.75rem;
    line-height: 1.25;
    text-align: left;
    scroll-snap-align: start;
    transition: color 0.2s ease;
}

.roam-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 640 / 352;
    border-radius: 8px;
    object-fit: cover;
    opacity: 0.72;
    transition: opacity 0.2s ease, box-shadow 0.2s ease;
}

.roam-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.roam-item:hover {
    color: var(--fg);
}

.roam-item:hover img {
    opacity: 1;
}

.roam-item.is-active {
    color: var(--fg);
}

.roam-item.is-active img {
    box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--red);
    opacity: 1;
}

.roam-stage {
    display: grid;
    gap: 14px;
}

.roam-stage .clip {
    border-radius: var(--radius-l);
}

.roam-stage figcaption {
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* ---- Retargeting ---- */

.retarget-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: clamp(10px, 1.4vw, 18px);
}

.retarget-cell {
    display: grid;
    gap: 10px;
}

.retarget-cell .clip {
    aspect-ratio: 16 / 9;
    border-radius: 12px;
}

.retarget-cell figcaption {
    font-size: 0.875rem;
    line-height: 1.3;
}

.retarget-cell figcaption a {
    text-decoration-color: var(--rule-2);
    text-underline-offset: 3px;
}

.retarget-cell--render {
    padding-left: clamp(10px, 1.4vw, 18px);
    border-left: 1px solid var(--rule);
}

.retarget-cell--render figcaption {
    color: var(--fg-2);
}

/* Where the text column is at its narrowest beside the player, the two path
   names drop their shared word so the buttons still fit on their row. The
   word stays in the accessible name. */
@media (min-width: 981px) and (max-width: 1200px) {
    .roam-word {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip-path: inset(50%);
        white-space: nowrap;
    }
}

@media (max-width: 980px) {
    .demo-row,
    .demo-row--flip {
        grid-template-columns: minmax(0, 1fr);
    }

    .demo-row--flip .demo-copy {
        order: 0;
    }

    .roam-strip {
        --roam-w: 21.5%;
    }

    .retarget-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .retarget-cell--render {
        grid-column: 1 / -1;
        padding: 16px 0 0;
        border-top: 1px solid var(--rule);
        border-left: 0;
    }

    .retarget-cell--render .clip {
        max-width: 420px;
    }
}

@media (max-width: 640px) {
    .pipe {
        grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
        row-gap: 4px;
    }

    .pipe-op--out {
        grid-column: 1 / -1;
        justify-self: center;
        padding: 6px 0;
        rotate: 90deg;
    }

    .pipe-cell--out {
        grid-column: 1 / -1;
    }

    .demo-block-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .carousel-track {
        --slide-w: 84vw;
    }

    .carousel-dot {
        width: 22px;
    }

    /* On a phone the row is swiped: two frames and a part of the third. */
    .roam-strip {
        --roam-w: 40%;
    }

    .roam-nav {
        display: none;
    }
}
/* ---- Team: a statement and four formal contact cards ---- */

.team-lede {
    font-size: clamp(1.3rem, 1rem + 1.1vw, 1.9rem);
    font-weight: 300;
    line-height: 1.22;
    letter-spacing: -0.025em;
}

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

.contact {
    display: grid;
    align-content: start;
    gap: 4px;
    padding: 20px;
    border: 1px solid var(--rule-2);
    border-radius: var(--radius-m);
    text-decoration: none;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

.contact-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 30px;
    margin-bottom: clamp(36px, 5vw, 64px);
}

/* Official marks, drawn in the text colour so the row reads as one set. */
.contact-icon {
    display: block;
    width: 26px;
    height: 26px;
    background: currentColor;
}

.contact-icon--email {
    background: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.contact-icon--x {
    width: 23px;
    height: 24px;
    -webkit-mask: url("../assets/brand/x.svg") center / contain no-repeat;
    mask: url("../assets/brand/x.svg") center / contain no-repeat;
}

.contact-icon--xiaohongshu {
    width: 54px;
    height: 24px;
    -webkit-mask: url("../assets/brand/xiaohongshu.svg") center / contain no-repeat;
    mask: url("../assets/brand/xiaohongshu.svg") center / contain no-repeat;
}

.contact-icon--wechat {
    width: 31px;
    height: 25px;
    -webkit-mask: url("../assets/brand/wechat.svg") center / contain no-repeat;
    mask: url("../assets/brand/wechat.svg") center / contain no-repeat;
}

.contact-arrow {
    color: var(--fg-3);
    transition: translate 0.3s var(--ease-out), color 0.2s ease;
}

.contact-name {
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: -0.01em;
}

.contact-value {
    overflow: hidden;
    color: var(--fg-2);
    font-size: 0.9375rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.contact:hover {
    border-color: var(--fg);
    background: color-mix(in srgb, var(--fg) 4%, transparent);
}

.contact:hover .contact-arrow {
    color: var(--red);
    translate: 2px -2px;
}

/* ---- Footer: one quiet line ---- */

.footer {
    padding-block: 28px 36px;
    border-top: 1px solid var(--rule);
}

.footer-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px 48px;
}

.footer-brand {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 24px;
}

.footer .logo {
    width: 104px;
    height: 31px;
}

.footer-note {
    color: var(--fg-3);
    font-size: 0.8125rem;
}

.footer-prefs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 28px;
    font-size: 0.8125rem;
}

.pref {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.pref-label {
    margin-right: 6px;
    color: var(--fg-3);
}

.pref-option {
    padding: 5px 11px;
    border-radius: 999px;
    color: var(--fg-2);
    transition: background-color 0.2s ease, color 0.2s ease;
}

.pref-option:hover {
    color: var(--fg);
}

.pref-option[aria-pressed="true"] {
    background: var(--fg);
    color: var(--bg);
}

.pref-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--fg-2);
    text-decoration: none;
    transition: color 0.2s ease;
}

.pref-link:hover {
    color: var(--fg);
}

.pref-link kbd {
    padding: 2px 6px;
    border: 1px solid var(--rule-2);
    border-radius: 5px;
    font-family: var(--font-mono);
    font-size: 0.6875rem;
}

@media (max-width: 980px) {
    .contacts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .contact {
        padding: 16px;
    }

    .contact-top {
        margin-bottom: 28px;
    }
}
