:root {
    --navy: #13294b;
    --navy-soft: #2b4570;
    --ink: #2b2f36;
    --muted: #5b6472;
    --orange: #ff5f05;
    --orange-deep: #d94e00;
    --paper: #fbfaf7;
    --card: #ffffff;
    --line: #e7e4dd;
    --card-shadow: 0 1px 2px rgba(19, 41, 75, 0.05), 0 6px 20px rgba(19, 41, 75, 0.06);
}

* {
    box-sizing: border-box;
}

img, video {
    max-width: 100%;
}

body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--paper);
    color: var(--ink);
    /* stop iOS Safari inflating body text in landscape */
    -webkit-text-size-adjust: 100%;
    overflow-wrap: break-word;
}

.topband {
    height: 6px;
    width: 100%;
    background: linear-gradient(90deg, var(--navy) 0%, var(--navy-soft) 45%, var(--orange) 100%);
}

.container {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 2rem;
}

header {
    text-align: center;
    padding: 3rem 1rem 1rem 1rem;
}

header h1 {
    font-size: 2.4rem;
    line-height: 1.25;
    font-weight: 900;
    margin: 0 auto 1.5rem auto;
    max-width: 820px;
    color: var(--navy);
}

.authors {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.3rem;
    font-size: 1.15rem;
    text-align: center;
    color: var(--ink);
}

.authors a {
    font-weight: 500;
    color: var(--orange-deep);
    text-decoration: none;
}

.authors a:hover {
    text-decoration: underline;
}

.institutions {
    text-align: center;
    font-size: 0.95rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
}

.document-links {
    text-align: center;
    margin: 1rem 0;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    gap: 0.5rem;
    margin: 0.3rem 0.3rem;
    padding: 0.55rem 1.2rem;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.95rem;
    text-decoration: none;
    border: 2px solid var(--navy);
    color: var(--navy);
    background-color: var(--card);
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.icon-button:hover {
    background-color: var(--navy);
    color: white;
    transform: translateY(-1px);
}

main {
    padding: 0.5rem 0 1rem 0;
}

.sec {
    font-size: 1.02rem;
    color: var(--ink);
    line-height: 1.7;
    margin: 2.5rem 0;
}

.sec h2 {
    font-size: 1.6rem;
    font-weight: 700;
    margin: 0 0 1rem 0;
    color: var(--navy);
}

.sec p {
    margin: 0 0 1rem 0;
}

.sec .subhead {
    font-weight: 500;
    color: var(--navy-soft);
    margin: 1.75rem 0 1rem 0;
}

.media {
    margin: 1.5rem 0;
}

.media.teaser {
    margin: 0 0 1rem 0;
}

.media img, .media video {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    border-radius: 10px;
}

.media .caption {
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted);
    max-width: 760px;
    margin: 0.9rem auto 0 auto;
    line-height: 1.5;
}

/* framework steps */
.steps {
    list-style: none;
    counter-reset: step;
    margin: 1.5rem 0 0 0;
    padding: 0.3rem 0.3rem 1rem 0.3rem;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
}

.steps li {
    counter-increment: step;
    position: relative;
    flex: 0 0 auto;
    width: 280px;
    scroll-snap-align: start;
    padding: 1rem 1.1rem 1.1rem 3.2rem;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
}

.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0.9rem;
    top: 1rem;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 50%;
    background: var(--orange);
    color: white;
    font-weight: 700;
    font-family: 'Roboto Mono', monospace;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.step-title {
    display: block;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: 0.2rem;
}

.scroll-hint {
    display: none;
    text-align: center;
    font-size: 0.78rem;
    color: var(--muted);
    margin: 0.6rem 0 0 0;
}

.steps::-webkit-scrollbar {
    height: 6px;
}

.steps::-webkit-scrollbar-thumb {
    background: var(--line);
    border-radius: 10px;
}

.steps::-webkit-scrollbar-thumb:hover {
    background: var(--orange);
}

/* dense multi-panel figures: unchanged on desktop, pannable on phones */
.figscroll {
    max-width: 100%;
}

/* virtual platform: text + image side by side */
.vp-flex {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 1rem;
}

.vp-text {
    flex: 1 1 55%;
    margin: 0;
}

.vp-image {
    flex: 1 1 38%;
    max-width: 340px;
    height: auto;
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

/* eight-gesture grid */
.gesture-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.2rem;
}

.gesture-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 0.6rem;
    text-align: center;
}

.gesture-pair {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.gesture-name {
    display: block;
    margin-top: 0.55rem;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--navy);
    text-transform: capitalize;
}

/* pipeline hero */
.pipeline-hero {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
}

.pipeline-card {
    flex: 1 1 320px;
    max-width: 380px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--card-shadow);
    padding: 0.7rem;
    text-align: center;
}

