/*******************************************************************************
PROJECT PAGE — full-width layout on top of the Tufted theme

Loaded after tufted.css, theme.css and custom.css, which set type, colors,
code blocks, framed tables and dark mode. This sheet changes the page
geometry from the Tufte text rail to one centered column and adds the page's
components. Proportions follow the golden ratio: the column is phi/2 of the
viewport, splits are 1 : 1.618, and vertical rhythm steps by phi.

Contents: tokens · page frame · type · hero · buttons · demo embed ·
robot panels · method and stats · skill space · comparisons · showcase ·
ablations · media cards · bibtex · lightbox · responsive · motion
*******************************************************************************/

:root {
    --page-max: 80.9vw;
    --page-gutter: 1rem;
    --prose-max: min(100%, max(50vw, 34rem));

    /* golden spacing scale */
    --s-2: 0.382rem;
    --s-1: 0.618rem;
    --s0: 1rem;
    --s1: 1.618rem;
    --s2: 2.618rem;
    --s3: 4.236rem;

    --radius: 8px;
    --radius-lg: 12px;
    --mono: ui-monospace, "SF Mono", "Cascadia Code", "Fira Mono", Menlo, monospace;
    --muted: color-mix(in srgb, var(--theme-text) 66%, transparent);
    --hairline: color-mix(in srgb, var(--theme-text) 14%, transparent);
    --accent: #b25e17;
    --stage: #141516;
}

:root {
    color-scheme: light;
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --theme-bg: #161817;
    --accent: #e39a4f;
}

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

/*******************************************************************************
PAGE FRAME
Tufte reserves a left gutter for sidenotes. This page has no side rail, so
header, article and footer share one centered measure.
*******************************************************************************/

body:has(> article.full-width-page) {
    width: 100%;
    max-width: none;
    padding-left: 0;
    margin: 0;
}

body:has(> article.full-width-page) > header.site-header,
body:has(> article.full-width-page) > article,
body:has(> article.full-width-page) > footer {
    width: min(100% - 2 * var(--page-gutter), var(--page-max));
    max-width: none;
    margin-left: auto;
    margin-right: auto;
    box-sizing: border-box;
}

body:has(> article.full-width-page) > header.site-header:empty {
    display: none;
}

article.full-width-page .fullwidth {
    width: 100%;
    max-width: 100%;
}

article.full-width-page h2,
article.full-width-page h3 {
    width: 100%;
}

/*******************************************************************************
TYPE
*******************************************************************************/

.paper-page h1,
.paper-page h2,
.paper-page h3 {
    text-wrap: balance;
}

.paper-page p {
    text-wrap: pretty;
}

/* Chapters: a hairline above each section so the single page reads as parts. */
.paper-page > h2 {
    margin-top: var(--s3);
    padding-top: var(--s1);
    border-top: 1px solid var(--hairline);
    scroll-margin-top: var(--s1);
}

.paper-page h2,
.paper-page h2 .heading-en,
.paper-page h3,
.paper-page h3 .heading-en {
    font-style: normal;
}

/* Tufte caps figures and paragraphs at the text rail; every block here
   sizes itself inside the page column instead. */
.paper-page figure {
    max-width: none;
}

/* The lede under each heading carries the section's claim. */
.lede {
    width: 100% !important;
    max-width: var(--prose-max);
    margin: var(--s-1) 0 var(--s1);
    font-size: 1.5rem;
    line-height: 1.55;
    color: color-mix(in srgb, var(--theme-text) 84%, transparent);
}

.prose {
    max-width: var(--prose-max);
    font-size: 1.4rem;
    line-height: 2.2rem;
}

.prose p,
.prose ul,
.prose ol {
    width: 100%;
}

.dot {
    margin: 0 0.45em;
    opacity: 0.55;
}

/*******************************************************************************
HERO
*******************************************************************************/

.paper-hero {
    text-align: center;
    padding: var(--s2) 0 var(--s-1);
}

