:root {
  --ink: #18212b;
  --muted: #5e6a76;
  --soft-ink: #7c8793;
  --paper: #ffffff;
  --page: #f4f6f8;
  --tint: #eef4f9;
  --line: #dce2e8;
  --line-strong: #cbd4dd;
  --blue-dark: #1f629b;
  --blue-soft: #e6f2fb;
  --green: #4f7e34;
  --shadow-small: 0 8px 24px rgba(24, 33, 43, 0.06);
  --radius-large: 20px;
  --radius-medium: 14px;
  --radius-small: 9px;
  --page-width: 1180px;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}

body.modal-open {
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(47, 131, 203, 0.48);
  outline-offset: 3px;
}

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

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 9px 13px;
  color: var(--paper);
  background: var(--ink);
  border-radius: var(--radius-small);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.page-shell {
  width: min(calc(100% - 44px), var(--page-width));
  margin-inline: auto;
}

.site-header {
  color: var(--ink);
  background: var(--paper);
}

.site-header__inner {
  padding-block: 68px 52px;
  text-align: center;
}

.eyebrow,
.media-modal__eyebrow {
  margin: 0 0 9px;
  color: var(--blue-dark);
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-header .eyebrow {
  color: var(--muted);
}

.site-header h1 {
  max-width: 1080px;
  margin: 0 auto;
  font-family: var(--font-sans);
  font-size: clamp(2.35rem, 5vw, 4.15rem);
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1.07;
}

.paper-authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 22px;
  max-width: 920px;
  margin: 25px auto 0;
  font-size: clamp(1rem, 1.6vw, 1.17rem);
  line-height: 1.45;
}

.paper-authors a {
  color: var(--blue-dark);
  font-weight: 650;
  text-decoration: none;
}

.paper-authors a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.paper-authors sup,
.paper-affiliations sup {
  margin-left: 0.12em;
  font-size: 0.68em;
  line-height: 0;
  vertical-align: super;
}

.paper-affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 22px;
  max-width: 960px;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 28px auto 0;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 8px 17px 8px 9px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 7px 18px rgba(24, 33, 43, 0.12);
  font-size: 0.9rem;
  font-weight: 720;
  line-height: 1;
  text-decoration: none;
  transition: background 160ms ease, border-color 160ms ease,
    box-shadow 160ms ease, transform 160ms ease;
}

.project-link:hover {
  color: var(--paper);
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  box-shadow: 0 10px 24px rgba(31, 98, 155, 0.2);
  transform: translateY(-1px);
}

.project-link > i {
  width: 1.1em;
  font-size: 1.08rem;
  text-align: center;
}

.project-link__brand-icon {
  width: 1.1em;
  height: 1.1em;
  flex: 0 0 auto;
  filter: brightness(0) invert(1);
}

.project-link__hugging-face {
  width: 1.1em;
  font-size: 1.08rem;
  line-height: 1;
  text-align: center;
}

.hero-tldr {
  max-width: 820px;
  margin: 22px auto 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.13rem);
  line-height: 1.68;
}

.hero-tldr strong {
  color: var(--ink);
  font-weight: 750;
}

.section-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: none;
  backdrop-filter: blur(12px);
}

.section-nav__inner {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-block: 10px;
  scrollbar-width: none;
}

.section-nav__inner::-webkit-scrollbar {
  display: none;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 7px 11px;
  color: #485460;
  border-radius: 999px;
  font-size: 0.83rem;
  font-weight: 650;
  text-decoration: none;
}

