:root {
  color-scheme: light;
  --ink: #172033;
  --ink-soft: #526079;
  --muted: #78859b;
  --line: #dfe5ef;
  --surface: #ffffff;
  --surface-soft: #f5f7fb;
  --blue: #2458d3;
  --shadow-sm: 0 8px 24px rgb(23 32 51 / 0.07);
  --shadow-lg: 0 28px 72px rgb(23 32 51 / 0.13);
  --radius: 18px;
  --radius-sm: 11px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--surface);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: 0.16em; }
img, video, canvas { display: block; max-width: 100%; }

.container {
  width: min(1120px, calc(100% - 40px));
  margin-inline: auto;
}

.content-width { width: min(980px, calc(100% - 40px)); }
.reading-width { width: min(800px, calc(100% - 40px)); }

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 9px 13px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

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

.paper-header {
  position: relative;
  overflow: hidden;
  padding: 76px 0 58px;
  text-align: center;
  background:
    radial-gradient(circle at 20% 10%, rgb(58 123 255 / 0.12), transparent 34%),
    radial-gradient(circle at 84% 20%, rgb(22 181 198 / 0.10), transparent 30%),
    linear-gradient(180deg, #fbfcff 0%, #f4f7fc 100%);
  border-bottom: 1px solid var(--line);
}

.paper-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(36 88 211 / 0.35), transparent);
}

.header-content { position: relative; z-index: 1; }

.venue-pill {
  margin: 0 0 14px;
  color: var(--blue);
  font-size: 0.76rem;
  font-weight: 780;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.venue-pill {
  display: inline-flex;
  padding: 7px 13px;
  border: 1px solid rgb(36 88 211 / 0.22);
  border-radius: 999px;
  background: rgb(255 255 255 / 0.76);
}

.paper-title {
  max-width: 1120px;
  margin: 0 auto 28px;
  color: #1a2233;
  font-size: clamp(2.35rem, 4vw, 3.55rem);
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.title-line {
  display: block;
  white-space: nowrap;
}

.paper-title .title-accent { color: var(--blue); }

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 3px 18px;
  max-width: 850px;
  margin: 0 auto 7px;
  color: #2f5ca8;
  font-size: 1.05rem;
  font-weight: 570;
}

.authors a { color: #2f5ca8; text-decoration: none; }
.authors a:hover { text-decoration: underline; }
.affiliation { margin: 0; color: var(--ink-soft); }

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

.resource-button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 8px 17px;
  border: 1px solid #cfd8e8;
  border-radius: 999px;
  color: var(--ink);
  background: rgb(255 255 255 / 0.9);
  box-shadow: 0 4px 15px rgb(23 32 51 / 0.06);
  font-size: 0.93rem;
  font-weight: 680;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.resource-button:hover {
  border-color: rgb(36 88 211 / 0.48);
  box-shadow: 0 9px 22px rgb(23 32 51 / 0.1);
  transform: translateY(-2px);
}

.resource-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 24px;
  padding: 0 5px;
  border-radius: 6px;
  color: #fff;
  background: var(--ink);
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.resource-icon-text { background: #b31b1b; font-size: 0.6rem; }

.section { padding: 78px 0; }

.section-tinted {
  background: var(--surface-soft);
  border-block: 1px solid #e9edf4;
}

.section-heading {
  max-width: 740px;
  margin: 0 auto 34px;
  text-align: center;
}

.section-heading-left { margin-left: 0; text-align: left; }

.section-heading h2,
.bibtex-heading h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.85rem, 3vw, 2.55rem);
  font-weight: 760;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

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

.viewer-section { padding-top: 62px; background: #fff; }

.viewer-card {
  width: min(740px, 100%);
  margin-inline: auto;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.mesh-viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border: 1px solid #dce2ec;
  border-radius: 15px;
  background: #f4f6fa;
  isolation: isolate;
}

.mesh-viewer canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  z-index: 1;
  touch-action: none;
}

.viewer-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgb(255 255 255 / 0.65), transparent),
    repeating-linear-gradient(0deg, transparent 0 31px, rgb(41 67 109 / 0.035) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgb(41 67 109 / 0.035) 31px 32px);
}

.placeholder-mark {
  display: grid;
  place-items: center;
  width: 92px;
  aspect-ratio: 1;
  border: 1px solid rgb(36 88 211 / 0.18);
  border-radius: 24px;
  color: rgb(36 88 211 / 0.38);
  background: rgb(238 244 255 / 0.82);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.05em;
  transform: rotate(-4deg);
}