.paper-kicker {
    display: inline-block;
    font-family: var(--mono);
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.6;
}

.paper-title {
    max-width: 62rem;
    margin: 0.7rem auto 1rem;
    font-size: clamp(2.7rem, 5.2vw, 4.4rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.01em;
}

.paper-title .heading-en {
    font-style: normal;
}

.paper-subtitle {
    width: auto !important;
    max-width: 46rem;
    margin: 0 auto var(--s1) !important;
    font-size: 1.55rem;
    line-height: 1.5;
    text-align: center;
    text-wrap: balance;
    color: color-mix(in srgb, var(--theme-text) 82%, transparent);
}

.paper-byline {
    display: block;
    width: 100% !important;
    margin: 0 auto;
    text-align: center;
    font-size: 1.25rem;
    line-height: 1.5;
    color: var(--muted);
}

.paper-authors {
    font-size: 1.4rem;
    line-height: 1.6;
}

.paper-affil {
    margin-top: 0.15rem;
    font-size: 1.15rem;
    line-height: 1.5;
    opacity: 0.72;
}

.paper-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin: var(--s1) 0 0;
}

/*******************************************************************************
BUTTONS
*******************************************************************************/

.paper-btn,
.paper-btn:link,
.paper-btn:visited {
    display: inline-flex;
    align-items: center;
    gap: 0.45em;
    padding: 0.6rem 1.1rem;
    border: 1px solid color-mix(in srgb, var(--theme-text) 22%, transparent);
    border-radius: 999px;
    background-color: var(--theme-pre-bg) !important;
    color: var(--theme-heading);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: 0.01em;
    text-decoration: none !important;
    background-image: none !important;
    text-shadow: none !important;
    transition: opacity 0.15s ease, transform 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.paper-btn:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--theme-text) 40%, transparent);
}

.paper-btn.is-secondary,
.paper-btn.is-secondary:link,
.paper-btn.is-secondary:visited {
    background-color: transparent !important;
}

.paper-btn.is-disabled,
.paper-btn.is-disabled:link,
.paper-btn.is-disabled:visited {
    opacity: 0.42;
    cursor: default;
    pointer-events: none;
}

.paper-btn .proj-icon {
    width: 1.05em;
    height: 1.05em;
}

button.paper-btn {
    cursor: pointer;
    font-family: inherit;
}

.paper-page :is(a, button, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/*******************************************************************************
DEMO EMBED
A fixed box: the demo lays itself out inside it and never resizes the page.
Before launch it shows a looping recording of the demo as the cover.
*******************************************************************************/

.demo-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 34rem;
    max-height: 90vh;
    margin: 0;
    border: 1px solid var(--theme-pre-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--stage);
}

.demo-embed .demo-frame {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: var(--theme-bg);
}

.demo-cover {
    position: absolute;
    inset: 0;
}

.demo-cover-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: 61.8% 50%;
}

.demo-cover::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(12, 13, 14, 0.86) 0%, rgba(12, 13, 14, 0.62) 30%, rgba(12, 13, 14, 0) 58%);
    pointer-events: none;
}

.demo-cover-body {
    position: absolute;
    z-index: 1;
    left: 6%;
    top: 50%;
    transform: translateY(-50%);
    width: min(36%, 30rem);
    color: #f3f3f1;
    text-align: left;
}

.demo-cover-kicker {
    font-family: var(--mono);
    font-size: 0.85rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.7;
}

.demo-cover-title {
    margin: 0.5rem 0 0.6rem;
    font-size: clamp(1.9rem, 2.6vw, 2.6rem);
    font-weight: 700;
    line-height: 1.12;
    text-wrap: balance;
}

.demo-cover-text {
    width: 100% !important;
    margin: 0 0 var(--s1);
    font-size: 1.15rem;
    line-height: 1.5;
    opacity: 0.84;
}

