/* MaLoW additions to the Clarity layout used by the DRIFT project page. */
:root {
  /* Paper colors: papertitlegreen and metabg in fairmeta.cls. */
  --malow-ink: #14191f;
  --malow-muted: #5f6872;
  --malow-line: #d9e0e6;
  --malow-panel: #e5f0ea;
  --malow-green: #255746;
  --malow-teal: #1f756f;
  --malow-warm: #a65f2b;
}
* { box-sizing: border-box; }
body { color: var(--malow-ink); }
html { scroll-behavior: smooth; }
main > [id] { scroll-margin-top: 24px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* Native disclosure keeps the outline usable even without JavaScript. */
.section-navigation {
  position: fixed;
  z-index: 5;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  border: 1px solid var(--malow-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 24px #14191f14;
  font-family: "Poppins", sans-serif;
}
.section-navigation[open] { width: 208px; }
.section-navigation summary {
  padding: 12px 16px;
  border-radius: 9px;
  background: var(--malow-panel);
  color: var(--malow-green);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
}
.section-navigation summary:focus-visible {
  outline: 3px solid var(--malow-green);
  outline-offset: 4px;
}
.section-navigation nav { padding: 16px 10px 10px; }
.section-navigation nav > p {
  padding: 0 10px 8px;
  color: var(--malow-muted);
  font-size: .75rem;
  font-weight: 600;
}
.section-navigation ol {
  list-style: none;
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
}
.section-navigation a {
  display: block;
  padding: 10px 8px;
  border-left: 3px solid transparent;
  border-radius: 4px;
  color: var(--malow-muted);
  font-size: .78rem;
  line-height: 1.5;
  text-decoration: none;
}
.section-navigation a:hover,
.section-navigation a[aria-current="location"] {
  background: var(--malow-panel);
  color: var(--malow-green);
}
.section-navigation a[aria-current="location"] {
  border-left-color: var(--malow-green);
  font-weight: 600;
}
.section-navigation a:focus-visible { outline-offset: 0; }
@media (min-width: 1680px) {
  .section-navigation[data-enhanced] summary { display: none; }
  .section-navigation[data-enhanced] ol {
    max-height: calc(100vh - 100px);
    max-height: calc(100dvh - 100px);
  }
}
@media print {
  .section-navigation { display: none; }
}
a:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--malow-green);
  outline-offset: 4px;
}
a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--malow-green); }
strong { font-weight: 600; }
sup { font-size: .7em; vertical-align: super; line-height: 0; }
.sr-only, .skip-link:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link:focus { position: fixed; top: 12px; left: 12px; z-index: 10; background: white; padding: 12px; }
div.container.blog.main { padding: 32px max(24px, calc((100% - 820px) / 2)); }
div.container.blog.large { padding: 32px max(24px, calc((100% - 1080px) / 2)); }
div.container.blog.extra-large { padding: 32px max(24px, calc((100% - 1180px) / 2)); }
div.container.blog.first { margin-top: 22px; }
div.container.blog.gray { background: var(--malow-panel); }
div.container.blog.gray-linear { background: linear-gradient(180deg, var(--malow-panel), #fff); }
h2 { color: var(--malow-ink); font-size: 1.65rem; padding: 0 0 18px; font-weight: 600; }
h3 { font-size: 1.04rem; line-height: 1.45; padding: 0; }
div.container.blog p.text { font-size: 1.1rem; line-height: 1.8; padding: 8px 0; }
div.container.blog#first-content {
  padding: 60px max(24px, calc((100% - 1180px) / 2));
  background: var(--malow-panel);
}
div.container.blog#first-content div.blog-title {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}
div.container.blog#first-content div.blog-title .blog-intro { display: block; padding: 0; min-width: 0; }
div.container.blog#first-content div.blog-title .blog-cover { display: block; padding: 0; min-width: 0; }
div.container.blog#first-content .eyebrow {
  color: var(--malow-green); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; padding: 0 0 14px; letter-spacing: .02em;
}
div.container.blog#first-content h1.title { font-size: clamp(1.85rem, 2.8vw, 2.55rem); line-height: 1.2; font-weight: 500; padding: 0 0 24px; }
div.container.blog#first-content div.blog-title .blog-intro p.author { font-size: .88rem; line-height: 1.8; font-style: normal; padding: 0 0 12px; }
.author a { text-decoration: none; }
.author a:hover { text-decoration: underline; }
div.container.blog#first-content .author-note { color: var(--malow-muted); font-size: .77rem; line-height: 1.8; padding: 0 0 16px; }
div.container.blog#first-content div.blog-title .blog-intro p.abstract { font-size: .98rem; line-height: 1.7; padding: 0; }
.resource-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.resource-row .button { margin: 0; font-size: .68rem; letter-spacing: .02em; padding: 12px 15px; }
.button.pending { background: rgba(255,255,255,.4); color: #59636d; cursor: default; }
.button.pending:hover { opacity: 1; }
.media-figure { margin: 0; }
#inference-overhead .media-figure { max-width: 560px; margin: 20px auto 0; }
.media-figure img { display: block; width: 100%; height: auto; background: #fff; border-radius: 8px; }
.teaser-figure img {
  background: #edf6ee;
  border: 1px solid rgba(20,25,31,.12);
  box-shadow: 0 24px 80px rgba(20,25,31,.14);
}
.blank-media { background: #fff; border: 1px solid var(--malow-line); border-radius: 8px; aspect-ratio: 16 / 9; }
.teaser-figure .blank-media { aspect-ratio: 4 / 3; box-shadow: 0 24px 80px rgba(20,25,31,.10); }
.media-figure figcaption { color: var(--malow-muted); font-size: .78rem; line-height: 1.65; padding-top: 12px; }
.pending-note { display: block; font-size: inherit; color: var(--malow-muted); }
.method-figure, .dataset-figure { margin-top: 26px; }
#malow-instruct > h2, #malow-instruct > p.text, #malow-instruct figcaption { max-width: 820px; margin-inline: auto; }
.lead { color: var(--malow-muted); font-size: 1.04rem; line-height: 1.75; }
.stat-grid, .resource-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 18px; }
.stat-card, .resource-card, .method-step { background: white; border: 1px solid var(--malow-line); border-radius: 8px; padding: 22px; min-width: 0; }
.stat-card h3, .resource-card h3, .method-step h3 { margin-bottom: 10px; }
.stat-card p, .resource-card p, .resource-card li, .method-step p { color: var(--malow-muted); font-size: .92rem; line-height: 1.65; }
.resource-card a { color: var(--malow-green); font-size: inherit; line-height: inherit; }
.resource-card h3 i { margin-right: 6px; }
.resource-card .resource-status { margin-top: 12px; font-size: .83rem; }
div.container.blog .resource-card ul { margin: 12px 0 0; padding: 0 0 0 18px; }
.resource-card li + li { margin-top: 8px; }
.method-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr; gap: 14px; }
.method-step h3 { color: var(--malow-green); }
.flow-arrow { display: flex; align-items: center; justify-content: center; color: var(--malow-teal); }
.callout { background: var(--malow-panel); border-left: 4px solid var(--malow-green); padding: 22px 26px; }
.callout h3 { margin-bottom: 10px; }
.callout p { font-size: .94rem; line-height: 1.75; }
div.container.blog.main#performance { padding-bottom: 0; }
#performance-results > div.container.blog.main:first-child { padding-top: 0; }
#performance-results .main > h3 { color: var(--malow-ink); font-size: 1.25rem; font-weight: 600; margin: 0 0 12px; }
#performance-results .main > h3 + p.text { padding-top: 0; }
.result-table-block { background: white; border: 1px solid var(--malow-line); border-radius: 8px; overflow: hidden; }
.result-table-block + .result-table-block { margin-top: 24px; }
.table-note { color: var(--malow-muted); font-size: .85rem; line-height: 1.65; }
.table-scroll { overflow-x: auto; padding: 4px; }
.table-scroll:focus-visible { outline-offset: -3px; }
.result-table { border-collapse: collapse; width: 100%; min-width: 760px; margin: 0; }
.result-table th, .result-table td { font-size: .8rem; padding: 12px 14px; line-height: 1.5; vertical-align: middle; border-bottom: 1px solid var(--malow-line); text-align: right; }
.result-table thead th { background: var(--malow-panel); color: #26313b; font-weight: 600; }
.result-table th:first-child { text-align: left; min-width: 240px; width: 29%; }
.result-table tbody th { font-weight: 500; color: var(--malow-ink); }
.result-table tbody tr:nth-child(n) { border: 0; background: #fff; }
/* Match the base-model / MaLoW row colors in paper Table 16. */
.full-results-table tbody tr.model-qwen { background: #dcf5dc; }
.full-results-table tbody tr.model-videochat { background: #dcebfa; }
.full-results-table tbody tr.model-moss { background: #faf5d2; }
.result-table td { white-space: nowrap; font-variant-numeric: tabular-nums; text-align: center; }
.result-table tr:last-child th, .result-table tr:last-child td { border-bottom: 0; }
.table-note { padding: 18px 20px; border-top: 1px solid var(--malow-line); }
.paper-table th:first-child { min-width: 0; width: auto; }
.paper-table th.model-cell { min-width: 270px; text-align: left; }
.paper-table thead th { text-align: center; }
.full-results-table { min-width: 1500px; }
.scale-results-table { min-width: 1180px; }
.paper-table .model-detail { display: block; margin-top: 4px; color: var(--malow-muted); font-size: .72rem; font-weight: 400; }
.paper-table .table-group th { background: #d6e7dd; color: var(--malow-green); text-align: left; font-weight: 600; }
.paper-table tr.ours th { font-weight: 600; }
.paper-table .reported-score { color: var(--malow-muted); }
.paper-table td.perception-score { background: #e1f0d3; }
.paper-table td.memory-score { background: #e0eef8; }
.timeline { border-left: 2px solid var(--malow-line); padding-left: 24px; margin-top: 22px; }
.timeline-item { position: relative; margin-bottom: 24px; }
.timeline-item:last-child { margin-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -30px; top: 7px; width: 10px; height: 10px; border-radius: 50%; background: var(--malow-warm); }
.timeline-item h3 { margin-bottom: 8px; }
.timeline-item p { font-size: .94rem; color: var(--malow-muted); line-height: 1.7; }
pre { max-width: 100%; }
pre code { margin: 0; padding: 22px !important; font-size: .78rem !important; line-height: 1.8; border-color: var(--malow-line); color: var(--malow-green); }
footer { background: var(--malow-panel); margin-top: 36px; padding: 30px 24px; }
footer .container { max-width: 1080px; padding: 0; margin: auto; }
footer p { font-size: .86rem; color: var(--malow-muted); }
@media (max-width: 920px) {
  div.container.blog#first-content { padding-top: 40px; padding-bottom: 40px; }
  div.container.blog#first-content div.blog-title { grid-template-columns: 1fr; gap: 32px; }
  .teaser-figure { max-width: 640px; margin: auto; }
  .stat-grid, .resource-grid, .method-flow { grid-template-columns: 1fr; }
  .flow-arrow { transform: rotate(90deg); }
}
@media (max-width: 480px) {
  div.container.blog.main, div.container.blog.large, div.container.blog.extra-large { padding: 26px 20px; }
  div.container.blog#first-content { padding-left: 20px; padding-right: 20px; }
  h2 { font-size: 1.45rem; }
  div.container.blog p.text { font-size: 1rem; }
  .stat-card, .resource-card, .method-step, .callout { padding: 20px; }
}

/* Streaming examples: one full-width player, with source attached on demand. */
.video-demo [hidden] { display: none !important; }
.video-demo > h3 { color: var(--malow-green); margin-bottom: 20px; }
.video-demo h4 { font-size: 1rem; font-weight: 500; margin-bottom: 14px; }
.video-stage { position: relative; aspect-ratio: 16 / 9; background: #fff; border: 1px solid var(--malow-line); border-radius: 8px; overflow: hidden; }
.video-stage video { display: block; width: 100%; height: 100%; object-fit: contain; }
.video-demo button { text-transform: none; letter-spacing: 0; }
.video-stage .video-play { position: absolute; right: 16px; bottom: 16px; background: var(--malow-green); color: white; font-size: .9rem; margin: 0; border: 2px solid white; box-shadow: 0 2px 10px #0003; }
.video-demo button:focus-visible { outline: 3px solid var(--malow-green); outline-offset: 4px; }
.video-stage .video-play:focus-visible { outline-offset: -6px; outline-color: white; }
.video-details { display: flex; gap: 16px; justify-content: space-between; align-items: baseline; margin-top: 14px; }
.video-details p, .video-details a, .video-status { font-size: .88rem; line-height: 1.6; }
.video-details p { color: var(--malow-muted); }
.video-details a { color: var(--malow-green); flex-shrink: 0; }
.video-status { color: var(--malow-green); min-height: 1.6em; margin: 8px 0; }
.video-selector { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.video-selector button { display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 4px; text-align: left; margin: 0; padding: 14px 16px; background: white; border: 1px solid var(--malow-line); color: var(--malow-ink); }
.video-selector button[aria-pressed="true"] { background: var(--malow-panel); border: 2px solid var(--malow-green); padding: 13px 15px; }
.video-selector button:hover { opacity: 1; border-color: var(--malow-green); background: var(--malow-panel); }
.video-selector .sample-id { font-size: .8rem; font-weight: 600; color: var(--malow-green); }
.video-selector .sample-title { font-size: .8rem; font-weight: 400; line-height: 1.5; }
.video-fallback a { font-size: inherit; }
@media (max-width: 600px) {
  .video-selector { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-details { flex-direction: column; gap: 8px; }
  .video-stage .video-play { right: 8px; bottom: 8px; padding: 8px 12px; font-size: .8rem; }
}
@media (max-width: 360px) {
  .video-selector { grid-template-columns: 1fr; }
}

/* Explicit column widths for the result tables. */
.full-results-table, .scale-results-table, .simpler-results-table { table-layout: fixed; }
.full-results-table th.model-cell, .scale-results-table th.model-cell, .simpler-results-table th:first-child { min-width: 0; width: auto; }
.full-results-table col.col-model { width: 13%; }
.full-results-table col.col-frames { width: 6.5%; }
.full-results-table col.col-sb { width: 9.5%; }
.full-results-table col.col-avg { width: 9%; }
.full-results-table th.perception-header { text-align: center; }
/* EPM is column 11 in data rows; group labels span the entire table. */
.full-results-table th.epm-header,
.full-results-table tbody td:nth-child(11) {
  border-left: 1px solid var(--malow-green);
  border-right: 1px solid var(--malow-green);
}
.full-results-table thead th.epm-header { background: var(--malow-green); color: #fff; }
.scale-results-table col.col-model { width: 16%; }
.scale-results-table col.col-avg { width: 11.5%; }
.simpler-results-table col.col-model { width: 20%; }
.simpler-results-table col.col-avg { width: 18%; }
.simpler-results-table thead th:last-child { text-align: center; }
