:root {
  --ink: #122426;
  --muted: #587072;
  --paper: #fbfcfa;
  --surface: #ffffff;
  --line: #dfe8e4;
  --teal: #0f766e;
  --teal-dark: #0a514c;
  --green: #3c7a4d;
  --amber: #b66a18;
  --rose: #a54032;
  --shadow: 0 18px 50px rgba(32, 48, 47, 0.12);
  --radius: 8px;
  --max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
  overflow-x: clip;
  text-rendering: optimizeLegibility;
}

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

a {
  color: var(--teal-dark);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--teal);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.45);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 20;
  transform: translateY(-160%);
  background: var(--ink);
  color: white;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(251, 252, 250, 0.92);
  border-bottom: 1px solid rgba(223, 232, 228, 0.9);
  backdrop-filter: blur(16px);
}

.nav-shell {
  width: min(var(--max), calc(100% - 2rem));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 7px;
  background: var(--teal);
  color: white;
  font-size: 1rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.75rem;
  border-radius: 7px;
  color: #294345;
  font-size: 0.94rem;
  font-weight: 650;
  text-decoration: none;
}

.nav-links a:hover {
  background: #edf5f1;
  color: var(--teal-dark);
}

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 0;
}

.nav-toggle span[aria-hidden="true"] {
  display: block;
  width: 18px;
  height: 2px;
  margin: 4px auto;
  background: var(--ink);
  border-radius: 1px;
}

.hero {
  padding: 4.2rem 0 3.7rem;
  background:
    linear-gradient(180deg, #f6faf7 0%, var(--paper) 78%),
    var(--paper);
}

.hero-inner,
.content {
  width: min(var(--max), calc(100% - 2rem));
  margin: 0 auto;
}

.hero-inner {
  display: block;
}

.hero-copy,
.hero-figure,
.split > *,
.citation-layout > *,
.figure-panel {
  min-width: 0;
}

.eyebrow,
.section-kicker {
  margin: 0 0 0.8rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  max-width: 1180px;
  margin-inline: auto;
  color: #0c2225;
  font-size: clamp(2.6rem, 4.7vw, 4.55rem);
  overflow-wrap: anywhere;
}

h2 {
  max-width: 760px;
  font-size: clamp(1.9rem, 3.6vw, 3.2rem);
}

.hero-summary,
.lead {
  color: #39575a;
  font-size: 1.12rem;
  overflow-wrap: break-word;
}

.hero-summary {
  max-width: 760px;
  margin: 1.35rem auto 1.5rem;
}

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

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.85rem;
  max-width: 1120px;
  margin-inline: auto;
  color: #243c3f;
  font-weight: 700;
}

.affiliations {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.18rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.96rem;
}

.logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin: 1.3rem 0 1.6rem;
}

.logo-row img {
  width: auto;
  max-height: 48px;
  object-fit: contain;
}

.actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  max-width: 560px;
  margin-inline: auto;
}

.button,
.copy-button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b7cac5;
  border-radius: 7px;
  background: white;
  color: var(--teal-dark);
  padding: 0.76rem 1rem;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button.primary {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
  color: white;
}

.button.is-disabled {
  border-color: #c7d8d2;
  border-style: dashed;
  color: #647b7d;
  background: #f8fbf9;
  cursor: not-allowed;
}

.button:hover,
.copy-button:hover {
  transform: translateY(-1px);
}

.button.is-disabled:hover {
  transform: none;
}

.hero-figure {
  max-width: 1140px;
  margin: 1.65rem auto 0;
}

.hero-figure figcaption {
  text-align: center;
}

.hero-card {
  max-width: 1120px;
  margin: 1.65rem auto 0;
  padding: clamp(1.4rem, 3vw, 2rem);
  border: 1px solid #cfe0da;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 46px rgba(30, 58, 55, 0.09);
  text-align: left;
}

.hero-card h2 {
  font-size: clamp(1.4rem, 2.5vw, 2rem);
}

