:root {
  --ink: #16120f;
  --ink-muted: #51483f;
  --ink-soft: #786d61;
  --paper: #f7f1e7;
  --surface: #fffaf1;
  --surface-2: #ece7db;
  --surface-3: #1f2422;
  --line: #d7cdbd;
  --line-strong: #918677;
  --moss: #4f6754;
  --moss-dark: #2d4535;
  --brick: #c8543d;
  --ochre: #b7832f;
  --blue: #315f7f;
  --shadow: 0 18px 42px rgb(22 18 15 / 0.14);
  --radius: 8px;
  --max-wide: 1180px;
  --max-narrow: 820px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgb(22 18 15 / 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgb(22 18 15 / 0.035) 1px, transparent 1px),
    radial-gradient(circle at 18% 12%, rgb(200 84 61 / 0.12), transparent 24rem),
    var(--paper);
  background-size: 32px 32px, 32px 32px, auto, auto;
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 17px;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::selection {
  color: var(--surface);
  background: var(--moss-dark);
}

a {
  color: inherit;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding: 0 28px;
  border-bottom: 1px solid rgb(22 18 15 / 0.16);
  background: rgb(247 241 231 / 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-size: 0.96rem;
  font-weight: 850;
  letter-spacing: 0;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  position: relative;
  width: 21px;
  height: 21px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--surface);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--brick);
}

.nav-links {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.nav-links > a,
.nav-dropdown-trigger {
  padding: 0.35rem 0.1rem;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.nav-links > a:hover,
.nav-links > a:focus-visible,
.nav-dropdown:hover .nav-dropdown-trigger,
.nav-dropdown:focus-within .nav-dropdown-trigger {
  color: var(--ink);
  border-bottom-color: var(--brick);
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
  color: inherit;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  font: inherit;
  cursor: pointer;
}

.nav-caret {
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-1px) rotate(45deg);
}

.nav-menu {
  position: absolute;
  top: calc(100% + 0.55rem);
  right: 0;
  width: min(82vw, 320px);
  padding: 0.45rem;
  border: 1px solid rgb(22 18 15 / 0.16);
  border-radius: var(--radius);
  background: rgb(255 250 241 / 0.98);
  box-shadow: 0 22px 52px rgb(22 18 15 / 0.18);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease, visibility 150ms ease;
}

.nav-dropdown:hover .nav-menu,
.nav-dropdown:focus-within .nav-menu,
.nav-dropdown.is-open .nav-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.nav-menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 0.65rem;
}

.nav-menu a {
  display: block;
  padding: 0.68rem 0.75rem;
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
}

.nav-menu a:hover,
.nav-menu a:focus-visible {
  background: rgb(79 103 84 / 0.1);
  outline: none;
}

.nav-menu strong,
.nav-menu span {
  display: block;
}

.nav-menu strong {
  font-size: 0.91rem;
  line-height: 1.15;
}

.nav-menu span {
  margin-top: 0.18rem;
  color: var(--ink-soft);
  font-size: 0.77rem;
  line-height: 1.25;
}

.hero {
  min-height: calc(92vh - 68px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 5rem 1.5rem 2rem;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(115deg, rgb(255 250 241 / 0.92), rgb(236 231 219 / 0.78)),
    var(--paper);
}

.hero-grid {
  width: 100%;
  max-width: var(--max-wide);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.4rem;
  align-items: center;
}

.hero-copy {
  min-width: 0;
}

.eyebrow,
.section-kicker,
.card-label {
  margin: 0 0 0.85rem;
  color: var(--moss-dark);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h3,
p,
td,
th {
  overflow-wrap: anywhere;
}

h2 {
  overflow-wrap: normal;
}

h1,
h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 650;
  letter-spacing: 0;
}

h1 {
  overflow-wrap: normal;
  word-break: normal;
  font-size: 5.1rem;
  line-height: 0.9;
}

h2 {
  max-width: 960px;
  font-size: 4rem;
  line-height: 1.02;
}

h3 {
  margin: 0 0 0.55rem;
  font-size: 1.04rem;
  line-height: 1.22;
}

.subtitle {
  max-width: 690px;
  margin: 1.1rem 0 0;
  color: var(--ink);
  font-size: 2rem;
  font-weight: 720;
  line-height: 1.18;
}

.hero-lede {
  max-width: 700px;
  margin: 1.15rem 0 0;
  color: var(--ink-muted);
  font-size: 1.1rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.button,
.copy-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 0.72rem 1rem;
  color: var(--ink);
  background: rgb(255 250 241 / 0.78);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.button:hover,
.button:focus-visible,
.copy-button:hover,
.copy-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 9px 18px rgb(22 18 15 / 0.16);
}

.button-primary {
  color: var(--surface);
  background: var(--ink);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--moss-dark);
}

.hero-figure,
.figure-panel {
  margin: 0;
}

.hero-figure {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid rgb(22 18 15 / 0.2);
  border-radius: var(--radius);
  background: rgb(255 250 241 / 0.72);
  box-shadow: var(--shadow);
}

.hero-figure img,
.figure-panel img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.hero-figure figcaption,
.figure-panel figcaption {
  margin-top: 0.7rem;
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.42;
}

.stat-strip {
  width: 100%;
  max-width: var(--max-wide);
  margin: 2rem auto 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}

.stat-strip div {
  min-height: 118px;
  padding: 1rem;
  background: rgb(255 250 241 / 0.82);
}

.stat-strip strong {
  display: block;
  color: var(--brick);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.05rem;
  line-height: 1;
}

.stat-strip span {
  display: block;
  margin-top: 0.55rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  line-height: 1.25;
}

.section,
.visual-band {
  padding: 5.4rem 1.5rem;
}

.section {
  background: rgb(247 241 231 / 0.7);
}