.demo-cover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.demo-cover .paper-btn,
.demo-cover .paper-btn:link,
.demo-cover .paper-btn:visited {
    border-color: rgba(255, 255, 255, 0.32);
    background-color: rgba(255, 255, 255, 0.08) !important;
    color: #f3f3f1;
}

.demo-cover .paper-btn.demo-launch {
    border-color: #f3f3f1;
    background-color: #f3f3f1 !important;
    color: #141516;
}

.demo-note {
    width: 100% !important;
    margin: var(--s-1) 0 0;
    font-size: 1rem;
    line-height: 1.45;
    color: var(--muted);
}

/*******************************************************************************
ROBOT PANELS
Number, title and claim; then the player with a thumbnail rail. Panels
without clips yet keep the same header over a slim placeholder.
*******************************************************************************/

.hw-panel {
    margin: var(--s2) 0 0;
}

.hw-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: end;
    column-gap: var(--s0);
    margin: 0 0 var(--s-1);
}

.hw-num {
    font-family: var(--mono);
    font-size: 2.4rem;
    font-weight: 300;
    line-height: 1;
    letter-spacing: -0.02em;
    color: var(--accent);
}

.hw-titles h3 {
    margin: 0;
    font-size: 1.62rem;
    font-weight: 600;
    line-height: 1.2;
}

.hw-claim {
    width: 100% !important;
    margin: 0.15rem 0 0;
    font-size: 1.15rem;
    line-height: 1.45;
    color: var(--muted);
}

.hw-count,
.hw-status {
    font-family: var(--mono);
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--muted);
    padding-bottom: 0.2rem;
}

.hw-panel .media-frame {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.clip-rail-wrap {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.5rem;
    margin-top: var(--s-1);
}

.clip-rail {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    padding: 0.35rem 1.2rem 0.5rem;
    scroll-padding-inline: 1.2rem;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 1.2rem, #000 calc(100% - 1.2rem), transparent 100%);
}

.clip-thumb {
    flex: 0 0 auto;
    width: clamp(7.5rem, 10vw, 10.5rem);
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    scroll-snap-align: start;
}

.clip-thumb img {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    outline: 2px solid transparent;
    outline-offset: 2px;
    opacity: 0.7;
    transition: opacity 0.15s ease, outline-color 0.15s ease;
}

.clip-thumb:hover img {
    opacity: 1;
}

.clip-thumb.is-active img {
    opacity: 1;
    outline-color: var(--accent);
}

.clip-label {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.92rem;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--muted);
}

.clip-thumb.is-active .clip-label {
    color: var(--theme-heading);
}

.rail-nav {
    display: grid;
    place-items: center;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", sans-serif !important;
    width: 2.1rem;
    height: 2.1rem;
    border: 1px solid var(--theme-pre-border);
    border-radius: 50%;
    background: var(--theme-pre-bg);
    color: var(--theme-heading);
    font: inherit;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.rail-nav:hover {
    border-color: var(--accent);
}

/* Placeholders: hatched frame with a status pill. */
.media-frame.is-pending {
    display: grid;
    place-items: center;
    border: 1px dashed color-mix(in srgb, var(--theme-text) 22%, transparent);
    background:
        repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--theme-text) 5%, transparent) 14px 28px),
        var(--theme-pre-bg);
}

.pending-label {
    font-family: var(--mono);
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.4rem 0.85rem;
    border: 1px solid currentColor;
    border-radius: 999px;
    background: var(--theme-bg);
}

/*******************************************************************************
METHOD AND HEADLINE NUMBERS
*******************************************************************************/

.split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--s2);
    align-items: start;
    margin: 0 0 var(--s1);
}

.split.golden {
    grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
}

.split > .prose {
    max-width: none;
}

.split > .prose > p:first-child {
    margin-top: 0;
}

.kv {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    column-gap: 1.2rem;
    row-gap: 0.5rem;
    margin: var(--s0) 0 0;
    font-size: 1.2rem;
    line-height: 1.5;
}

.kv dt {
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
    padding-top: 0.2em;
}

