:root {
  --paper: #eef0f2;
  --page: var(--band);   /* behind the content column: the hero band colour */
  --ink: #182127;
  --grey: #d3d6d9;
  --blue: #294683;
  --blue-pale: #dce3f0;
  --red: #c83f3b;
  --band: #e1e5e9;
  --bar-ours: #5977af;
  --bar-other: #c7ced1;
  --progress: 0;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* the header and hero span the page as before; below them the content sits on a
   paper-coloured column, set off from the page behind it (the hero band colour) */
.site-header {
  background: var(--paper);
}

.content {
  max-width: 1280px;
  margin: 0 auto;
  background: var(--paper);
  border-right: 1px solid #dfe2e5;
  border-left: 1px solid #dfe2e5;
}

.hero {
  width: min(1080px, calc(100% - 160px));
  margin: 0 auto;
  padding: clamp(72px, 10vh, 120px) 0;
}

.pipeline {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 42px 150px 42px minmax(205px, 225px);
  align-items: center;
}

.pipeline + .pipeline {
  margin-top: clamp(26px, 3.5vh, 40px);
}

.signal-group {
  --frame-width: 120px;
  min-width: 0;
}

.signal-strip {
  position: relative;
  height: 112px;
}

.signal-strip-k2v {
  height: 190px;
}

.condition-time-area {
  position: absolute;
  inset: 0 calc(var(--frame-width) / 2);
}

.condition-frame {
  position: absolute;
  top: 8px;
  z-index: 2;
  width: var(--frame-width);
  margin: 0;
  overflow: visible;
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: 0 6px 15px rgba(24, 33, 39, 0.16);
  transform: translateX(-50%);
  transition: transform 280ms ease, box-shadow 280ms ease;
}

.condition-frame::before {
  position: absolute;
  inset: -2px;
  z-index: 2;
  pointer-events: none;
  border: 2px solid transparent;
  border-radius: inherit;
  content: "";
}

.condition-frame::after {
  position: absolute;
  bottom: -8px;
  left: 50%;
  z-index: 3;
  width: 0;
  height: 0;
  border-top: 7px solid var(--ink);
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  content: "";
  transform: translateX(-50%);
}

.condition-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.condition-frame figcaption {
  height: 24px;
  padding: 6px 7px 0;
  border-top: 1px solid var(--ink);
  background: var(--paper);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.condition-frame-start {
  left: 0;
  transform: translateX(calc(-50% - var(--nudge, 0px)));
}

/* keep the Start card's pointer on 0s when it is nudged aside */
.condition-frame-start::after {
  left: calc(50% + var(--nudge, 0px));
}

.condition-frame-one {
  left: 25%; /* 1.25 s of 5 s; app.js recomputes this when the scene changes */
}

.condition-frame-two {
  left: 100%;
}

.condition-frame-three {
  left: 100%;
}

.keyframe-reused {
  opacity: 0.6;
}

.condition-frame-key {
  border-color: var(--blue);
}

.condition-frame[hidden] {
  display: none;
}

.signal-strip-k2v .condition-frame {
  top: 86px;
}

.keyframe-generator {
  position: absolute;
  top: 0;
  left: 62.5%; /* midway between the 1.25 s and 5 s cards */
  z-index: 3;
  display: flex;
  width: 142px;
  height: 48px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: 4px;
  color: var(--blue);
  background: var(--blue-pale);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.05;
  text-align: center;
  transform: translateX(-50%);
}

.generator-arrows {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.generator-arrow {
  fill: none;
  stroke: var(--blue);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
  marker-end: url(#generator-arrowhead);
}

#generator-arrowhead path {
  fill: var(--blue);
  stroke: none;
}

.dial {
  position: relative;
  height: 30px;
  margin-top: 4px;
}

.signal-group .dial {
  margin-right: calc(var(--frame-width) / 2);
  margin-left: calc(var(--frame-width) / 2);
}

.dial-rail {
  position: relative;
  height: 14px;
  background-image:
    repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 20%),
    repeating-linear-gradient(90deg, var(--ink) 0 1px, transparent 1px 4%);
  background-position: left bottom, left bottom;
  background-repeat: no-repeat;
  background-size: 100% 14px, 100% 7px;
}

.dial-rail::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 14px;
  background: var(--ink);
  content: "";
}

.playhead {
  position: absolute;
  top: -3px;
  left: calc(var(--progress) * 100%);
  z-index: 3;
  width: 2px;
  height: 20px;
  background: var(--red);
  transform: translateX(-1px);
}

.dial-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 8px;
  font-variant-numeric: tabular-nums;
}

