@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ========================================================
   Intraoperative Fully Automatic Registration — paper site
   ======================================================== */

:root {
  color-scheme: light;
  --surface-1: #ffffff;
  --surface-2: #f8fafc;
  --surface-card: #ffffff;
  --text-primary: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --gridline: #f1f5f9;

  --series-1: #2563eb;
  --series-2: #ea580c;
  --series-3: #10b981;
  --series-4: #eab308;

  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-ink: #ffffff;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --maxw: 1120px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #020617;
    --surface-2: #0f172a;
    --surface-card: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border: #334155;
    --gridline: #1e293b;

    --series-1: #3b82f6;
    --series-2: #f97316;
    --series-3: #34d399;
    --series-4: #facc15;

    --accent: #3b82f6;
    --accent-hover: #60a5fa;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
    --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #020617;
  --surface-2: #0f172a;
  --surface-card: #1e293b;
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --border: #334155;
  --gridline: #1e293b;
  --series-1: #3b82f6;
  --series-2: #f97316;
  --series-3: #34d399;
  --series-4: #facc15;
  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);
  --shadow-hover: 0 20px 25px -5px rgb(0 0 0 / 0.6), 0 8px 10px -6px rgb(0 0 0 / 0.6);
}

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

body {
  margin: 0;
  background: var(--surface-2);
  color: var(--text-primary);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- top nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--surface-1) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-brand {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--text-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-links {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
}
.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}
.nav-links a:hover { background: var(--border); color: var(--text-primary); }

.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px; height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-card);
  color: var(--text-secondary);
  cursor: pointer;
}
.theme-toggle:hover { background: var(--border); color: var(--text-primary); }
.theme-toggle svg { width: 17px; height: 17px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

/* ---------- hero ---------- */
.hero {
  padding: 96px 0 64px;
  text-align: center;
  background:
    radial-gradient(800px 400px at 50% -100px, color-mix(in srgb, var(--accent) 15%, transparent), transparent 70%),
    var(--surface-1);
  border-bottom: 1px solid var(--border);
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}
.hero h1 {
  font-size: clamp(1.7rem, 3.6vw, 2.6rem);
  line-height: 1.18;
  margin: 0 auto 22px;
  max-width: 920px;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.authors {
  max-width: 820px;
  margin: 0 auto 8px;
  font-size: 1rem;
  color: var(--text-secondary);
}
.authors sup { color: var(--accent); font-weight: 700; }
.affils {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 30px;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  transition: transform .12s ease, background .12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  box-shadow: 0 4px 14px 0 color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn-primary:hover { background: var(--accent-hover); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); transform: translateY(-2px); }
.btn-ghost {
  background: var(--surface-card);
  color: var(--text-primary);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--text-muted); }

/* ---------- sections ---------- */
section { padding: 64px 0; }
section.alt { background: var(--surface-1); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.section-head { text-align: center; max-width: 760px; margin: 0 auto 40px; }
.eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.section-head h2 {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  margin: 0 0 10px;
  font-weight: 800;
}
.section-head p { color: var(--text-secondary); margin: 0; }

.abstract-card {
  max-width: 880px;
  margin: 0 auto;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  color: var(--text-secondary);
  font-size: 1.05rem;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.abstract-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.abstract-card strong { color: var(--text-primary); }

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 24px;
}
.chip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 999px;
}

/* ---------- pipeline stages ---------- */
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.stage-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  position: relative;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stage-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}
.stage-num {
  width: 30px; height: 30px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 0.85rem;
  margin-bottom: 14px;
}
.stage-card h3 { font-size: 0.98rem; margin: 0 0 8px; }
.stage-card p { font-size: 0.86rem; color: var(--text-secondary); margin: 0; }