.hero-card p {
  margin: 1rem 0 0;
  color: #39575a;
  font-size: 1.08rem;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.hero-metrics div {
  min-height: 135px;
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 1rem;
  border: 1px solid #d6e5e0;
  border-radius: var(--radius);
  background: #f9fcfa;
  text-align: center;
}

.hero-metrics strong {
  color: var(--teal-dark);
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1;
}

.hero-metrics span {
  margin-top: 0.65rem;
  color: var(--muted);
  font-weight: 750;
}

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

.hero-figure img,
.figure-panel img,
.wide-figure img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  box-shadow: var(--shadow);
}

figcaption {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 0.7rem;
}

.figure-link {
  display: inline-flex;
  margin-left: 0.45rem;
  color: var(--teal-dark);
  font-weight: 800;
  white-space: nowrap;
}

.section {
  padding: 5rem 0;
  scroll-margin-top: 78px;
}

.metrics-band {
  background: #eef6f2;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.results-band {
  background: #f7f8f3;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.citation-band {
  background: #edf5f5;
  border-top: 1px solid var(--line);
}

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

.metric-card {
  min-height: 210px;
  padding: 1.35rem;
  border: 1px solid #cfe0da;
  border-radius: var(--radius);
  background: var(--surface);
}

.metric-value {
  display: block;
  color: var(--teal-dark);
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  font-weight: 900;
  line-height: 1.05;
}

.metric-label {
  display: block;
  margin-top: 0.7rem;
  color: var(--ink);
  font-weight: 850;
}

.metric-card p {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.split,
.method-body {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.split p,
.method-body p {
  color: #375256;
  font-size: 1.03rem;
}

.method-intro .lead {
  max-width: 100%;
}

.method-body {
  margin-top: 2rem;
  align-items: center;
}

.method-detail {
  min-width: 0;
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
}

.check-list li {
  position: relative;
  padding-left: 1.5rem;
  margin: 0.55rem 0;
  color: #284548;
}

.check-list li::before {
  content: "";
  position: absolute;
  top: 0.68rem;
  left: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--green);
}

.wide-figure {
  margin-top: 3rem;
}

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

.method-steps article,
.insight-card {
  padding: 1.2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

.method-steps span {
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.method-steps h3,
.insight-card h3,
.story-copy h3 {
  margin-top: 0.35rem;
  font-size: 1.2rem;
}

.method-steps p,
.insight-card p,
.story-copy p {
  color: #486266;
}

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

.paper-table-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 2rem;
}

.utility-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.85fr);
  gap: 1.1rem;
  margin-top: 1.25rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
  font-size: 0.95rem;
}

.paper-table {
  min-width: 980px;
  font-size: 0.86rem;
}

.paper-table th,
.paper-table td {
  padding: 0.56rem 0.72rem;
}

.paper-table caption {
  font-size: 0.98rem;
}

caption {
  caption-side: top;
  padding: 1rem 1rem 0.2rem;
  color: var(--ink);
  text-align: left;
  font-weight: 850;
}

th,
td {
  padding: 0.72rem 1rem;
  border-bottom: 1px solid #edf1ef;
  text-align: left;
  vertical-align: top;
}