.flow-arrow {
  position: relative;
  height: 1px;
  margin: 0 14px;
  background: var(--ink);
}

.flow-arrow span {
  position: absolute;
  top: -4px;
  right: -1px;
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 7px solid var(--ink);
}

.flow-arrow-accent {
  background: var(--blue);
}

.flow-arrow-accent span {
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-left-color: var(--blue);
}

.model-block {
  display: flex;
  min-height: 72px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: #cbd0d1;
}

.model-block strong {
  padding: 0 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  font-weight: 400;
  letter-spacing: -0.03em;
  text-align: center;
}

/* a model name breaks only between its parts, e.g. after "K2V+" on narrow screens */
.model-block strong span {
  display: inline-block;
  white-space: nowrap;
}

.model-block-accent {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-pale);
}


.output-group {
  min-width: 0;
}

.video-shell {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--grey);
  box-shadow: 0 8px 20px rgba(24, 33, 39, 0.14);
}

.video-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.video-shell.is-matching::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border: 3px solid transparent;
  border-radius: inherit;
  background: conic-gradient(#ef5350, #ffca58, #59d39e, #52b5e5, #b36ee1, #ef5350) border-box;
  content: "";
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: keyframe-shimmer 1.3s linear infinite;
}

.condition-frame-key.is-matching::before {
  background: conic-gradient(#ef5350, #ffca58, #59d39e, #52b5e5, #b36ee1, #ef5350) border-box;
  mask: linear-gradient(#000 0 0) padding-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  animation: keyframe-shimmer 1.3s linear infinite;
}

.condition-frame.is-matching,
.condition-frame.is-current {
  box-shadow: 0 6px 18px rgba(42, 92, 156, 0.28);
  transform: translateX(-50%) scale(1.09);
}

.condition-frame-start.is-current {
  transform: translateX(calc(-50% - var(--nudge, 0px))) scale(1.09);
}

.scene-toggle {
  display: grid;
  width: min(100%, 480px);
  margin: clamp(54px, 7vh, 76px) auto 0;
  overflow: hidden;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--ink);
  border-radius: 3px;
}

.scene-toggle button {
  min-width: 0;
  padding: 11px 14px;
  border: 0;
  border-right: 1px solid var(--ink);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  line-height: 1.15;
}

.scene-toggle button:last-child {
  border-right: 0;
}

.scene-toggle button.is-active {
  color: var(--ink);
  background: #cbd0d1;
}

.scene-toggle button:focus-visible {
  position: relative;
  z-index: 2;
  outline: 2px solid var(--red);
  outline-offset: -3px;
}

@keyframes keyframe-shimmer {
  from { filter: hue-rotate(0deg); }
  to { filter: hue-rotate(360deg); }
}

@media (max-width: 1280px) {
  .pipeline {
    grid-template-columns: minmax(280px, 1fr) 34px 140px 34px minmax(195px, 215px);
  }
}

@media (max-width: 900px) {
  .hero {
    width: min(100% - 80px, 1080px);
  }

  .pipeline {
    grid-template-columns: minmax(105px, 138px) 34px minmax(220px, 280px);
    justify-content: space-between;
    padding: 10px 0;
  }

  .pipeline .signal-group {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .pipeline .flow-arrow-in {
    display: none;
  }

  .pipeline .model-block {
    grid-column: 1;
    grid-row: 2;
    margin-top: 20px;
  }

  .pipeline .flow-arrow-out {
    grid-column: 3;
    grid-row: 2;
  }

  .pipeline .output-group {
    grid-column: 4;
    grid-row: 2;
    margin-top: 20px;
  }
}

@media (max-width: 680px) {
  .hero {
    width: min(100% - 56px, 1080px);
    padding: 50px 0;
  }

  .pipeline {
    grid-template-columns: 88px 28px minmax(0, 165px);
    padding: 0;
  }

  .pipeline + .pipeline {
    margin-top: 36px;
  }

  .pipeline .signal-group {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .pipeline .model-block {
    grid-column: 1;
    grid-row: 2;
    margin-top: 20px;
  }

  .pipeline .flow-arrow-out {
    grid-column: 2;
    grid-row: 2;
  }

  .pipeline .output-group {
    grid-column: 3;
    grid-row: 2;
    margin-top: 20px;
  }

  .signal-group {
    --frame-width: 100px;
  }

  .signal-strip {
    height: 102px;
  }

  .signal-strip-k2v {
    height: 180px;
  }

  .condition-frame {
    top: 8px;
  }

  .signal-strip-k2v .condition-frame {
    top: 78px;
  }

  .keyframe-generator {
    width: 120px;
    height: 42px;
    font-size: 12px;
  }

  .model-block {
    min-height: 54px;
  }

  .model-block strong {
    padding: 0 4px;
    font-size: 14px;
  }

  .flow-arrow {
    margin: 0 8px;
  }

  .scene-toggle {
    margin-top: 50px;
  }

  .scene-toggle button {
    padding: 10px 7px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .video-shell::after,
  .condition-frame::before {
    animation: none !important;
  }
}

/* ---- Title --------------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 36px 26px;
}

.site-authors {
  margin: 10px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  color: var(--ink);
}

.site-authors a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--grey);
  text-underline-offset: 3px;
}

.site-authors a:hover,
.site-authors a:focus-visible {
  text-decoration-color: currentColor;
}

/* the hero sits on a slightly darker full-width band */
.hero-band {
  background: var(--band);
  border-top: 1px solid #d3d8dd;
  border-bottom: 1px solid #d3d8dd;
}

.site-links {
  display: flex;
  flex-shrink: 0;
  gap: 10px;
}

.site-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
  font-size: 14px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.site-link svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.site-link[aria-disabled="true"] {
  cursor: default;
}

.site-link[href]:hover,
.site-link[href]:focus-visible {
  background: var(--ink);
  color: var(--paper);
}

.site-title {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.hero-band .hero {
  padding-top: clamp(24px, 3.5vh, 40px);
  padding-bottom: clamp(24px, 3.5vh, 40px);
}

/* ---- Abstract ------------------------------------------------------------------ */

.abstract {
  width: min(1080px, calc(100% - 160px));
  margin: 0 auto;
  padding: clamp(28px, 4vh, 44px) 0 clamp(22px, 3vh, 34px);
}

.abstract p {
  max-width: 820px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.65;
}

/* ---- Benchmark charts ---------------------------------------------------------- */

.chart {
  margin: 4px 0 26px;
}

.chart-title {
  margin: 0 0 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  color: #4a535c;
}

.chart-rows {
  display: grid;
  gap: 6px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(150px, 230px) minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
}

.chart-label {
  text-align: right;
}

.chart-track {
  position: relative;
  height: 20px;
  margin-right: 64px;
  border-left: 1px solid var(--ink);
}

.chart-bar {
  position: absolute;
  inset: 2px auto 2px 0;
  width: 0;
  background: var(--bar-other);
  border: 1px solid var(--ink);
  border-left: 0;
}

.chart-value {
  position: absolute;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 13px;
  white-space: nowrap;
}

.chart-row.is-ours {
  color: var(--blue);
  font-weight: 700;
}

.chart-row.is-ours .chart-bar {
  background: var(--bar-ours);
}

/* ---- Qualitative results ------------------------------------------------------- */

.results {
  width: min(1080px, calc(100% - 160px));
  margin: 0 auto;
  padding: 0 0 clamp(36px, 5vh, 56px);
}

.results-title {
  margin: 0 0 8px;
  padding-top: 18px;
  border-top: 1px solid var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.results-footnote {
  max-width: 760px;
  margin: 10px 2px 22px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  line-height: 1.5;
  opacity: 0.75;
}

.results-lede {
  max-width: 640px;
  margin: 0 0 16px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.5;
}

.results-head,
.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.results-head-4,
.result-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.results-head {
  padding: 0 16px 8px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
}

.results-head span:nth-child(2) {
  color: var(--blue);
}

.results-list {
  display: grid;
  gap: 16px;
}

.result-note {
  max-width: 860px;
  margin: 14px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.5;
}

.result {
  border: 1px solid var(--ink);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.28);
}

.result[open] {
  box-shadow: 0 8px 20px rgba(24, 33, 39, 0.1);
}

.result-summary {
  display: block;
  padding: 16px 16px 0;
  cursor: pointer;
  list-style: none;
}

.result-summary::-webkit-details-marker {
  display: none;
}

.result-summary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  border-radius: 4px;
}

.result-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--ink);
  border-radius: 3px;
  background: var(--grey);
}

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

.result-cell:nth-child(2) .result-frame {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.result-input-caption {
  margin: 8px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  font-style: italic;
  line-height: 1.4;
}

.result-prompt-card {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  background: var(--paper);
}

.result-prompt-card p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  font-style: italic;
  line-height: 1.45;
}

/* four-column rows leave a narrower card: smaller text, and a long prompt scrolls from its
   start instead of being clipped at both ends (auto margins centre it when it fits) */
.result-grid-4 .result-prompt-card {
  align-items: flex-start;
  overflow-y: auto;
  padding: 10px 12px;
}

.result-grid-4 .result-prompt-card p {
  margin: auto 0;
  font-size: 12.5px;
  line-height: 1.4;
}

.result-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  background: repeating-linear-gradient(
    -45deg, transparent 0 9px, rgba(24, 33, 39, 0.05) 9px 18px
  );
}

.result-placeholder span {
  padding: 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 12px;
  text-align: center;
  opacity: 0.7;
}

.result-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 11px 0 13px;
  border-top: 1px solid var(--grey);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
}