.pipeline-tag {
    display: block;
    margin-top: 0.6rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--navy-soft);
}

.pipeline-arrow {
    font-size: 1.8rem;
    color: var(--orange);
    font-weight: 700;
    flex: 0 0 auto;
}

/* resolution grid */
.res-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1.2rem 0 2rem 0;
}

.res-card {
    background: var(--navy);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 0.8rem;
    text-align: center;
}

.res-card .vid-box {
    background: #ffffff;
}

.res-card .pipeline-tag {
    color: #cfe0ff;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
}

/* shared video thumbnail box: fixed aspect ratio + object-fit avoids letterbox gaps */
.vid-box {
    width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #ffffff;
    border: 1px solid var(--line);
}

.vid-box video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.vid-box.hand {
    aspect-ratio: 8 / 5;
}

.vid-box.contact {
    aspect-ratio: 5 / 2;
}

.vid-box.res {
    aspect-ratio: 1 / 1;
    border: none;
}

.vid-box.vr {
    aspect-ratio: 938 / 740;
}

.vid-box.vr video {
    object-fit: cover;
}

.dataset-sec {
    text-align: center;
    background: linear-gradient(135deg, rgba(19,41,75,0.04), rgba(255,95,5,0.05));
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 2rem 1.5rem;
}

.dataset-sec h2 {
    text-align: center;
}

.bibtex {
    margin: 1rem auto;
    padding: 1.5rem;
    background-color: #f6f4ee;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-family: 'Roboto Mono', monospace;
    font-size: 0.85rem;
    color: #212529;
    text-align: left;
    max-width: 900px;
}

.bibtex pre {
    white-space: pre-wrap;
    overflow-x: auto;
    margin: 0;
    padding: 0.2rem;
}

hr {
    margin: 0 auto;
    border: 0;
    border-top: 1px solid var(--line);
    max-width: 900px;
}

footer {
    text-align: center;
    margin: 3rem 0 2.5rem 0;
    color: var(--muted);
}

footer img {
    width: 180px;
    opacity: 0.9;
}

@media (max-width: 768px) {
    .container {
        padding: 0 1.1rem;
    }

    header {
        padding: 2rem 0.5rem 1rem 0.5rem;
    }

    header h1 {
        font-size: 1.6rem;
    }

    .authors {
        font-size: 1rem;
    }

    .sec, .media {
        font-size: 0.95rem;
    }

    .sec h2 {
        font-size: 1.35rem;
    }

    /* Squeezing a four-panel figure into 350px makes it unreadable; render it
       at a legible width inside its own scroller and let the reader pan. */
    .figscroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-x: contain;
        padding-bottom: 0.35rem;
    }

    .figscroll > img {
        width: var(--fig-min);
        max-width: none;
        margin: 0;
    }

    .fig-heatmaps {
        --fig-min: 900px;
    }

    .figscroll::-webkit-scrollbar {
        height: 5px;
    }

    .figscroll::-webkit-scrollbar-thumb {
        background: var(--line);
        border-radius: 10px;
    }

    .scroll-hint {
        display: block;
    }

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

    /* the three resolutions only make their point side by side, so keep all
       three in a row and shrink the chrome instead of stacking them */
    .res-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }

    .res-card {
        padding: 0.45rem;
        border-radius: 9px;
    }

    .res-card .pipeline-tag {
        margin-top: 0.4rem;
        font-size: 0.7rem;
    }

    .pipeline-arrow {
        transform: rotate(90deg);
    }

    .pipeline-card {
        flex: 1 1 100%;
        max-width: 100%;
    }

    /* flex-basis switches to the vertical axis once this stacks, so reset it
       and let text and figure each take the full column width */
    .vp-flex {
        flex-direction: column;
        align-items: stretch;
        gap: 1.2rem;
    }

    .vp-text, .vp-image {
        flex: 0 0 auto;
        width: 100%;
    }

    .vp-image {
        max-width: 420px;
        margin: 0 auto;
    }

    .bibtex {
        padding: 1rem;
        font-size: 0.8rem;
    }

    .dataset-sec {
        padding: 1.6rem 1.1rem;
    }

    footer img {
        width: 140px;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1.45rem;
    }

    /* two per row keeps the eight gestures scannable; one per row turned this
       section into ~3000px of scrolling */
    .gesture-grid {
        gap: 0.6rem;
    }

    .gesture-card {
        padding: 0.45rem;
    }

    .gesture-name {
        margin-top: 0.4rem;
        font-size: 0.82rem;
    }

    /* the dataset URL is wider than the screen on its own */
    .icon-button {
        padding: 0.5rem 0.9rem;
        font-size: 0.88rem;
        overflow-wrap: anywhere;
    }

    .bibtex {
        padding: 0.8rem;
        font-size: 0.72rem;
    }

    .dataset-sec {
        padding: 1.3rem 0.9rem;
    }
}
