/* ViralBench on doublespeed.ai. Colours and type come from platform.css
   tokens (--bg, --ink, --line, --serif, --sans); only the dialog backdrops,
   the viewer's progress bars and its prev/next discs use plain black or white
   alpha. */

.vb {
  width: min(100%, 1440px);
  margin: 0 auto;
  padding: 56px 40px 96px;
}

/* ---------- intro ---------- */
.vb-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(40px, 5vw, 64px);
  line-height: 1.1;
  letter-spacing: -0.03em;
}
.vb-intro {
  max-width: 760px;
  margin: 20px 0 0;
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink2);
}
.vb-intro em {
  color: var(--ink);
}
.vb-asof {
  min-height: 21px;
  margin: 12px 0 0;
  font-size: 14px;
  color: var(--dim);
}

/* ---------- layout: results on the left, chart + methodology on the right ---------- */
.vb-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 56px;
  align-items: start;
  margin-top: 56px;
}
.vb-rail {
  padding-left: 56px;
  border-left: 1px solid var(--line);
}

/* ---------- sort toggle ---------- */
.vb-sort {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 32px;
  font-size: 14px;
  color: var(--muted);
}
.vb-sort-group {
  display: inline-flex;
  border: 1px solid var(--line);
}
.vb-sort-btn {
  height: 32px;
  padding: 0 14px;
  border: 0;
  background: transparent;
  color: var(--ink2);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}
.vb-sort-btn + .vb-sort-btn {
  border-left: 1px solid var(--line);
}
@media (hover: hover) {
  .vb-sort-btn:hover,
  .vb-more:hover {
    background: var(--elev1);
    color: var(--ink);
  }
}
.vb-sort-btn[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}
.vb-sort-btn:focus-visible,
.vb-more:focus-visible,
.vb-note:focus-visible,
.vb-thumb:focus-visible,
.vb-close:focus-visible {
  outline: 1.5px solid var(--ink2);
  outline-offset: 2px;
}

/* ---------- model columns ---------- */
/* Columns wrap into rows of three rather than scrolling sideways: with a few
   hundred posts per model, a sideways scrollbar would sit thousands of pixels
   down the page and hide every model past the third. */
.vb-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 72px 40px;
  align-items: flex-start;
}
/* Three 272px columns plus two 40px gaps fit the 904px results area at the
   1440px max width. */
.vb-col {
  flex: 0 0 272px;
  width: 272px;
}
.vb-model {
  margin: 0 0 8px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.vb-stat {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.vb-stat-main {
  font-size: 17px;
  color: var(--ink2);
}

/* The model's own note from its latest run. Clipped to five lines; the whole
   note opens in a dialog, so the box is a button with a visible hover. */
.vb-note {
  display: block;
  width: 100%;
  margin: 20px 0 24px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink2);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease,
    color 120ms ease;
}
@media (hover: hover) {
  .vb-note:hover {
    border-color: var(--dim);
    background: var(--surface);
    color: var(--ink);
  }
}
.vb-note span {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
  white-space: pre-wrap;
}
.vb-note-empty {
  margin: 20px 0 24px;
  font-size: 14px;
  color: var(--dim);
}

.vb-posts {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.vb-post {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.vb-thumb {
  flex: none;
  width: 120px;
  height: 170px;
  padding: 0;
  border: 0;
  background: var(--elev1);
  cursor: pointer;
  transition: opacity 120ms ease;
}
@media (hover: hover) {
  .vb-thumb:hover {
    opacity: 0.8;
  }
}
.vb-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vb-metrics {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
  margin: 0;
  list-style: none;
}
/* Positioned so the hidden .vb-sr name stays inside the post row's sideways
   scroller on phones instead of widening the page. */
.vb-metric {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--ink2);
  font-variant-numeric: tabular-nums;
}
.vb-metric svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--dim);
}
.vb-metric-time {
  margin-top: auto;
  color: var(--dim);
}
/* The metric's name, read by screen readers in place of its icon. */
.vb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.vb-more {
  height: 32px;
  margin-top: 24px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink2);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    color 120ms ease;
}

.vb-status {
  margin: 0;
  font-size: 15px;
  color: var(--dim);
}

/* ---------- views per day chart ---------- */
.vb-rail h2 {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}
.vb-callout {
  min-height: 24px;
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--ink2);
}
.vb-callout strong {
  font-weight: 500;
  color: var(--ink);
}
.vb-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.vb-chart text {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
}
.vb-bar {
  fill: var(--dim);
}
.vb-bar-lead {
  fill: var(--ink);
}
.vb-bar-value {
  font-size: 13px;
  fill: var(--ink);
}
.vb-bar-label {
  font-size: 13px;
  fill: var(--ink2);
}
.vb-axis {
  stroke: var(--line);
}