.kv dd {
    margin: 0;
}

.stat-band {
    margin: var(--s2) 0 0;
}

.stat-band-label {
    width: 100% !important;
    margin: 0 0 var(--s-1);
    font-family: var(--mono);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s0);
}

.stat {
    padding: 1.05rem 1.2rem 1.1rem;
    border: 1px solid var(--theme-pre-border);
    border-radius: var(--radius);
    background-color: var(--theme-pre-bg);
}

.stat-value {
    font-size: 2.6rem;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.01em;
    color: var(--theme-heading);
}

.stat-value small {
    margin-left: 0.12em;
    font-size: 0.5em;
    font-weight: 500;
    opacity: 0.7;
}

.stat-label {
    margin-top: 0.55rem;
    font-size: 1.1rem;
    line-height: 1.35;
}

.stat-versus {
    margin-top: 0.35rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--muted);
}

/*******************************************************************************
SKILL SPACE
The map at golden major width, three clusters from it stacked at the minor.
*******************************************************************************/

.space {
    display: grid;
    grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
    gap: var(--s1);
    align-items: stretch;
}

.space-examples {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: var(--s-1);
}

.cluster-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    border: 1px solid var(--theme-pre-border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--theme-pre-bg);
}

.cluster-strip {
    background: var(--theme-paper-bg, #f8f5ee);
}

.cluster-strip img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
}

.cluster-card figcaption {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    float: none !important;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.55rem;
    padding: 0.55rem 0.8rem 0.6rem;
    font-size: 1.05rem;
    line-height: 1.35;
}

.cluster-name {
    font-weight: 600;
    color: var(--theme-heading);
}

.cluster-note {
    color: var(--muted);
}

/*******************************************************************************
COMPARISONS
One wide player per comparison, ours on the left, a tab per case.
*******************************************************************************/

.compare {
    margin: var(--s2) 0 0;
}

.compare-head {
    margin: var(--s2) 0 var(--s-1);
}

.compare .compare-head {
    margin-top: 0;
}

.compare-head h3 {
    margin: 0;
    font-size: 1.62rem;
    font-weight: 600;
    line-height: 1.2;
}

.compare-claim {
    width: 100% !important;
    max-width: var(--prose-max);
    margin: 0.2rem 0 0;
    font-size: 1.15rem;
    line-height: 1.45;
    color: var(--muted);
}

.compare-legend {
    display: flex;
    justify-content: space-between;
    margin: var(--s0) 0 0.4rem;
    font-family: var(--mono);
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.compare-legend .is-ours {
    color: var(--accent);
}

.compare-legend .is-other {
    color: var(--muted);
}

.compare-case {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
}

.compare-case .media-frame {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.compare-case figcaption {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    float: none !important;
    padding: 0.55rem 0 0;
    font-size: 1.05rem;
    line-height: 1.45;
    color: var(--muted);
}

/* The split placeholder previews the final format: two halves. */
.media-frame.is-split::before {
    content: "";
    position: absolute;
    top: 9%;
    bottom: 9%;
    left: 50%;
    border-left: 1px dashed color-mix(in srgb, var(--theme-text) 28%, transparent);
}

.compare-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: var(--s-1);
}

.compare-tab {
    padding: 0.42rem 0.9rem;
    border: 1px solid var(--theme-pre-border);
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 1rem;
    line-height: 1.2;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.compare-tab:hover {
    color: var(--theme-heading);
}

.compare-tab.is-active {
    border-color: var(--accent);
    background: var(--theme-pre-bg);
    color: var(--theme-heading);
}

/*******************************************************************************
SHOWCASE
A featured clip at the golden major width, two beside it, four below.
Captions sit on the video; a click opens the clip large.
*******************************************************************************/

.bento {
    display: grid;
    grid-template-columns: minmax(0, 1.618fr) minmax(0, 1fr);
    grid-auto-rows: auto;
    gap: var(--s-1);
}

.show-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s-1);
    margin-top: var(--s-1);
}