.section-nav a:hover {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.section {
  padding-block: 78px;
  background: var(--paper);
  scroll-margin-top: 70px;
}

.section--overview {
  padding-top: 48px;
}

.section--tinted {
  background: var(--tint);
  border-block: 1px solid #e2ebf2;
}

.section-heading {
  max-width: 790px;
  margin-bottom: 31px;
}

.section-heading--compact {
  margin-bottom: 25px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3.6vw, 2.85rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.12;
}

.section-heading > p:last-child {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.teaser-card {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.figure-trigger {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: zoom-in;
}

.figure-trigger img {
  width: 100%;
  height: auto;
}

.figure-trigger__hint {
  position: absolute;
  right: 13px;
  bottom: 13px;
  padding: 7px 11px;
  color: var(--paper);
  background: rgba(24, 33, 43, 0.82);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.figure-trigger:hover .figure-trigger__hint,
.figure-trigger:focus-visible .figure-trigger__hint {
  opacity: 1;
  transform: translateY(0);
}

.teaser-card figcaption {
  padding: 15px 2px 0;
  color: #4f5a65;
  font-size: 0.92rem;
  line-height: 1.58;
}

.chained-grid,
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.media-card,
.image-card,
.prompt-card {
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
  box-shadow: var(--shadow-small);
}

.media-card {
  padding: 13px;
}

.media-card--ours {
  border-color: rgba(47, 131, 203, 0.7);
  box-shadow: 0 12px 28px rgba(47, 131, 203, 0.12);
}

.media-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 0 2px 9px;
}

.media-card__title {
  min-width: 0;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 750;
}

.media-card__actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
}

.media-card__expand {
  min-height: 34px;
  padding: 5px 11px;
  color: var(--blue-dark);
  background: var(--paper);
  border: 1px solid rgba(47, 131, 203, 0.38);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 750;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.media-card__expand:hover {
  color: var(--paper);
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.ours-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  border: 1px solid rgba(47, 131, 203, 0.32);
  border-radius: 999px;
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.media-card__description {
  margin: 11px 2px 1px;
  color: var(--muted);
  font-size: 0.86rem;
}

.video-shell,
.image-shell {
  position: relative;
  display: grid;
  width: 100%;
  overflow: hidden;
  background: #101820;
  border: 0;
  border-radius: var(--radius-small);
  aspect-ratio: 26 / 15;
  isolation: isolate;
}

.video-shell {
  cursor: pointer;
  transition: box-shadow 140ms ease;
}

.video-shell:hover {
  box-shadow: 0 0 0 2px rgba(47, 131, 203, 0.32);
}

.video-shell video,
.image-shell img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-shell video {
  position: absolute;
  inset: 0;
  z-index: 1;
}

.video-shell__play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  display: grid;
  width: 48px;
  height: 48px;
  color: var(--paper);
  background: rgba(24, 33, 43, 0.76);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  place-items: center;
  transform: translate(-50%, -50%);
  transition: background 150ms ease, transform 150ms ease;
}

.video-shell:hover .video-shell__play {
  background: var(--blue-dark);
  transform: translate(-50%, -50%) scale(1.06);
}

.media-status {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 18px;
  color: #dce8f2;
  background:
    linear-gradient(135deg, rgba(47, 131, 203, 0.14), rgba(201, 91, 11, 0.09)),
    #17222d;
  text-align: center;
}

.media-status__label {
  font-size: 0.88rem;
}

.media-status__path {
  max-width: 100%;
  padding: 5px 7px;
  overflow-wrap: anywhere;
  color: #abc1d3;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.case-selector {
  margin-bottom: 25px;
}

.case-selector .tabs,
.tabs--cases {
  margin-bottom: 0;
}

.tab {
  padding: 8px 13px;
  color: #4a5661;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, border-color 140ms ease;
}

.tab:hover {
  color: var(--blue-dark);
  border-color: rgba(47, 131, 203, 0.55);
}

.tab.is-active,
.tab[aria-selected="true"] {
  color: var(--paper);
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.prompt-card {
  padding: 14px 15px;
}

.input-card__label {
  margin: 0 0 7px;
  color: var(--soft-ink);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt-card__text {
  margin: 0;
  color: #2d3944;
  font-size: 0.91rem;
  font-weight: 590;
}

.prompt-card__text::before {
  content: "“";
  color: var(--green);
  font-family: var(--font-serif);
  font-size: 1.2em;
}

.prompt-card__text::after {
  content: "”";
  color: var(--green);
  font-family: var(--font-serif);
  font-size: 1.2em;
}

.shared-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, 0.56fr) minmax(280px, 1.15fr);
  gap: 14px;
  align-items: stretch;
}

.shared-inputs .media-card,
.shared-inputs .image-card,
.shared-inputs .prompt-card,
.fixed-conditions .media-card,
.fixed-conditions .image-card,
.fixed-conditions .prompt-card {
  box-shadow: none;
}

.media-card--compact {
  padding: 10px;
}

.image-card {
  padding: 10px;
}

.image-shell {
  cursor: zoom-in;
}

.image-shell img {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #101820;
}

.result-divider {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-block: 27px 19px;
}

.result-divider__line {
  height: 1px;
  background: var(--line);
}

.result-divider__label,
.fixed-conditions__label,
.variable-block__label {
  color: var(--soft-ink);
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.fixed-conditions {
  padding: 16px;
  background: var(--page);
  border: 1px solid var(--line);
  border-radius: var(--radius-medium);
}

.fixed-conditions__label,
.variable-block__label {
  display: block;
  margin: 0 0 9px;
}

.fixed-conditions__grid {
  display: grid;
  gap: 12px;
}

.fixed-conditions__grid--frame-prompt {
  grid-template-columns: minmax(210px, 0.72fr) minmax(280px, 1.28fr);
}

.variable-block {
  margin-top: 21px;
  padding: 15px;
  background: linear-gradient(135deg, #f4f9fd, #ffffff);
  border: 1px solid rgba(47, 131, 203, 0.32);
  border-radius: var(--radius-medium);
}

.variable-block .tabs {
  margin-bottom: 0;
}

.tabs--variants .tab {
  min-height: 39px;
  padding: 9px 15px;
  background: var(--paper);
  box-shadow: 0 3px 10px rgba(24, 33, 43, 0.04);
}

.tabs--variants .tab.is-active,
.tabs--variants .tab[aria-selected="true"] {
  background: var(--blue-dark);
}

.paired-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 15px;
  margin-top: 17px;
}

.paired-result__arrow {
  display: grid;
  width: 40px;
  height: 40px;
  color: var(--paper);
  background: var(--blue-dark);
  border-radius: 50%;
  place-items: center;
  font-size: 1.25rem;
  font-weight: 800;
}

.site-footer {
  padding-block: 42px;
  color: #c7d0d8;
  background: #18212b;
}

.site-footer__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
}

.site-footer p {
  margin: 0;
  font-size: 0.84rem;
}

.site-footer a {
  color: #d7ebfa;
  font-size: 0.82rem;
  font-weight: 750;
}

.media-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  padding: 28px;
  place-items: center;
}

.media-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 11, 15, 0.9);
  backdrop-filter: blur(10px);
}

