:root {
  color-scheme: light;
  --ink: #172330;
  --muted: #657484;
  --line: #dde7f0;
  --paper: #edf4ff;
  --hero-paper: #fbfdff;
  --panel: rgba(255,255,255,.92);
  --sage: #8fb7d8;
  --moss: #4f72e8;
  --clay: #d7906d;
  --blue: #5a7ff0;
  --shadow: 0 14px 34px rgba(57,78,114,.11);
  --soft-shadow: 0 8px 24px rgba(57,78,114,.08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 0 140px, rgba(115,153,255,.22), transparent 280px),
    var(--paper);
}
a { color: inherit; text-decoration: none; }

.hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfdff 0%, #f7fbff 64%, #eef5ff 100%);
}
.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(1180px, calc(100% - 40px));
  min-height: 54px;
  margin: 14px auto 0;
  padding: 0 16px;
  border: 1px solid rgba(221,231,240,.82);
  border-radius: 12px;
  background: rgba(255,255,255,.78);
  backdrop-filter: blur(16px);
  box-shadow: var(--soft-shadow);
}
.brand {
  font-weight: 800;
  letter-spacing: 0;
  font-size: 15px;
}
.navlinks { display: flex; gap: 18px; color: var(--muted); font-size: 13px; }
.navlinks a:hover { color: var(--ink); }
.hero-copy {
  position: relative;
  z-index: 2;
  max-width: 780px;
  margin: 0 auto;
  padding: 72px clamp(24px, 5vw, 72px) 24px;
  text-align: center;
}
.eyebrow {
  margin: 0 0 14px;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--moss);
  font-size: 11px;
  font-weight: 800;
}
h1, h2, h3, p { letter-spacing: 0; }
h1 {
  margin: 0;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  font-weight: 850;
}
h1 span,
h1 small {
  display: block;
}
h1 small {
  max-width: 620px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: clamp(17px, 2.5vw, 25px);
  font-weight: 650;
  line-height: 1.28;
}
h2 {
  margin: 0;
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.1;
}
.lede {
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
  margin: 20px 0 0;
}
.hero-copy .lede { margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; justify-content: center; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.primary-link, .secondary-link, button, select, input {
  border: 1px solid var(--line);
  border-radius: 10px;
  min-height: 38px;
  padding: 0 15px;
  font: inherit;
}
.primary-link, .secondary-link {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 750;
}
.primary-link { background: var(--blue); color: white; border-color: var(--blue); box-shadow: 0 10px 20px rgba(79,114,232,.18); }
.primary-link.text-link {
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--blue);
  box-shadow: none;
}
.primary-link.text-link:hover { color: var(--ink); }
.secondary-link { background: rgba(255,255,255,.74); color: var(--ink); }
.hero-metrics {
  position: relative;
  z-index: 2;
  justify-content: center;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 0 clamp(24px, 5vw, 72px) 34px;
  color: var(--muted);
}
.hero-metrics strong { display: block; color: var(--ink); font-size: 24px; }
.hero-stage {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px clamp(20px, 4vw, 56px) 42px;
}
.hero-case {
  display: grid;
  grid-template-columns: minmax(210px, 300px) minmax(0, 1fr);
  gap: 12px;
  align-items: stretch;
  min-height: 220px;
}
.hero-source-model,
.hero-target-model {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--soft-shadow);
}
.hero-source-model {
  min-height: 220px;
  perspective: 1200px;
  cursor: pointer;
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
}
.hero-source-model img,
.hero-target-model img,
.hero-target-model model-viewer,
.hero-source-model model-viewer,
.hero-model-shell {
  width: 100%;
  height: 100%;
  min-height: 220px;
  display: block;
  background: #f4f8fc;
  object-fit: contain;
}
.hero-source-model span {
  position: absolute;
  z-index: 2;
  left: 14px;
  top: 14px;
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255,255,255,.9);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}
.hero-targets {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 270px);
  gap: 12px;
  overflow-x: auto;
  padding: 2px 4px 14px;
  cursor: grab;
  scroll-snap-type: x proximity;
  scrollbar-color: rgba(79,114,232,.32) transparent;
}
.hero-targets.dragging {
  cursor: grabbing;
  scroll-snap-type: none;
}
.hero-targets.dragging * {
  user-select: none;
  pointer-events: none;
}
.hero-target-model {
  min-height: 220px;
  perspective: 1200px;
  scroll-snap-align: start;
  cursor: pointer;
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
}
.hero-target-model:hover,
.hero-target-model:focus-within,
.hero-target-model.is-mesh,
.hero-source-model:hover,
.hero-source-model:focus-within,
.hero-source-model.is-mesh {
  border-color: rgba(46,123,95,.34);
  box-shadow: 0 16px 38px rgba(74, 101, 145, .16);
  transform: translateY(-2px);
}
.hero-flip-card {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  transform-style: preserve-3d;
  transition: transform .56s cubic-bezier(.2,.72,.18,1);
}
.hero-target-model.is-mesh .hero-flip-card,
.hero-source-model.is-mesh .hero-flip-card {
  transform: rotateY(180deg);
}
.hero-target-model.is-settling .hero-flip-card,
.hero-source-model.is-settling .hero-flip-card {
  transition-duration: .74s;
}
.hero-flip-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  backface-visibility: hidden;
  background: #f3f6f4;
}
.hero-flip-front {
  transform: rotateY(0deg);
}
.hero-flip-back {
  transform: rotateY(180deg);
}
.hero-model-shell {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.hero-model-shell.is-error {
  color: #8c5a52;
  background: #f4eeee;
}
.hero-target-empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.64);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}
.hero-target-model figcaption {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  max-height: 72px;
  overflow: hidden;
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(23,35,48,.78);
  color: white;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity .16s ease, transform .16s ease;
}
.hero-target-model:hover figcaption,
.hero-target-model:focus-within figcaption,
.hero-target-model.is-mesh figcaption {
  opacity: 1;
  transform: translateY(0);
}
.hero-target-model.is-settling figcaption {
  opacity: .92;
  transform: translateY(0);
}