/* ---------- figure placeholders ---------- */
.figure {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.figure-media {
  position: relative;
  aspect-ratio: 16/10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 0;
}
.figure-media:empty,
.figure-media:has(> :only-child:is(br, span)) {
  background:
    repeating-linear-gradient(135deg, var(--gridline) 0 2px, transparent 2px 14px),
    var(--surface-2);
  padding: 16px;
}
.figure-media img, .figure-media video { width: 100%; height: 100%; object-fit: contain; }
.figure-caption {
  padding: 14px 18px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}
.figure-caption b { color: var(--text-primary); }

.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

/* ---------- videos ---------- */
.video-grid {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.video-card {
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.video-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.video-card video {
  width: 100%;
  aspect-ratio: 16/9;
  display: block;
  background: #000;
}

.figure-quad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  aspect-ratio: 16/10;
  background: var(--border);
}
.quad-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quad-cell { position: relative; background: var(--surface-2); overflow: hidden; aspect-ratio: 16/10; }
.quad-tag {
  position: absolute;
  bottom: 4px; left: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  background: rgba(0,0,0,0.55);
  padding: 1px 6px;
  border-radius: 4px;
}

.figure-multi {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 3px;
  background: var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.figure-multi .quad-cell { aspect-ratio: 4/3; }

/* ---------- stat tiles ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}
.stat-tile {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* ---------- tables ---------- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-card);
  box-shadow: var(--shadow-md);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  min-width: 480px;
}
thead th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--gridline);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.total td { color: var(--text-primary); font-weight: 700; }
.table-title { font-weight: 700; color: var(--text-primary); padding: 16px 16px 0; font-size: 0.92rem; }

/* ---------- chart ---------- */
.chart-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 32px 24px;
  box-shadow: var(--shadow-md);
}
.chart-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 4px; }
.chart-sub { font-size: 0.82rem; color: var(--text-secondary); margin-bottom: 20px; }
.legend { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.legend-item { display: flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text-secondary); }
.legend-swatch { width: 11px; height: 11px; border-radius: 3px; }

.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 48px; align-items: center; gap: 12px; }
.bar-label { font-size: 0.84rem; color: var(--text-secondary); }
.bar-track { background: var(--surface-2); border-radius: 6px; height: 14px; overflow: hidden; border: 1px solid var(--gridline); }
.bar-fill { height: 100%; border-radius: 6px 0 0 6px; }
.bar-value { font-size: 0.82rem; text-align: right; color: var(--text-primary); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- authors / affiliations ---------- */
.author-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}
.author-card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.author-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--accent); }
.author-card .name { font-weight: 700; font-size: 0.94rem; }
.author-card .role { font-size: 0.8rem; color: var(--accent); margin-top: 2px; }
.author-card .affil { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

/* ---------- citation ---------- */
.cite-card {
  max-width: 880px;
  margin: 0 auto;
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.cite-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}
.cite-head span { font-weight: 700; font-size: 0.9rem; }
.copy-btn {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
}
.copy-btn:active { transform: scale(0.97); }
pre.bibtex {
  margin: 0;
  padding: 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre;
}

/* ---------- footer ---------- */
footer {
  padding: 40px 0 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}
footer a { color: var(--text-secondary); }

@media (max-width: 640px) {
  .nav-links a:nth-child(n+5) { display: none; }
  .bar-row { grid-template-columns: 62px 1fr 40px; }
}

/* ---------- image zoom ---------- */
.zoomable { cursor: zoom-in; }
.zoom-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border: none;
  border-radius: 999px;
  background: rgba(11,11,11,0.55);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .15s ease, transform .15s ease, background .15s ease;
  z-index: 2;
}
.zoom-wrap:hover .zoom-btn,
.zoom-btn:focus-visible {
  opacity: 1;
  transform: translateY(0);
}
.zoom-btn:hover { background: rgba(11,11,11,0.8); }
@media (hover: none) {
  .zoom-btn { opacity: 1; transform: none; }
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: rgba(0,0,0,0.86);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lightbox figure {
  margin: 0;
  max-width: min(1100px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lightbox img {
  max-width: 100%;
  max-height: 78vh;
  width: auto;
  border-radius: var(--radius-md);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  cursor: zoom-out;
}
.lightbox figcaption {
  color: #fff;
  font-size: 0.86rem;
  text-align: center;
  opacity: 0.85;
  max-width: 720px;
}
.lightbox-close {
  position: fixed;
  top: 18px; right: 24px;
  width: 40px; height: 40px;
  border: none;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  z-index: 201;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