.visual-band {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.section-tinted {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.content-wide,
.content-grid,
.content-narrow,
.question-layout {
  width: 100%;
  max-width: var(--max-wide);
  margin: 0 auto;
}

.content-narrow {
  max-width: var(--max-narrow);
}

.content-grid,
.question-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 4rem;
  align-items: start;
}

.section-heading {
  margin-bottom: 2rem;
}

.section-heading.compact {
  margin-bottom: 1.5rem;
}

.prose p,
.content-narrow p,
.answer-card p,
.pipeline p,
.case-browser-card p,
.table-wrap p,
.cases-grid > div p:not(.section-kicker) {
  color: var(--ink-muted);
}

.prose p,
.content-narrow p {
  margin: 1.05rem 0 0;
  font-size: 1.05rem;
}

.callout {
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--brick);
  background: rgb(255 250 241 / 0.76);
}

.method-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 2rem;
  align-items: start;
}

.pipeline {
  list-style: none;
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--line);
}

.pipeline li {
  min-height: 146px;
  padding: 1.15rem;
  background: var(--surface);
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  min-height: 26px;
  margin-bottom: 0.85rem;
  padding: 0 0.45rem;
  color: var(--brick);
  border: 1px solid rgb(200 84 61 / 0.35);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 900;
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0;
}

.answer-card,
.case-browser-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(22 18 15 / 0.08);
}

.answer-card {
  padding: 1.25rem;
}

.card-label {
  color: var(--brick);
}

.table-wrap {
  max-width: 100%;
  margin-top: 2rem;
  overflow-x: auto;
}

.table-wrap h3 {
  margin-bottom: 0.85rem;
  font-size: 1.18rem;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--surface);
}

th,
td {
  padding: 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

thead th {
  color: var(--surface);
  background: var(--surface-3);
  font-size: 0.85rem;
}

tbody th {
  font-weight: 780;
}

td {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.highlight-row th,
.highlight-row td {
  color: var(--ink);
  background: rgb(200 84 61 / 0.12);
  font-weight: 850;
}

.image-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 1.2rem;
  align-items: start;
}

.image-grid .figure-panel,
.evidence-stack .figure-panel {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 30px rgb(22 18 15 / 0.08);
}

.evidence-stack {
  display: grid;
  gap: 1.2rem;
}

.section-cases {
  border-top: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgb(255 250 241 / 0.82), rgb(247 241 231 / 0.92)),
    var(--paper);
}

.cases-grid {
  align-items: center;
}

.case-browser-stack {
  display: grid;
  gap: 1rem;
}

.case-browser-card {
  padding: 1.3rem;
}

.case-browser-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
  color: var(--moss-dark);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.case-browser-meta span {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0.18rem 0.5rem;
  border: 1px solid rgb(79 103 84 / 0.32);
  border-radius: 999px;
  background: rgb(79 103 84 / 0.08);
}

.case-browser-card p {
  margin: 0;
}

.case-browser-subtitle {
  margin: -0.2rem 0 0.55rem;
  color: var(--moss-dark);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.case-browser-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1.15rem;
}

.bibtex-wrap {
  position: relative;
  margin-top: 1.5rem;
}

pre {
  margin: 0;
  padding: 1.25rem;
  color: #f6efe4;
  background: var(--surface-3);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.55;
  box-shadow: var(--shadow);
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.copy-button {
  margin-top: 0.9rem;
  color: var(--surface);
  background: var(--moss-dark);
  border-color: var(--moss-dark);
}

.site-footer {
  padding: 2.2rem 1.5rem;
  color: #f1eadf;
  background: var(--ink);
  font-size: 0.92rem;
  text-align: center;
}

.site-footer p {
  max-width: var(--max-narrow);
  margin: 0 auto;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: 320px;
  padding: 0.82rem 0.95rem;
  color: var(--surface);
  background: var(--ink);
  border: 1px solid rgb(255 255 255 / 0.16);
  border-radius: 6px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 980px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.8rem 1rem;
  }

  .nav-links {
    width: 100%;
    justify-content: space-between;
    gap: 0.55rem;
    font-size: 0.82rem;
  }

  .nav-menu {
    right: auto;
    left: 0;
  }

  .hero {
    min-height: auto;
    padding-top: 4.2rem;
  }

  .hero-grid,
  .content-grid,
  .question-layout,
  .method-grid,
  .answer-grid,
  .image-grid,
  .stat-strip {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 5rem;
  }

  h2 {
    font-size: 3rem;
  }

  .subtitle {
    font-size: 1.55rem;
  }

  .method-grid {
    gap: 1.4rem;
  }
}

@media (max-width: 1100px) and (min-width: 981px) {
  .hero {
    padding-top: 4rem;
  }

  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.5rem;
  }

  h1 {
    font-size: 4.05rem;
  }

  .subtitle {
    font-size: 1.62rem;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 16px;
  }

  .site-header {
    position: static;
  }

  .nav-links {
    overflow-x: visible;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-bottom: 0.15rem;
  }

  .nav-dropdown {
    position: static;
  }

  .nav-menu {
    left: 1rem;
    right: 1rem;
    width: auto;
  }

  .hero,
  .visual-band,
  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .hero {
    padding-top: 3.2rem;
    padding-bottom: 2rem;
  }

  h1 {
    font-size: 3.15rem;
  }

  h2 {
    font-size: 2.35rem;
  }

  .subtitle {
    font-size: 1.28rem;
  }

  .actions,
  .case-browser-links {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button,
  .copy-button {
    width: 100%;
  }

  .toast {
    left: 18px;
    right: 18px;
    max-width: none;
  }
}

@media (max-width: 360px) {
  h1 {
    font-size: 2.65rem;
  }
}

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