/* ---------- methodology + contact ---------- */
.vb-section {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--line);
}
.vb-section h3 {
  margin: 28px 0 8px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
}
.vb-section p,
.vb-section li {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink2);
}
.vb-section ol {
  margin: 0 0 12px;
  padding-left: 20px;
}
.vb-section a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--dim);
  text-underline-offset: 4px;
}
@media (hover: hover) {
  .vb-section a:hover {
    text-decoration-color: var(--ink);
  }
}
.vb-section code {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--ink);
}

/* ---------- note / prompt dialog ---------- */
.vb-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: 80vh;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink2);
}
.vb-dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
}
.vb-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  font-weight: 500;
}
.vb-dialog-body {
  margin: 0;
  padding: 20px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.vb-close {
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink2);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: color 120ms ease;
}
@media (hover: hover) {
  .vb-close:hover {
    color: var(--ink);
  }
}

/* ---------- full-screen post viewer ---------- */
.vb-viewer {
  width: 100vw;
  max-width: none;
  height: 100vh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.94);
  color: var(--ink);
}
.vb-viewer[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.vb-viewer .vb-close {
  position: fixed;
  top: 16px;
  right: 20px;
  font-size: 36px;
}
.vb-viewer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(400px, 92vw);
}
.vb-progress {
  display: flex;
  gap: 4px;
  width: 100%;
  margin-bottom: 10px;
}
.vb-progress i {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.3);
}
.vb-progress i.on {
  background: var(--ink);
}
.vb-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  max-height: 78vh;
  background: var(--elev1);
}
.vb-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 150ms ease;
}
.vb-frame img.ready {
  opacity: 1;
}
.vb-frame button {
  position: absolute;
  top: 0;
  bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.vb-prev {
  left: 0;
  width: 30%;
}
.vb-next {
  right: 0;
  width: 70%;
}
/* The tap zones cover the slide, so hover and keyboard focus show a chevron
   in a dark disc at the zone's outer edge, readable over any image. */
.vb-frame button::before,
.vb-frame button::after {
  content: "";
  position: absolute;
  top: 50%;
  opacity: 0;
  transition: opacity 120ms ease;
}
.vb-frame button::before {
  width: 32px;
  height: 32px;
  margin-top: -16px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  transition:
    opacity 120ms ease,
    background-color 120ms ease;
}
.vb-frame button::after {
  width: 8px;
  height: 8px;
  margin-top: -5px;
  border-top: 1.5px solid var(--ink);
  border-right: 1.5px solid var(--ink);
}
.vb-prev::before {
  left: 12px;
}
.vb-prev::after {
  left: 25px;
  transform: rotate(-135deg);
}
.vb-next::before {
  right: 12px;
}
.vb-next::after {
  right: 25px;
  transform: rotate(45deg);
}
@media (hover: hover) {
  .vb-frame button:hover::before,
  .vb-frame button:hover::after {
    opacity: 1;
  }
}
.vb-frame button:focus-visible {
  outline: none;
}
.vb-frame button:focus-visible::before,
.vb-frame button:focus-visible::after {
  opacity: 1;
}
.vb-frame button:focus-visible::before {
  outline: 1.5px solid var(--ink2);
  outline-offset: 2px;
}
.vb-frame button:active::before {
  background: rgba(0, 0, 0, 0.8);
}
.vb-caption {
  width: 100%;
  margin: 16px 0 0;
  font-size: 15px;
  line-height: 1.45;
  text-align: center;
  white-space: pre-wrap;
}
.vb-sound {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- narrow screens: chart first, then each model with its posts in a row ---------- */
@media (max-width: 1100px) {
  .vb {
    padding: 32px 20px 64px;
  }
  .vb-stage {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 40px;
  }
  .vb-main,
  .vb-rail {
    display: contents;
  }
  .vb-chart-section {
    order: 0;
    margin-bottom: 40px;
  }
  .vb-sort {
    order: 1;
  }
  .vb-columns {
    order: 1;
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 48px;
  }
  .vb-col {
    flex: 1 1 auto;
    width: 100%;
  }
  .vb-posts {
    flex-direction: row;
    gap: 28px;
    margin-right: -20px;
    padding-bottom: 8px;
    overflow-x: auto;
  }
  .vb-post {
    flex: none;
  }
  .vb-section {
    order: 2;
  }
}