.mesh-loading {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--ink-soft);
  background: rgb(247 249 252 / 0.84);
  backdrop-filter: blur(5px);
  font-size: 0.93rem;
  font-weight: 650;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.mesh-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #cbd6e8;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.viewer-mode-button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 11px;
  border: 1px solid rgb(23 32 51 / 0.14);
  border-radius: 9px;
  color: var(--ink);
  background: rgb(255 255 255 / 0.9);
  box-shadow: 0 4px 14px rgb(23 32 51 / 0.1);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
}

.viewer-mode-button:disabled { cursor: wait; opacity: 0.5; }
.viewer-controls { padding: 19px 5px 0; }

.iteration-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 1rem;
}

.iteration-row label { margin-right: auto; color: var(--ink); font-weight: 680; }
.iteration-row output { color: var(--blue); font-size: 1.1rem; font-weight: 780; }

.iteration-slider {
  width: 100%;
  margin: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.iteration-slider:disabled { cursor: wait; opacity: 0.55; }

.viewer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 9px;
  margin-top: 14px;
}

.control-button,
.copy-button {
  min-height: 42px;
  border: 1px solid #d5ddea;
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 680;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.control-button:not(:disabled):hover,
.copy-button:hover {
  border-color: #b8c5da;
  background: var(--surface-soft);
  transform: translateY(-1px);
}

.control-button:disabled { cursor: not-allowed; opacity: 0.43; }

.control-button-primary { border-color: var(--ink); color: #fff; background: var(--ink); }
.control-button-primary:not(:disabled):hover { border-color: var(--blue); background: var(--blue); }

.viewer-help {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.teaser-section { padding-top: 24px; }

.teaser-section .content-width {
  width: min(1040px, calc(100% - 28px));
}

.media-card {
  overflow: hidden;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.media-card img,
.media-card video { width: 100%; height: auto; }

.lead-copy,
.figure-copy {
  max-width: 900px;
  margin: 25px auto 0;
  color: var(--ink-soft);
  font-size: 1.04rem;
  text-align: center;
}

.lead-copy {
  max-width: 960px;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.reading-width > p {
  margin: 0 0 1.2em;
  color: #46536a;
  font-size: 1.04rem;
  text-align: justify;
}

.animation-card { margin-top: 28px; background: #eef1f6; }
.results-card { background: #f8fafc; }

.bibtex-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 19px;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
}

.copy-button.is-copied { border-color: #97d6ba; color: #176b49; background: #edf9f4; }

pre {
  margin: 0;
  padding: 23px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: #28364d;
  background: #f6f8fb;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.7);
  font: 0.84rem/1.65 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

.site-footer {
  padding: 34px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #f7f9fc;
  font-size: 0.83rem;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.footer-content p { margin: 0; }
.footer-content a { color: var(--ink-soft); }

.scroll-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 8px 20px rgb(23 32 51 / 0.24);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px);
  visibility: hidden;
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
}

.scroll-to-top.is-visible { opacity: 1; transform: translateY(0); visibility: visible; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:focus-visible { outline: 3px solid rgb(36 88 211 / 0.45); outline-offset: 3px; }

@media (max-width: 760px) {
  .title-line { white-space: normal; }
}

@media (max-width: 720px) {
  .container, .content-width, .reading-width { width: min(100% - 28px, 1120px); }
  .paper-header { padding: 52px 0 42px; }
  .paper-title { font-size: clamp(2rem, 10vw, 2.8rem); letter-spacing: -0.04em; }
  .authors { gap: 3px 12px; font-size: 0.96rem; }
  .publication-links { gap: 8px; }
  .resource-button { min-height: 43px; padding: 7px 13px; font-size: 0.85rem; }
  .section { padding: 58px 0; }
  .viewer-section { padding-top: 48px; }
  .viewer-card { padding: 10px; border-radius: 17px; }
  .mesh-viewer { border-radius: 11px; }
  .viewer-controls { padding-inline: 2px; }
  .viewer-actions { gap: 6px; }
  .control-button { padding-inline: 7px; font-size: 0.8rem; }
  .viewer-help { padding-inline: 10px; line-height: 1.45; }
  .reading-width > p, .lead-copy, .figure-copy { text-align: left; }
  .footer-content { display: block; }
  .footer-content p + p { margin-top: 8px; }
  pre { padding: 17px; font-size: 0.75rem; }
}

@media (max-width: 430px) {
  .paper-title { font-size: 2rem; }
  .resource-icon { display: none; }
  .viewer-mode-button { top: 8px; right: 8px; }
  .iteration-row { font-size: 0.9rem; }
  .viewer-actions { grid-template-columns: 1fr 1.15fr 1fr; }
  .viewer-help { font-size: 0.82rem; }
}

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

@media print {
  .viewer-section, .scroll-to-top, .publication-links, .animation-card, .copy-button { display: none; }
  .paper-header, .section, .site-footer { padding-block: 24px; }
}
