:root {
  --text: #222;
  --muted: #666;
  --line: #e5e5e5;
  --light: #f7f7f7;
  --blue: #3273dc;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: #fff;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

.container {
  width: min(100% - 40px, 1040px);
  margin: 0 auto;
}

.container.narrow {
  max-width: 820px;
}

.publication-header {
  padding: 64px 0 30px;
  text-align: center;
}

h1 {
  max-width: 980px;
  margin: 0 auto 14px;
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.venue {
  margin: 0 0 16px;
  font-size: 22px;
  font-style: italic;
}

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 14px;
  margin: 0 auto 8px;
  font-size: 19px;
}

sup {
  font-size: 0.65em;
}

.affiliations {
  margin: 4px auto;
  font-size: 16px;
}

.note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.publication-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  color: #fff;
  background: #363636;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 600;
}

.button:hover {
  color: #fff;
  background: #222;
  text-decoration: none;
}

.teaser-section {
  padding: 20px 0 42px;
  text-align: center;
}

.teaser {
  width: 100%;
  border-radius: 5px;
}

.teaser-caption {
  max-width: 800px;
  margin: 18px auto 0;
  font-size: 20px;
  line-height: 1.45;
}

.section {
  padding: 54px 0;
  border-top: 1px solid var(--line);
}

h2 {
  margin: 0 0 22px;
  text-align: center;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.25;
}

.content p {
  margin: 0 0 16px;
}

.justified {
  text-align: justify;
}

.section-lead {
  max-width: 820px;
  margin: -8px auto 26px;
  text-align: center;
}

.method-image {
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.video-frame {
  width: min(100%, 960px);
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  overflow: hidden;
  background: #111;
  border-radius: 5px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 0.1);
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.comparison-section {
  background: #fff;
}

[hidden] {
  display: none !important;
}

.scene-gallery {
  width: min(100%, 960px);
  margin: 0 auto;
}

.exposure-stage {
  position: relative;
}

.exposure-stage-button {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 5 / 3;
  padding: 0;
  overflow: hidden;
  background: #e9e9e9;
  border: 1px solid #d5d5d5;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 14px 34px rgb(0 0 0 / 0.08);
}

.exposure-image-stack,
.exposure-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.exposure-layer {
  object-fit: cover;
  opacity: 0;
  transform: scale(1.012);
  transition:
    opacity 620ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 900ms cubic-bezier(0.22, 1, 0.36, 1);
}

.exposure-layer.active {
  z-index: 1;
  opacity: 1;
  transform: scale(1);
}

.exposure-scan {
  position: absolute;
  z-index: 2;
  inset: 0 auto 0 -18%;
  width: 16%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.2), transparent);
  opacity: 0;
  pointer-events: none;
}

.exposure-stage-button:hover .exposure-scan,
.exposure-stage-button:focus-visible .exposure-scan {
  animation: exposure-scan 900ms ease-out both;
}

@keyframes exposure-scan {
  0% {
    left: -18%;
    opacity: 0;
  }
  28% {
    opacity: 1;
  }
  100% {
    left: 102%;
    opacity: 0;
  }
}

.exposure-view-label {
  position: absolute;
  z-index: 3;
  top: 14px;
  left: 14px;
  padding: 5px 10px;
  color: #fff;
  background: rgb(0 0 0 / 0.58);
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.3;
  pointer-events: none;
}

.stage-open {
  position: absolute;
  z-index: 3;
  top: auto;
  right: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: #222;
  background: rgb(255 255 255 / 0.92);
  border: 1px solid rgb(255 255 255 / 0.7);
  border-radius: 4px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 0.13);
  font-size: 12px;
  line-height: 1;
  opacity: 0.9;
  pointer-events: none;
  transform: translateY(0);
  transition:
    opacity 260ms ease,
    transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.stage-open strong {
  font-size: 15px;
  font-weight: 400;
}

.exposure-stage-button:hover .stage-open,
.exposure-stage-button:focus-visible .stage-open {
  opacity: 1;
  transform: translateY(-2px);
}

