:root {
  --fg: #1c1c1c;
  --muted: #5b6470;
  --accent: #2b6cb0;
  --bg: #ffffff;
  --soft-bg: #f6f7f9;
  --border: #e2e6ec;
  --border-strong: #cfd5dd;
  --viewer-bg: #f3f5f7;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: "Helvetica Neue", "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.6;
}

a { color: inherit; }

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

.container.wide {
  width: min(1120px, calc(100% - 64px));
}

.page-header {
  padding: 42px 0 52px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 34px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.back-link:hover { color: var(--fg); }

.eyebrow,
.section-index {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

h1 {
  margin: 6px 0 10px;
  font-size: clamp(34px, 5vw, 52px);
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.lede {
  max-width: 690px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
}

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

.section-links a {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--soft-bg);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.section-links a:hover {
  background: #ebeef2;
  border-color: #ccd2da;
}

.gallery-section {
  padding: 62px 0 72px;
  border-bottom: 1px solid var(--border);
}

.gallery-section-alt { background: #fafbfc; }

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 520px);
  gap: 56px;
  align-items: end;
  margin-bottom: 36px;
}

.section-heading h2 {
  margin: 5px 0 0;
  font-size: clamp(27px, 3vw, 36px);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.section-heading > p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.result-list {
  border-top: 1px solid var(--border-strong);
}

.load-message {
  margin: 0;
  padding: 36px 0;
  color: var(--muted);
}

.result-row {
  padding: 34px 0 42px;
  border-bottom: 1px solid var(--border);
}

.result-row:last-child { border-bottom: 0; }

.result-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 18px;
  padding: 0 2px;
}

.result-title-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 11px;
}

.result-heading h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.dataset {
  color: var(--muted);
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

.result-count {
  flex: none;
  color: #8a929c;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}

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

.panel {
  min-width: 0;
}

.panel-label {
  display: block;
  margin: 0 0 10px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.viewer-shell,
.stream-shell {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--viewer-bg);
}

.viewer-shell model-viewer {
  display: block;
  width: 100%;
  height: 100%;
  --poster-color: var(--viewer-bg);
  background: var(--viewer-bg);
}

.viewer-placeholder,
.viewer-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  pointer-events: none;
}

.viewer-placeholder {
  z-index: 3;
  color: #4f5965;
  background: rgb(240 243 247 / 78%);
  -webkit-backdrop-filter: blur(18px) saturate(0.8);
  backdrop-filter: blur(18px) saturate(0.8);
  transition:
    opacity 300ms ease,
    visibility 300ms ease,
    backdrop-filter 300ms ease;
}

.viewer-loading-status {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 18px;
  width: min(210px, 78%);
  align-items: center;
}

.viewer-loading-label,
.viewer-loading-value {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.viewer-loading-label {
  color: #404a55;
}

.viewer-loading-value {
  color: #737d88;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.viewer-loading-track {
  grid-column: 1 / -1;
  display: block;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgb(113 126 140 / 20%);
}

.viewer-loading-fill {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.viewer-shell.is-loading .viewer-loading-label {
  animation: loading-label-pulse 1.8s ease-in-out infinite;
}

.viewer-shell.is-loaded .viewer-placeholder {
  opacity: 0;
  visibility: hidden;
  -webkit-backdrop-filter: blur(0);
  backdrop-filter: blur(0);
}

.viewer-error {
  z-index: 4;
  color: #8a3b3b;
  font-size: 13px;
  text-align: center;
  background: var(--viewer-bg);
  pointer-events: auto;
}

.viewer-progress {
  position: absolute;
  right: 12%;
  bottom: 18px;
  left: 12%;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: #d9dee5;
}

.viewer-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

@keyframes loading-label-pulse {
  0%,
  100% { opacity: 0.58; }
  50% { opacity: 1; }
}

.stream-shell {
  position: relative;
  background: var(--viewer-bg);
}

.stream-frame {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}

.stream-scrubber-wrap {
  position: absolute;
  right: 16px;
  bottom: 12px;
  left: 16px;
  display: flex;
  align-items: center;
  height: 14px;
  padding: 0 2px;
  border-radius: 8px;
  background: rgb(255 255 255 / 72%);
  backdrop-filter: blur(5px);
}

.stream-scrubber {
  width: 100%;
  height: 3px;
  margin: 0;
  appearance: none;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  background:
    linear-gradient(
      to right,
      var(--accent) 0,
      var(--accent) var(--stream-progress, 0%),
      #d4d9df var(--stream-progress, 0%),
      #d4d9df 100%
    );
}

.stream-scrubber::-webkit-slider-thumb {
  width: 10px;
  height: 10px;
  appearance: none;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgb(38 46 56 / 25%);
}

.stream-scrubber::-moz-range-thumb {
  width: 7px;
  height: 7px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgb(38 46 56 / 25%);
}

.stream-scrubber:focus-visible {
  box-shadow: 0 0 0 3px rgb(43 108 176 / 20%);
}

.application-grid {
  border-top: 1px solid var(--border-strong);
}

.application-row {
  padding: 30px 0 36px;
  border-bottom: 1px solid var(--border);
}

.application-row:last-child { border-bottom: 0; }

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

.application-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.application-heading h3,
.application-heading p,
.application-panel-label,
.application-outcome {
  margin: 0;
}

.application-heading h3 {
  color: var(--muted);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
}

.application-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  align-items: baseline;
  gap: 14px;
}

.application-outcome {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.4;
}

.application-method {
  color: var(--fg);
  font-size: 22px;
  font-weight: 750;
  line-height: 1.2;
}

.application-panel-label {
  margin-bottom: 8px;
  color: var(--fg);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
}

.application-video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #101214;
  object-fit: cover;
}

.application-model-shell {
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--viewer-bg);
}

.application-model-shell model-viewer {
  display: block;
  width: 100%;
  height: 100%;
  --poster-color: var(--viewer-bg);
  background: var(--viewer-bg);
}

.application-outcome {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.application-outcome-success { color: #099447; }
.application-outcome-failure { color: #dc1c35; }

footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding: 38px 24px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

footer p { margin: 0; }
footer a { font-weight: 600; }

@media (max-width: 900px) {
  .container.wide { width: min(100% - 36px, 720px); }

  .section-heading {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  .application-media-grid { grid-template-columns: 1fr; }

  .viewer-shell,
  .stream-shell {
    aspect-ratio: 16 / 10;
  }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .container { width: calc(100% - 32px); }
  .container.wide { width: calc(100% - 28px); }
  .page-header { padding: 28px 0 38px; }
  .back-link { margin-bottom: 26px; }
  .gallery-section { padding: 44px 0 52px; }
  .result-row { padding: 28px 0 34px; }
  .result-heading { gap: 12px; }
  .result-heading h3 { font-size: 18px; }
  .result-count { display: none; }
  .application-row { padding: 26px 0 30px; }
  .application-heading { align-items: flex-start; }
  .application-summary { justify-content: flex-start; }
  .application-method { font-size: 19px; }
  .application-panel-label { margin-bottom: 7px; }
  .viewer-shell,
  .stream-shell { aspect-ratio: 4 / 3; }
  footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .viewer-placeholder,
  .viewer-loading-fill,
  .viewer-progress span {
    transition: none;
  }

  .viewer-shell.is-loading .viewer-loading-label {
    animation: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .viewer-placeholder {
    background: #f0f3f7;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