.show-card {
    position: relative;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #d9dbdd;
}

.bento .show-card.is-feature {
    grid-row: span 2;
    aspect-ratio: auto;
}

.show-card video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    cursor: zoom-in;
}

.show-card figcaption {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    float: none !important;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    padding: 2.4rem 0.85rem 0.65rem;
    background: linear-gradient(180deg, rgba(10, 11, 12, 0) 0%, rgba(10, 11, 12, 0.66) 100%);
    color: #f5f5f3;
    pointer-events: none;
}

.show-title {
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.25;
}

.show-caption {
    font-size: 0.92rem;
    line-height: 1.3;
    opacity: 0.85;
}

.show-card.is-feature .show-title {
    font-size: 1.3rem;
}

.show-row .show-card figcaption {
    padding: 1.6rem 0.7rem 0.5rem;
}

.show-row .show-title {
    font-size: 0.98rem;
}

.show-row .show-caption {
    font-size: 0.84rem;
}

/*******************************************************************************
ABLATIONS
Each finding: the takeaway (sticky) on the left, the table on the right.
*******************************************************************************/

.metric-key {
    width: 100% !important;
    max-width: none;
    margin: calc(-1 * var(--s-1)) 0 var(--s0);
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--muted);
}

.finding {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.618fr);
    gap: var(--s2);
    align-items: start;
    padding: var(--s1) 0;
    border-top: 1px solid var(--hairline);
}

.metric-key + .finding {
    border-top: 0;
    padding-top: var(--s-1);
}

.finding-text {
    position: sticky;
    top: var(--s1);
}

.finding-letter {
    font-family: var(--mono);
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    color: var(--accent);
}

.finding-text h3 {
    margin: 0.3rem 0 0.5rem;
    font-size: 1.55rem;
    font-weight: 600;
    line-height: 1.2;
}

.finding-text p {
    width: 100% !important;
    margin: 0;
    font-size: 1.15rem;
    line-height: 1.55;
    color: var(--muted);
}

.finding-table .tufted-framed,
.finding-table .tufted-framed-table {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

.finding-table .tufted-framed-table table {
    margin: 0 auto;
}

.tufted-framed-table table th {
    text-align: center;
    padding: 0.42em 0.55em;
}

.tufted-framed-table table th:first-child {
    text-align: left;
}

/*******************************************************************************
MEDIA CARDS (figures)
*******************************************************************************/

.media-card {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border: 1px solid var(--theme-pre-border);
    border-radius: var(--radius);
    background-color: var(--theme-pre-bg);
    overflow: hidden;
}

.media-frame {
    position: relative;
    width: 100%;
    aspect-ratio: var(--aspect, 16 / 9);
    background-color: #0b0c0d;
    flex: 0 0 auto;
}

.media-frame video,
.media-frame img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
}

/* Paper frame: cream in both themes, so print-white figures do not glare. */
.media-frame.is-paper {
    aspect-ratio: auto;
    padding: 0.8rem 1rem;
    box-sizing: border-box;
    background-color: var(--theme-paper-bg, #f8f5ee);
}

.media-frame.is-paper img {
    height: auto;
    object-fit: contain;
}

.media-card figcaption {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    float: none !important;
    clear: none !important;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.7rem 0.95rem 0.85rem;
    font-size: 1.08rem;
    line-height: 1.4;
    flex: 1 1 auto;
}

.media-title {
    font-weight: 600;
    color: var(--theme-heading);
}

.media-caption {
    color: var(--muted);
}

/*******************************************************************************
BIBTEX
*******************************************************************************/

.bibtex pre {
    width: fit-content;
    max-width: 100%;
    overflow-x: auto;
}

/*******************************************************************************
LIGHTBOX
*******************************************************************************/

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 3vh 3vw;
    background: rgba(8, 9, 10, 0.88);
}

.lightbox-figure {
    width: auto;
    max-width: 94vw;
    margin: 0;
}