thead th {
  color: #36565a;
  font-size: 0.78rem;
  text-transform: uppercase;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

.best-row th,
.best-row td {
  background: #eef8f1;
  color: #173d31;
  font-weight: 850;
}

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

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

.ablation-table {
  margin-top: 1.25rem;
}

.insight-number {
  display: block;
  color: var(--teal-dark);
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 950;
  line-height: 1;
}

.ablation-stack {
  display: grid;
  gap: 2.2rem;
  margin-top: 2.5rem;
}

.story-block {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(1.3rem, 4vw, 3rem);
  align-items: center;
}

.story-block.reverse {
  grid-template-columns: minmax(0, 1.28fr) minmax(260px, 0.72fr);
}

.story-block.reverse .story-copy {
  order: 2;
}

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

.wide-panel {
  min-width: 0;
}

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

.scheduler-figures .figure-panel img {
  height: clamp(300px, 25vw, 380px);
  object-fit: contain;
}

.qualitative-band {
  background: #f7faf8;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.qualitative-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-top: 2rem;
}

.figure-note {
  max-width: 1080px;
  margin: 1rem 0 0;
  color: #486266;
  font-size: 1.03rem;
}

.full-panel {
  grid-column: 1 / -1;
}

.content-warning {
  display: grid;
  grid-template-columns: minmax(260px, 0.45fr) minmax(0, 1fr);
  gap: 1.2rem;
  align-items: center;
  padding: 1rem;
  border: 1px solid #d7e5e0;
  border-radius: var(--radius);
  background: white;
}

.content-warning strong {
  color: var(--teal-dark);
  font-size: 1.15rem;
}

.content-warning p {
  color: #486266;
}

.qualitative-paper-figure {
  margin-bottom: 0.75rem;
}

.citation-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.65fr) minmax(0, 1.35fr);
  gap: clamp(1.4rem, 4vw, 3rem);
  align-items: start;
}

.bibtex-box {
  position: relative;
  border: 1px solid #c7dbd8;
  border-radius: var(--radius);
  background: #102326;
  box-shadow: var(--shadow);
}

.bibtex-box pre {
  margin: 0;
  overflow-x: auto;
  padding: 1.4rem;
  color: #eef8f1;
  font-size: 0.9rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.copy-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  min-height: 38px;
  padding: 0.45rem 0.8rem;
  border-color: rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.12);
  color: white;
}

.site-footer {
  padding: 2.2rem 0;
  background: #102326;
  color: #d4e4df;
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-content p {
  margin: 0;
}

.footer-content code {
  color: #ffffff;
}

@media (max-width: 1000px) {
  .nav-toggle {
    display: block;
    flex: 0 0 auto;
  }

  .nav-links {
    position: absolute;
    left: 1rem;
    right: 1rem;
    top: 68px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    padding: 0.55rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: white;
    box-shadow: var(--shadow);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    justify-content: center;
  }

  h1 {
    font-size: clamp(2.1rem, 5.8vw, 3.15rem);
  }

  .hero-inner,
  .split,
  .method-body,
  .citation-layout,
  .story-block,
  .story-block.reverse,
  .content-warning {
    grid-template-columns: 1fr;
  }

  .story-block.reverse .story-copy {
    order: 0;
  }

  .hero-inner {
    gap: 2.4rem;
  }

  .metric-grid,
  .table-grid,
  .utility-grid,
  .figure-grid,
  .method-steps,
  .insight-grid,
  .qualitative-layout {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  html {
    scroll-padding-top: 70px;
  }

  .hero-inner,
  .content,
  .nav-shell {
    width: calc(100% - 2rem);
    max-width: var(--max);
  }

  .hero {
    padding-top: 2.8rem;
  }

  h1 {
    font-size: clamp(2.05rem, 8.8vw, 2.8rem);
    line-height: 1.1;
  }

  .hero-summary,
  .lead {
    font-size: 1rem;
  }

  .metric-grid,
  .table-grid,
  .utility-grid,
  .figure-grid,
  .method-steps,
  .insight-grid,
  .paired-figures,
  .qualitative-layout,
  .hero-metrics {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 0;
  }

  .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.7rem;
  }

  .button {
    width: 100%;
    padding-inline: 0.65rem;
  }

  .button.primary {
    grid-column: 1 / -1;
  }

  .scheduler-figures .figure-panel img {
    height: auto;
  }
}

@media (max-width: 480px) {
  .hero-inner,
  .content,
  .nav-shell {
    width: calc(100% - 1.5rem);
    max-width: var(--max);
  }

  h1 {
    font-size: clamp(1.85rem, 8.6vw, 2.1rem);
    line-height: 1.13;
  }

  .section {
    padding: 3.6rem 0;
  }

  .authors {
    gap: 0.25rem 0.55rem;
  }

  .bibtex-box pre {
    padding: 4rem 1rem 1rem;
    font-size: 0.82rem;
  }
}

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