/* 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;
    }
}
/* ---- Results ---- */

.results .section-lede {
    display: grid;
    justify-items: start;
    gap: 14px;
}

.results-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
}

.results-sep {
    color: var(--fg-dim);
}

.results-date {
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.board {
    border-top: 1px solid var(--rule-2);
}

.board-stage {
    position: relative;
}

.board-stage::after {
    position: absolute;
    inset: 0 0 1px auto;
    z-index: 3;
    width: 64px;
    background: linear-gradient(90deg, transparent, var(--bg));
    content: "";
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.board.has-after .board-stage::after {
    opacity: 1;
}

.board-scroll {
    /* Positioned, so visually hidden labels inside the wide table scroll with it
       instead of widening the page. */
    position: relative;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    scrollbar-color: var(--rule-2) transparent;
}

html.js .board-scroll {
    scrollbar-width: none;
}

html.js .board-scroll::-webkit-scrollbar {
    display: none;
}

.board-table {
    --board-cell-px: 18px;
    width: max-content;
    min-width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    font-variant-numeric: tabular-nums;
}

.board-table th,
.board-table td {
    padding: 14px var(--board-cell-px);
    border-bottom: 1px solid var(--rule);
    text-align: right;
    white-space: nowrap;
}

.board-table thead th {
    padding-block: 14px;
    color: var(--fg-3);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.3;
    vertical-align: bottom;
    white-space: nowrap;
}

.board-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    padding-left: 0;
    padding-right: 22px;
    background-color: var(--bg);
    text-align: left;
    transition: box-shadow 0.2s ease;
}

.board.has-before .board-table th:first-child {
    box-shadow: 1px 0 0 var(--rule), 12px 0 18px -12px rgba(0, 0, 0, 0.16);
}

.board-table tbody th {
    font-size: 0.9375rem;
    font-weight: 400;
}

.board-table td {
    color: var(--fg-2);
}

/* Mark only the score digits so adjacent best cells never join into one line. */
.board-table td.is-best {
    color: var(--fg);
    font-weight: 600;
    background-image: linear-gradient(var(--red), var(--red));
    background-repeat: no-repeat;
    background-size: 38px 2px;
    background-position: right var(--board-cell-px) bottom 0;
}

.board-table .is-evo th,
.board-table .is-evo td {
    background-color: color-mix(in srgb, var(--red) 6%, var(--bg));
    color: var(--fg);
}

.board-table .is-evo th:first-child {
    box-shadow: inset 2px 0 0 var(--red);
    padding-left: 12px;
}

.board.has-before .board-table .is-evo th:first-child {
    box-shadow: inset 2px 0 0 var(--red), 1px 0 0 var(--rule), 12px 0 18px -12px rgba(0, 0, 0, 0.16);
}

.board-table .is-evo th {
    font-weight: 600;
}

.rank {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin-right: 12px;
    border: 1px solid var(--rule-2);
    border-radius: 50%;
    color: var(--fg-2);
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    vertical-align: 1px;
}

.rank--none {
    border-color: transparent;
}

.is-evo .rank {
    border-color: var(--red);
    background: var(--red);
    color: #FFFFFF;
}

.board-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px 20px;
    margin-top: 16px;
}

.board-note {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--fg-3);
    font-size: 0.8125rem;
}

.board-key {
    width: 22px;
    height: 2px;
    flex: 0 0 auto;
    background: var(--red);
}

.board-controls {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-left: auto;
}

.board-controls[hidden] {
    display: none;
}

.board-progress {
    position: relative;
    width: 88px;
    height: 18px;
    display: flex;
    align-items: center;
    cursor: pointer;
}

.board-progress::before {
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--rule-2);
    content: "";
}

.board-progress-thumb {
    position: absolute;
    left: 0;
    top: 50%;
    width: var(--board-thumb-w, 32px);
    height: 2px;
    margin-top: -1px;
    border-radius: 999px;
    background: var(--fg-2);
    transform: translateX(var(--board-thumb-x, 0px));
    transition: background-color 0.2s ease;
}

.board-progress:hover .board-progress-thumb {
    background: var(--fg);
}

.board-nav {
    display: flex;
    gap: 8px;
}

.board-nav .round-button {
    width: 36px;
    height: 36px;
}

@media (max-width: 640px) {
    .board-table {
        --board-cell-px: 14px;
    }

    .board-table th:first-child {
        padding-right: 16px;
    }

    .board-stage::after {
        width: 40px;
    }

    .board-progress {
        width: 64px;
    }
}

/* ---- Research ---- */

.work {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: center;
    gap: clamp(28px, 6vw, 96px);
    padding-block: clamp(28px, 4vw, 48px);
    border-block: 1px solid var(--rule-2);
    color: inherit;
    text-decoration: none;
}

.work-figure {
    overflow: hidden;
    border-radius: var(--radius-m);
    background: var(--surface);
}

.work-figure img {
    width: 100%;
    height: auto;
    transition: scale 0.9s var(--ease-out);
}

.work:hover .work-figure img {
    scale: 1.03;
}

.work-body {
    display: grid;
    justify-items: start;
    gap: 16px;
}

.work-date {
    color: var(--fg-3);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

/* The name is the title; what the work does is set under it, in phrases. */
.work-title {
    display: grid;
    gap: 10px;
    font-weight: 400;
}

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

.work-sub {
    color: var(--fg-2);
    font-size: clamp(1.1rem, 0.96rem + 0.6vw, 1.4rem);
    line-height: 1.25;
    letter-spacing: -0.015em;
}

.work-body p {
    max-width: 76ch;
    color: var(--fg-2);
}

.work-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    padding-bottom: 3px;
    border-bottom: 1px solid var(--rule-2);
    font-size: 0.9375rem;
    transition: border-color 0.2s ease;
}

.work-cta .icon {
    transition: translate 0.3s var(--ease-out);
}

.work:hover .work-cta {
    border-color: var(--red);
}

.work:hover .work-cta .icon {
    translate: 2px -2px;
}

@media (max-width: 860px) {
    .work {
        grid-template-columns: minmax(0, 1fr);
    }
}
/* ---- 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;
    }
}