.lightbox-figure video {
    display: block;
    max-width: 94vw;
    max-height: 84vh;
    border-radius: var(--radius);
    background: #000;
}

.lightbox-caption {
    width: auto !important;
    max-width: none !important;
    margin: 0.7rem 0 0 !important;
    float: none !important;
    color: #e9e9e7;
    font-size: 1.1rem;
    text-align: center;
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    width: 2.6rem;
    height: 2.6rem;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

html.has-lightbox {
    overflow: hidden;
}

/*******************************************************************************
RESPONSIVE
*******************************************************************************/

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

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

    .demo-cover-body {
        width: min(46%, 30rem);
    }
}

@media (max-width: 860px) {
    :root {
        --page-max: 100vw;
    }

    .split,
    .split.golden,
    .space,
    .finding {
        grid-template-columns: minmax(0, 1fr);
        gap: var(--s1);
    }

    .finding-text {
        position: static;
    }

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

    .bento .show-card.is-feature {
        grid-row: auto;
        aspect-ratio: 16 / 9;
    }

    .hw-head {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .hw-count,
    .hw-status {
        grid-column: 2;
        padding: 0.3rem 0 0;
    }
}

@media (max-width: 760px) {
    .paper-hero {
        padding-top: var(--s1);
    }

    .paper-subtitle,
    .lede {
        font-size: 1.3rem;
    }

    .stat-value {
        font-size: 2.1rem;
    }

    .kv {
        grid-template-columns: minmax(0, 1fr);
        row-gap: 0.15rem;
    }

    .kv dd {
        margin-bottom: 0.55rem;
    }

    .hw-num {
        font-size: 1.9rem;
    }

    .show-row {
        grid-template-columns: minmax(0, 1fr);
    }

    /* The demo keeps a fixed box on phones too: stage above, controls below. */
    .demo-embed {
        aspect-ratio: auto;
        height: min(100svh - 4rem, 54rem);
        max-height: none;
    }

    .demo-cover::after {
        background: linear-gradient(180deg, rgba(12, 13, 14, 0) 30%, rgba(12, 13, 14, 0.9) 78%);
    }

    .demo-cover-body {
        left: 1.1rem;
        right: 1.1rem;
        top: auto;
        bottom: 1.2rem;
        transform: none;
        width: auto;
    }

    /* One-line scrolling nav instead of three wrapped rows. */
    header.site-header nav {
        flex-wrap: nowrap;
        gap: 0.2em;
        overflow-x: auto;
        scrollbar-width: none;
        -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
        mask-image: linear-gradient(90deg, #000 85%, transparent);
    }

    header.site-header nav::-webkit-scrollbar {
        display: none;
    }

    header.site-header nav a {
        flex: 0 0 auto;
        font-size: 1.3rem !important;
    }

    .tufted-framed-table table td,
    .tufted-framed-table table th {
        white-space: nowrap;
    }
}

/*******************************************************************************
MOTION
*******************************************************************************/

@media (prefers-reduced-motion: reduce) {
    .paper-btn,
    .clip-thumb img,
    .compare-tab {
        transition: none;
    }

    .paper-btn:hover {
        transform: none;
    }
}

/*******************************************************************************
ICLR 2027 PAGE ADDITIONS
Two videos side by side; display equations inside the method prose.
*******************************************************************************/

.video-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s0);
    margin-top: var(--s1);
}

.video-pair .media-card {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
}

.split > .prose figure[role="math"] {
    margin: var(--s-1) 0;
    overflow-x: auto;
}

.paper-page > .media-card {
    margin-top: var(--s1);
}

@media (max-width: 760px) {
    .video-pair {
        grid-template-columns: minmax(0, 1fr);
    }
}

.compare-head + .media-card {
    margin: var(--s0) 0 var(--s-1);
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s0);
    margin-top: var(--s0);
}

.video-grid .media-card {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
}

@media (max-width: 760px) {
    .video-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}