.section { padding: 56px clamp(20px, 4vw, 56px); }
.intro-band {
  display: grid;
  grid-template-columns: minmax(220px, .65fr) 1.35fr;
  gap: 32px;
  align-items: start;
  background: #edf4ff;
}
.section-heading { max-width: 680px; }
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
}
.stat {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--soft-shadow);
}
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; font-size: 28px; margin-top: 7px; }

.matrix-section { padding-top: 48px; }
.matrix-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 22px;
}
.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
input, select { background: rgba(255,255,255,.9); color: var(--ink); box-shadow: var(--soft-shadow); }
#searchInput { width: min(420px, 70vw); }
.source-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(196px, 228px);
  gap: 14px;
  overflow-x: auto;
  padding: 4px 4px 22px;
  scroll-snap-type: x proximity;
}
.source-card {
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.94);
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
  box-shadow: var(--soft-shadow);
}
.source-card:hover, .source-card.active {
  transform: translateY(-2px);
  border-color: rgba(79,114,232,.42);
  box-shadow: var(--shadow);
}
.source-card img {
  display: block;
  width: 100%;
  aspect-ratio: 1.15 / 1;
  object-fit: cover;
  background: #f5f8fc;
}
.source-card-body { padding: 13px 14px 15px; }
.source-card h3 { margin: 0 0 7px; font-size: 18px; line-height: 1.15; }
.source-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pill-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef4fb;
  color: #40545d;
  font-size: 11px;
  font-weight: 750;
}

.detail-layout {
  border-top: 1px solid var(--line);
  padding-top: 26px;
  min-height: 420px;
}
.detail-head {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 24px;
  margin-bottom: 28px;
}
.source-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: white;
}
.source-compare img, .source-compare model-viewer {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 280px;
  background: #f2f5f3;
  object-fit: contain;
}
.detail-title h3 { margin: 0 0 10px; font-size: clamp(28px, 4vw, 48px); line-height: 1.02; }
.detail-title p { color: var(--muted); line-height: 1.6; max-width: 800px; }
.relation-list { display: grid; gap: 24px; }
.relation-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.relation-label {
  position: sticky;
  top: 12px;
  border-left: 3px solid var(--sage);
  padding: 8px 10px 8px 14px;
}
.relation-label h4 { margin: 0; font-size: 18px; line-height: 1.25; }
.relation-label p { color: var(--muted); margin: 10px 0 0; font-size: 13px; }
.target-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 330px);
  overflow-x: auto;
  gap: 14px;
  padding-bottom: 12px;
}
.target-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255,255,255,.92);
  box-shadow: var(--soft-shadow);
}
.target-media {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 180px;
  border-bottom: 1px solid var(--line);
}
.target-media img, .target-media model-viewer {
  width: 100%;
  aspect-ratio: 1 / 1;
  min-height: 160px;
  background: #f5f8fc;
  object-fit: contain;
}
.model-placeholder,
.image-placeholder,
.model-slot {
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 160px;
  aspect-ratio: 1 / 1;
  background: #f3f6f4;
  color: var(--muted);
  border: 0;
  border-radius: 0;
  text-align: center;
}
.model-slot {
  cursor: pointer;
  font-weight: 800;
}
.model-slot:hover,
.model-slot:focus-visible {
  color: var(--moss);
  outline: 2px solid rgba(79,114,232,.24);
  outline-offset: -2px;
}
.source-compare .model-placeholder,
.source-compare .image-placeholder {
  min-height: 280px;
}
.figure-section {
  padding-top: 24px;
}
.dataset-figure {
  margin: 22px 0 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--soft-shadow);
}
.dataset-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: white;
}
.footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 28px clamp(20px, 4vw, 56px);
  color: var(--muted);
  border-top: 1px solid var(--line);
}

@media (max-width: 980px) {
  .hero-case { grid-template-columns: 1fr; }
  .hero-targets { grid-auto-columns: minmax(220px, 70vw); }
  .hero-copy { padding-top: 46px; }
  .intro-band, .detail-head, .relation-row { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .matrix-header { align-items: start; flex-direction: column; }
  .relation-label { position: static; }
}

@media (max-width: 620px) {
  .topbar { align-items: flex-start; gap: 12px; flex-direction: column; }
  .navlinks { width: 100%; justify-content: space-between; }
  .stat-row { grid-template-columns: 1fr; }
  .hero-targets { grid-auto-columns: minmax(210px, 82vw); }
  .hero-source-model img,
  .hero-source-model model-viewer,
  .hero-target-model img,
  .hero-target-model model-viewer { min-height: 220px; }
  .source-strip { grid-auto-columns: minmax(190px, 76vw); }
  .source-compare, .target-media { grid-template-columns: 1fr; }
  .target-strip { grid-auto-columns: minmax(240px, 86vw); }
}
