:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #5f6368;
  --line: #d9d9d9;
  --soft: #f7f7f7;
  --accent: #1f4e79;
  --accent-soft: #eef4f8;
  --max: 980px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.62;
}

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
.table-wrap:focus-visible,
.demo-sample:focus-visible,
.gallery-thumb:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; }
h1, h2, h3, p { overflow-wrap: break-word; }

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.nav {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  color: var(--ink);
  font-weight: 700;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.95rem;
}

.nav-links a { color: var(--muted); }
.nav-links a:hover { color: var(--ink); }
.nav-toggle { display: none; }

.hero {
  padding: 4.25rem 0 3rem;
  text-align: center;
}

.venue {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
}

h1 {
  margin: 0;
  font-size: 4rem;
  line-height: 1.02;
  letter-spacing: 0;
}

.subtitle {
  max-width: 760px;
  margin: 0.9rem auto 0;
  font-size: 1.65rem;
  line-height: 1.28;
}

.authors {
  margin: 1.4rem 0 0.25rem;
  font-size: 1.05rem;
}

.affiliation {
  margin: 0;
  color: var(--muted);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.55rem;
  margin: 1.75rem 0 2.1rem;
}

.link-row a,
.zoom-button,
.copy-button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.link-row a:hover,
.zoom-button:hover,
.copy-button:hover {
  border-color: #9e9e9e;
  text-decoration: none;
}

.teaser,
.split figure,
.query-panel,
.zoom-panel,
.gallery figure,
.table-wrap,
.code-card {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.teaser {
  margin: 0 auto;
  padding: 1rem;
  background: white;
  text-align: left;
}

.method-teaser {
  width: min(1240px, calc(100vw - 32px));
  margin-left: 50%;
  padding: 0.6rem 0.2rem 0;
  border: 0;
  transform: translateX(-50%);
}

.teaser-grid {
  display: grid;
  grid-template-columns: minmax(230px, 0.62fr) 2.4rem minmax(620px, 2fr);
  gap: 0.8rem;
  align-items: center;
}

.teaser-query {
  position: relative;
  display: grid;
  grid-template-rows: 1fr auto;
  align-self: center;
  justify-self: center;
  width: 100%;
  background: white;
  opacity: 0;
  transform: translateY(6px);
  animation: teaser-reveal 520ms ease forwards;
}

.zoom-tile {
  position: relative;
  background: white;
  opacity: 0;
  transform: translateY(8px);
  animation: teaser-reveal 520ms ease forwards;
}

.teaser-query img,
.zoom-tile img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.teaser-query {
  aspect-ratio: auto;
}

.teaser-zooms {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.35rem;
}

.zoom-tile {
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: visible;
  padding: 0;
}

.zoom-tile:nth-child(1) { animation-delay: 280ms; }
.zoom-tile:nth-child(2) { animation-delay: 560ms; }
.zoom-tile:nth-child(3) { animation-delay: 840ms; }
.zoom-tile:nth-child(4) { animation-delay: 1120ms; }

.zoom-tile:not(:last-child)::before,
.zoom-tile:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  right: -1.08rem;
  top: calc((100% - 3rem) / 2);
  background: #6f7b84;
  pointer-events: none;
}

.zoom-tile:not(:last-child)::before {
  width: 0.8rem;
  height: 1px;
}

.zoom-tile:not(:last-child)::after {
  width: 0.34rem;
  height: 0.34rem;
  margin-top: -0.17rem;
  border-top: 1px solid #6f7b84;
  border-right: 1px solid #6f7b84;
  background: transparent;
  transform: rotate(45deg);
}

.zoom-tile.final {
  outline: 0;
}

.teaser-label {
  display: grid;
  gap: 0.18rem;
  min-height: 3rem;
  padding: 0.48rem 0 0;
  background: white;
  color: var(--muted);
  line-height: 1.1;
  text-align: center;
}

