:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-soft: #faf8f3;
  --text: #1f1c17;
  --muted: #6a655b;
  --accent: #173a37;
  --border: #ddd5c8;
  --border-strong: #c7bcac;
  --shadow: 0 10px 24px rgba(24, 22, 18, 0.05);
  --radius: 18px;
  --shell: min(1440px, calc(100vw - 40px));
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.65;
}

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

a,
button {
  color: inherit;
}

.shell {
  width: var(--shell);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 241, 234, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 74px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  text-decoration: none;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.topnav {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar {
  display: none;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 999px;
  white-space: nowrap;
  transition: background-color 180ms ease, color 180ms ease;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.topnav a:hover,
.topnav a:focus-visible {
  color: var(--accent);
  background: var(--surface);
  text-decoration: none;
}

.masthead {
  padding: 56px 0 24px;
}

.masthead-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.masthead-copy {
  max-width: 1080px;
  margin: 0 auto;
}

.centered-hero {
  text-align: center;
}

.section-kicker {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.masthead h1,
.section-heading h2,
.results-header h3,
.figure-copy h3 {
  margin: 0;
  font-family: 'Newsreader', serif;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.masthead h1 {
  max-width: 24ch;
  margin-inline: auto;
  font-size: clamp(2.5rem, 4.2vw, 4.25rem);
  line-height: 0.96;
  text-wrap: balance;
}

.identity-line {
  margin: 16px 0 0;
  color: var(--muted);
  font-weight: 600;
}

.masthead-summary,
.copy-block,
.figure-copy p,
.section-intro,
.video-route,
.grid-placeholder {
  color: var(--muted);
}

.masthead-summary {
  max-width: 58ch;
  margin: 18px auto 0;
  font-size: 1.06rem;
}

.text-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.section-shell,
.figure-card,
.results-showcase,
.bibtex-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.section-block {
  padding: 14px 0;
}

.section-shell {
  padding: 32px;
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h2 {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 1.02;
}

.demo-shell {
  text-align: center;
}

.demo-frame {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(250, 248, 243, 0.96), rgba(255, 255, 255, 0.98));
}

.demo-video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 14px;
  background: #000;
}

.copy-block p {
  margin: 0;
}

.method-layout {
  display: flex;
  justify-content: center;
}

.centered-method {
  text-align: center;
}

.method-figure,
.figure-link {
  display: block;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
}

.method-figure {
  width: min(940px, 100%);
}

.figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.figure-card {
  overflow: hidden;
}

.figure-copy {
  padding: 16px 18px 18px;
}

.figure-copy h3,
.results-header h3 {
  font-size: clamp(1.8rem, 3vw, 2.2rem);
  line-height: 1.05;
}

.figure-copy p {
  margin: 10px 0 0;
}

.figure-copy .text-link {
  display: inline-block;
  margin-top: 12px;
}

.video-library-grid {
  display: grid;
  gap: 28px;
}

.results-showcase {
  padding: 26px;
}

.results-header {
  margin-bottom: 14px;
  text-align: center;
}

.results-carousel {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 44px;
  gap: 14px;
  align-items: center;
}

.results-arrow {
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
}

.results-arrow:disabled {
  opacity: 0.35;
  cursor: default;
}

.results-viewport {
  overflow: hidden;
}

.results-track {
  display: flex;
  transition: transform 220ms ease;
}

.results-page {
  min-width: 100%;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

@media (min-width: 1480px) {
  .results-page {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.results-card {
  display: block;
}

.carousel-video {
  width: 100%;
  aspect-ratio: 1072 / 908;
  border-radius: 14px;
  background: #000;
}

.results-card-copy {
  padding: 12px 2px 0;
}

.results-card-title {
  margin: 0;
  font-size: 1.04rem;
  font-weight: 600;
  color: var(--text);
}

.video-route {
  margin: 4px 0 0;
  font-size: 0.9rem;
}

.results-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
}

.results-dot {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d2cabd;
  cursor: pointer;
}

.results-dot.is-active {
  background: var(--accent);
}

.bibtex-card {
  padding: 22px;
}

.bibtex-card pre {
  margin: 0;
  overflow-x: auto;
  font-size: 0.92rem;
  line-height: 1.7;
}

.copy-bibtex-btn {
  margin-top: 16px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--accent);
  cursor: pointer;
}

.copy-bibtex-btn.is-copied {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (max-width: 1024px) {
  .figure-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .topbar {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 12px 0;
  }

  .topnav {
    width: 100%;
    justify-content: flex-start;
  }

  .section-shell,
  .results-showcase {
    padding: 18px;
  }

  .results-carousel {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 8px;
  }

  .results-arrow {
    width: 36px;
    height: 36px;
    font-size: 1.7rem;
  }

  .results-page {
    grid-template-columns: 1fr;
  }
}