.exposure-controls {
  position: relative;
  z-index: 4;
  display: flex;
  width: max-content;
  margin: -19px auto 0;
  padding: 4px;
  background: #fff;
  border: 1px solid #d5d5d5;
  border-radius: 5px;
  box-shadow: 0 5px 18px rgb(0 0 0 / 0.12);
}

.exposure-button {
  min-width: 80px;
  padding: 6px 12px;
  color: #555;
  background: transparent;
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.exposure-button.active {
  color: #fff;
  background: #333;
}

.scene-browser-hint {
  margin: 24px 0 10px;
  color: #555;
  font-size: 13px;
  text-align: center;
}

.scene-browser-hint span {
  display: inline-grid;
  width: 21px;
  height: 21px;
  margin-right: 5px;
  place-items: center;
  color: #fff;
  background: #333;
  border-radius: 50%;
}

.scene-browser-hint strong {
  color: #222;
}

.scene-filmstrip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 9px;
  margin-top: 0;
}

.scene-thumbnail {
  position: relative;
  aspect-ratio: 5 / 3;
  padding: 0;
  overflow: hidden;
  background: #eee;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0.68;
  transition:
    border-color 260ms ease,
    opacity 260ms ease,
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.scene-thumbnail::after {
  position: absolute;
  z-index: 2;
  top: 6px;
  right: 6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  color: #222;
  background: rgb(255 255 255 / 0.92);
  border-radius: 50%;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.16);
  content: "↗";
  font-size: 12px;
  line-height: 1;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.scene-thumbnail:hover,
.scene-thumbnail:focus-visible,
.scene-thumbnail.active {
  border-color: #333;
  opacity: 1;
  outline: none;
  transform: translateY(-3px);
}

.thumbnail-triptych,
.thumbnail-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.thumbnail-layer {
  object-fit: cover;
  transition:
    clip-path 560ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 360ms ease;
}

.thumbnail-under {
  clip-path: inset(0 66.666% 0 0);
}

.thumbnail-ours {
  z-index: 1;
  clip-path: inset(0 33.333% 0 33.333%);
}

.thumbnail-over {
  clip-path: inset(0 0 0 66.666%);
}

.scene-thumbnail.active .thumbnail-under,
.scene-thumbnail.active .thumbnail-over {
  opacity: 0;
}

.scene-thumbnail.active .thumbnail-ours {
  clip-path: inset(0);
}

.thumbnail-open-cue {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 10px;
  color: #fff;
  background: rgb(0 0 0 / 0.58);
  font-size: 12px;
  line-height: 1.2;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.96);
  transition:
    opacity 220ms ease,
    transform 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.thumbnail-open-cue strong {
  padding: 5px 8px;
  background: #fff;
  border-radius: 3px;
  color: #222;
  font-size: 12px;
  font-weight: 600;
}

.thumbnail-open-cue small {
  margin-top: 6px;
  color: rgb(255 255 255 / 0.9);
  font-size: 9px;
}

.scene-thumbnail:hover .thumbnail-open-cue,
.scene-thumbnail:focus-visible .thumbnail-open-cue {
  opacity: 1;
  transform: scale(1);
}

.scene-thumbnail:hover::after,
.scene-thumbnail:focus-visible::after {
  opacity: 0;
}

.result-lightbox {
  position: fixed;
  z-index: 1000;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 28px;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  padding: 0;
  background: rgb(0 0 0 / 0.72);
  border: 0;
  cursor: pointer;
}

.lightbox-panel {
  position: relative;
  width: min(1180px, 100%);
  max-height: calc(100vh - 56px);
  padding: 26px 30px 34px;
  overflow-y: auto;
  background: #fff;
  border-radius: 5px;
}

.lightbox-close {
  position: absolute;
  z-index: 2;
  top: 8px;
  right: 12px;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #444;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 30px;
  line-height: 1;
}

.lightbox-header {
  padding-right: 34px;
  text-align: center;
}

.lightbox-header h3 {
  margin: 0;
  font-size: 26px;
  line-height: 1.25;
}

.lightbox-header p {
  margin: 4px 0 18px;
  color: var(--muted);
}

.full-result {
  text-align: center;
}

.full-image-frame {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.full-image-frame img {
  width: auto;
  max-width: 100%;
  max-height: 62vh;
  border: 1px solid var(--line);
}

.region-box {
  position: absolute;
  border: 3px solid #e22;
  pointer-events: none;
}

.full-switches,
.region-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.full-switches {
  margin-top: 12px;
}

.view-button,
.region-button {
  padding: 6px 13px;
  color: #333;
  background: #fff;
  border: 1px solid #bbb;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}

.view-button.active,
.region-button.active {
  color: #fff;
  background: #363636;
  border-color: #363636;
}

.patch-section {
  max-width: 820px;
  margin: 32px auto 0;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.patch-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  margin-bottom: 16px;
}

.patch-heading h4 {
  margin: 0;
  font-size: 20px;
}

.patch-heading p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.patch-compare {
  position: relative;
  width: min(360px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  overflow: hidden;
  background: #eee;
  border: 1px solid #ccc;
}

.patch-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.patch-ours {
  clip-path: inset(0 50% 0 0);
}

.patch-label {
  position: absolute;
  z-index: 2;
  bottom: 8px;
  padding: 3px 7px;
  color: #fff;
  background: rgb(0 0 0 / 0.64);
  border-radius: 3px;
  font-size: 12px;
  line-height: 1.3;
}

.patch-label-left {
  left: 8px;
}

.patch-label-right {
  right: 8px;
}

.patch-divider {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(0 0 0 / 0.25);
  pointer-events: none;
}

.patch-slider-label {
  display: block;
  width: min(360px, 100%);
  margin: 12px auto 18px;
}

.patch-slider-label input {
  width: 100%;
}

.patch-methods {
  display: flex;
  gap: 10px;
  padding: 2px 2px 8px;
  overflow-x: auto;
}

.patch-method-button {
  flex: 0 0 84px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}

.patch-method-button img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border: 2px solid #ccc;
  border-radius: 3px;
}

.patch-method-button.active img {
  border-color: var(--blue);
}

.patch-method-button span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

pre {
  margin: 0;
  padding: 20px;
  overflow-x: auto;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.55;
}

footer {
  padding: 30px 0 44px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

@media (max-width: 640px) {
  .publication-header {
    padding-top: 42px;
  }

  h1 {
    font-size: 34px;
  }

  .venue {
    font-size: 18px;
  }

  .authors {
    font-size: 16px;
  }

  .affiliations {
    font-size: 14px;
  }

  .teaser-caption {
    font-size: 17px;
  }

  .section {
    padding: 42px 0;
  }

  .justified {
    text-align: left;
  }

  .result-lightbox {
    padding: 0;
  }

  .lightbox-panel {
    width: 100%;
    max-height: 100vh;
    min-height: 100vh;
    padding: 22px 16px 30px;
    border-radius: 0;
  }

  .lightbox-header h3 {
    font-size: 22px;
  }

  .patch-heading {
    align-items: start;
    flex-direction: column;
  }

  .region-tabs {
    justify-content: flex-start;
  }

}

@media (hover: none), (max-width: 760px) {
  .exposure-stage-button {
    aspect-ratio: 5 / 3;
  }

  .exposure-controls {
    margin-top: -15px;
  }

  .exposure-button {
    min-width: 68px;
    padding-inline: 9px;
  }

  .scene-filmstrip {
    display: grid;
    grid-auto-columns: min(36vw, 180px);
    grid-auto-flow: column;
    grid-template-columns: none;
    gap: 8px;
    margin-top: 0;
    padding: 3px 2px 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
  }

  .scene-thumbnail {
    scroll-snap-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .exposure-layer,
  .scene-thumbnail,
  .thumbnail-layer {
    transition-duration: 0.01ms;
  }

  .exposure-scan {
    display: none;
  }
}