.media-modal__panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(96vw, 1480px);
  max-height: 94vh;
  overflow: hidden;
  color: var(--paper);
  background: #101820;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-large);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
}

.media-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 18px;
  background: #18232e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.media-modal__header h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.28rem;
  font-weight: 600;
}

.media-modal__header p:last-child {
  max-width: 780px;
  margin: 4px 0 0;
  color: #b7c3ce;
  font-size: 0.78rem;
}

.media-modal__eyebrow {
  margin-bottom: 2px;
  color: #82bee9;
  font-size: 0.62rem;
}

.icon-button {
  display: grid;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--paper);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  cursor: pointer;
  place-items: center;
}

.icon-button span {
  font-size: 1.5rem;
  line-height: 1;
}

.media-modal__content {
  position: relative;
  display: grid;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  aspect-ratio: 26 / 15;
}

.media-modal__content video,
.media-modal__content img {
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;
}

.missing-media--modal {
  padding: 30px;
  color: #c6d5e1;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: center;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .shared-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shared-inputs .prompt-card {
    grid-column: 1 / -1;
  }

  .fixed-conditions__grid--frame-prompt {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(calc(100% - 28px), var(--page-width));
  }

  .site-header__inner {
    padding-block: 50px 40px;
  }

  .project-links {
    gap: 8px;
    margin-top: 23px;
  }

  .project-link {
    min-height: 42px;
    padding-right: 14px;
    font-size: 0.84rem;
  }

  .section {
    padding-block: 58px;
  }

  .chained-grid,
  .comparison-grid,
  .shared-inputs,
  .fixed-conditions__grid--frame-prompt {
    grid-template-columns: 1fr;
  }

  .shared-inputs .prompt-card {
    grid-column: auto;
  }

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

  .paired-result__arrow {
    margin-inline: auto;
    transform: rotate(90deg);
  }

  .site-footer__inner {
    grid-template-columns: 1fr;
  }

  .media-modal {
    padding: 10px;
  }

  .media-modal__panel {
    width: 100%;
    max-height: 96vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  .section-nav,
  .video-shell__play,
  .figure-trigger__hint,
  .media-modal {
    display: none !important;
  }

  body,
  .section,
  .section--tinted {
    background: #fff;
  }

  .section {
    break-inside: avoid;
  }
}