.teaser-label strong {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.teaser-label small {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
}

.teaser-flow {
  position: relative;
  display: flex;
  width: 3.2rem;
  height: 100%;
  min-height: 8rem;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-transform: uppercase;
}

.teaser-flow span {
  display: none;
}

.teaser-flow::before,
.teaser-flow::after {
  content: "";
  position: absolute;
  left: 0.2rem;
  right: 0.2rem;
  top: calc((100% - 3rem) / 2);
  height: 1px;
  background: #6f7b84;
}

.teaser-flow::after {
  left: auto;
  right: 0.2rem;
  top: calc((100% - 3rem) / 2 - 0.24rem);
  width: 0.48rem;
  height: 0.48rem;
  border-top: 1px solid #6f7b84;
  border-right: 1px solid #6f7b84;
  background: transparent;
  transform: rotate(45deg);
}

@keyframes teaser-reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

figcaption {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: 0.92rem;
}

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

.section h2 {
  margin: 0 0 1.15rem;
  font-size: 2rem;
  line-height: 1.18;
  letter-spacing: 0;
}

.section p { max-width: 850px; }

.split {
  display: grid;
  grid-template-columns: 0.92fr 1.08fr;
  gap: 2rem;
  align-items: start;
}

.split figure {
  margin: 0;
  padding: 1rem;
  background: var(--soft);
}

.method-steps {
  display: grid;
  gap: 0.55rem;
  margin: 1.35rem 0 0;
  padding: 0;
  list-style: none;
}

.method-steps li {
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.65rem;
  align-items: start;
  color: var(--muted);
  font-size: 0.95rem;
}

.method-steps .step-index {
  display: inline-grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.method-steps strong {
  display: inline-block;
  min-width: 7.3rem;
  color: var(--ink);
}

.formula {
  margin: 1.2rem 0 0;
  padding: 0.9rem;
  overflow-x: auto;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
}

.zoom-demo {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.1rem;
  align-items: stretch;
  margin-top: 1.3rem;
}

.query-panel,
.zoom-panel {
  background: var(--soft);
  padding: 1rem;
}

.query-panel img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
}

.panel-label {
  margin: 0.75rem 0 0;
  font-weight: 650;
}

.zoom-stage {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  background: white;
  border-radius: 6px;
  overflow: hidden;
}

.zoom-stage img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1);
  transform-origin: center center;
  will-change: opacity, transform;
}

#zoom-image-next {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: scale(1);
  pointer-events: none;
}

.zoom-stage.is-zooming #zoom-image {
  animation: zoom-current-forward 720ms ease-in-out forwards;
}

#zoom-image-next.is-visible {
  animation: zoom-next-arrive 720ms ease-in-out forwards;
}

@keyframes zoom-current-forward {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@keyframes zoom-next-arrive {
  0% {
    opacity: 0;
    transform: scale(1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.gt-legend {
  position: absolute;
  left: 0.65rem;
  bottom: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.32rem 0.5rem;
  border: 1px solid rgba(17, 17, 17, 0.16);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

.gt-legend span {
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid white;
  border-radius: 50%;
  background: #ff170f;
  box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.35);
}

.cell-overlay {
  position: absolute;
  border: 3px solid #1f4e79;
  box-shadow: 0 0 0 999px rgba(255, 255, 255, 0.12);
  pointer-events: none;
  opacity: 0.42;
  transition: inset 240ms ease, opacity 180ms ease;
}

.zoom-panel[data-level="1"] .cell-overlay { inset: 31.5% 40.5% 50% 43.5%; }
.zoom-panel[data-level="2"] .cell-overlay { inset: 32% 31% 39% 37%; }
.zoom-panel[data-level="3"] .cell-overlay { inset: 43% 41% 28% 30%; }
.zoom-panel[data-level="4"] .cell-overlay {
  inset: 45% 45% 38% 37%;
  opacity: 0.6;
}

.zoom-timeline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0.9rem 0 0;
}

.zoom-step {
  display: grid;
  gap: 0.35rem;
  align-content: start;
  min-height: 4.2rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.25;
  text-align: left;
}

.zoom-step:hover {
  border-color: #9e9e9e;
}

.zoom-step span {
  display: inline-grid;
  width: 1.45rem;
  height: 1.45rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 700;
}

.zoom-step.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}

.zoom-step.is-active span {
  border-color: var(--accent);
  background: white;
}

.zoom-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
  justify-content: flex-end;
}

.zoom-button.is-active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}

.zoom-caption {
  margin: 0.75rem 0 0;
  color: var(--muted);
}