.result-chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--ink);
  border-bottom: 1.5px solid var(--ink);
  transform: rotate(-45deg);
  transition: transform 200ms ease;
}

.result[open] .result-chevron {
  transform: rotate(45deg);
}

.result-toggle-count {
  margin-left: auto;
  color: var(--blue);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.result-summary:hover .result-toggle-text {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.result-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 28px;
  padding: 6px 16px 20px;
}

.result-detail-title {
  margin: 0 0 10px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 13px;
  font-weight: 400;
}

.result-keyframe-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-keyframe {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--blue);
  border-radius: 2px;
  background: var(--paper);
  box-shadow: 0 6px 15px rgba(24, 33, 39, 0.12);
}

.result-keyframe img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.result-keyframe figcaption {
  padding: 5px 7px;
  border-top: 1px solid var(--blue);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.result-keyframe-note {
  opacity: 0.6;
}

.result-expanded p {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 14px;
  line-height: 1.55;
}

@media (max-width: 900px) {
  .results,
  .abstract {
    width: min(100% - 80px, 1080px);
  }

  .result-detail {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-header {
    padding: 18px 16px 16px;
  }

  .abstract {
    width: min(100% - 32px, 1080px);
  }

  .chart-row {
    grid-template-columns: minmax(110px, 140px) minmax(0, 1fr);
    gap: 8px;
    font-size: 12px;
  }

  .results {
    width: min(100% - 32px, 1080px);
  }

  .results-head {
    display: none;
  }

  .result-grid,
  .result-grid-4 {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .result-cell::before {
    display: block;
    margin-bottom: 5px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 12px;
    content: attr(data-label);
  }

  .result-cell:nth-child(2)::before {
    color: var(--blue);
  }

  .result-keyframe-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* narrow screens: the buttons drop under the title and authors */
@media (max-width: 680px) {
  .site-header {
    flex-direction: column;
    gap: 16px;
    padding: 22px 16px 20px;
  }
}