.demo-samples {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.demo-sample {
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.demo-sample:hover {
  border-color: #9e9e9e;
}

.demo-sample img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  background: #e9e9e9;
}

.demo-sample span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.demo-sample.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.demo-sample.is-active span {
  color: var(--ink);
  font-weight: 700;
}

.gallery {
  display: grid;
  gap: 0.8rem;
  margin-top: 1.3rem;
}

.gallery-viewer {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.gallery-viewer img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #e9e9e9;
}

.gallery-viewer figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-weight: 650;
}

#gallery-count {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}

.gallery-controls {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.gallery-nav,
.gallery-thumb {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: white;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}

.gallery-nav {
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  font-weight: 600;
}

.gallery-nav:hover,
.gallery-thumb:hover {
  border-color: #9e9e9e;
}

.gallery-thumbs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.65rem;
}

.gallery-thumb {
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem;
  text-align: left;
}

.gallery-thumb img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 4px;
  background: #e9e9e9;
}

.gallery-thumb span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gallery-thumb.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.gallery-thumb.is-active span {
  color: var(--ink);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1.1rem;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
  background: var(--soft);
}

tbody tr:last-child td { border-bottom: 0; }
.best td {
  background: var(--accent-soft);
  font-weight: 700;
}

.code-card {
  position: relative;
  background: var(--soft);
  padding: 1rem;
}

.copy-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  font-size: 0.88rem;
}

.code-card pre {
  margin: 0;
  padding-right: 4.5rem;
  overflow-x: auto;
  font-size: 0.9rem;
}

.footer {
  padding: 1.5rem 0 2.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .zoom-stage img,
  .cell-overlay {
    transition: none;
  }
  .teaser-query,
  .zoom-tile {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

@media (max-width: 760px) {
  .wrap { width: min(100% - 32px, var(--max)); }

  .nav {
    align-items: flex-start;
    padding: 0.75rem 0;
  }

  .nav-toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    padding: 0.35rem 0.7rem;
    font-weight: 600;
  }

  .nav-links {
    display: none;
    position: absolute;
    left: 16px;
    right: 16px;
    top: 58px;
    background: white;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.8rem;
    flex-direction: column;
  }

  .nav-links.open { display: flex; }

  .hero { padding-top: 3.2rem; }
  h1 { font-size: 2.75rem; }
  .subtitle { font-size: 1.3rem; }
  .section { padding: 3rem 0; }
  .section h2 { font-size: 1.65rem; }

  .split,
  .zoom-demo,
  .gallery {
    grid-template-columns: 1fr;
  }

  .teaser-grid {
    grid-template-columns: 1fr;
  }

  .teaser-flow {
    width: 100%;
    min-height: 2rem;
    height: auto;
    align-items: center;
  }

  .teaser-flow span {
    display: inline;
  }

  .teaser-flow::before,
  .teaser-flow::after {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: auto;
  }

  .teaser-flow::after {
    left: auto;
    right: 0;
    top: auto;
    bottom: -0.23rem;
    width: 0.48rem;
    height: 0.48rem;
    border-top: 1px solid #6f7b84;
    border-right: 1px solid #6f7b84;
    background: transparent;
    transform: rotate(45deg);
  }

  .method-steps strong {
    display: block;
    min-width: 0;
  }

  .zoom-timeline {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-thumbs {
    grid-template-columns: repeat(3, 1fr);
  }

  .demo-samples {
    grid-template-columns: repeat(5, 1fr);
  }

  .zoom-button.secondary { margin-left: 0; }
}

@media (max-width: 460px) {
  h1 { font-size: 2.35rem; }
  .subtitle { font-size: 1.12rem; }
  .link-row a,
  .zoom-button {
    width: 100%;
    justify-content: center;
    text-align: center;
  }
  .zoom-timeline {
    grid-template-columns: 1fr;
  }
  .teaser-zooms {
    grid-template-columns: 1fr;
  }
  .zoom-tile:not(:last-child)::before,
  .zoom-tile:not(:last-child)::after {
    content: none;
  }
  .gallery-controls {
    justify-content: stretch;
  }
  .gallery-nav {
    flex: 1;
  }
  .gallery-thumbs {
    grid-template-columns: repeat(2, 1fr);
  }
  .demo-samples {
    grid-template-columns: repeat(2, 1fr);
  }
  .code-card pre {
    padding-right: 0;
    padding-top: 2.6rem;
  }
}
