:root {
  --bg: #f7f7f4;
  --fg: #16181c;
  --muted: #5c6270;
  --accent: #17835a;
  --accent-hover: #0f5c3d;
  --highlight: #44ff98;
  --tint: #e7f7ee;
  --dark-bg: #16181c;
  --dark-fg: #f7f7f4;
  --border: #e3e4de;
  --radius-md: 8px;
  --radius-pill: 999px;
  --radius-cut: 22px 0 0 0;
  --shadow-sm:
    0 1px 2px rgba(20, 20, 30, 0.06), 0 1px 1px rgba(20, 20, 30, 0.04);
  --shadow-md: 0 4px 12px rgba(20, 20, 30, 0.08);
  --serif: "Spectral", Georgia, serif;
  --sans:
    "Assistant", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Cascadia Code", "Roboto Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 108%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 840px;
  margin: 0 auto;
  padding: 3rem 1.5rem 0;
}

.hero {
  text-align: center;
  margin-bottom: 3rem;
}

h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 8vw, 3.1rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 0.75rem;
}

.subtitle {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 4.5vw, 1.3rem);
  font-weight: 400;
  line-height: 1.4;
  color: var(--muted);
  max-width: 680px;
  margin: 0 auto 1.5rem;
}

.date-line {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

.authors {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 1.25rem;
  padding: 0;
  margin: 0 0 0.25rem;
  font-size: clamp(1rem, 3.5vw, 1.25rem);
  font-weight: 500;
}

.authors .aff {
  display: block;
  font-size: 0.62em;
  font-weight: 400;
  color: var(--muted);
}

.authors a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.authors a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

.context-line {
  color: var(--muted);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.context-line a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.context-line a:hover {
  color: var(--accent-hover);
}

.links {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5625rem 1rem;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.04);
  color: var(--fg);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 650;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.07);
  transform: translateY(-1px);
}

.button--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--dark-fg);
}

.button--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--dark-fg);
}

.button svg {
  width: 1.0625rem;
  height: 1.0625rem;
}

@media (max-width: 640px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }
}

h2 {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 6vw, 1.9rem);
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 3.25rem 0 1.25rem;
}

.abstract p {
  color: var(--fg);
  font-size: 1.08rem;
  line-height: 1.7;
  text-align: justify;
}

.why-lead {
  color: var(--fg);
  font-size: 1.04rem;
  line-height: 1.65;
  margin: 0 0 2rem;
  max-width: 680px;
}

.why-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem 2.5rem;
}

.why-item {
  border-left: 2px solid var(--accent);
  padding-left: 1.1rem;
}

.why-item h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.why-item p {
  font-size: 0.98rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

.approach .dek {
  color: var(--fg);
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 680px;
  margin: 0 0 2.5rem;
}

.figure-intro h3 {
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.figure-intro p {
  font-size: 0.98rem;
  color: var(--fg);
  margin: 0 0 1rem;
  max-width: 680px;
}

/* ---------- diagram figures (shared by Methods and Timeline) ---------- */
figure {
  width: 100vw;
  max-width: 1080px;
  margin: 0 0 2.5rem 50%;
  transform: translateX(-50%);
  padding: 0 1.5rem;
  box-sizing: border-box;
}

.scroller {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

figure svg {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
}

.hint {
  display: none;
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

@media (max-width: 960px) {
  .hint {
    display: block;
  }
}

.fig-title {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  fill: var(--muted);
}

.fig-label {
  font-family: var(--sans);
  font-size: 13.5px;
  font-weight: 600;
  fill: var(--fg);
}

.fig-label.on-dark {
  fill: var(--dark-fg);
}

.fig-sublabel {
  font-family: var(--sans);
  font-size: 11px;
  fill: var(--muted);
}

.fig-sublabel.on-dark {
  fill: #a7acb5;
}

.fig-box {
  fill: #ffffff;
  stroke: var(--border);
  stroke-width: 1;
}

.fig-box.tint {
  fill: var(--tint);
  stroke: var(--accent);
}

.fig-box.mid {
  fill: var(--tint);
  stroke: var(--accent);
  stroke-width: 2;
}

.fig-box.dark {
  fill: var(--dark-bg);
  stroke: var(--dark-bg);
}

.fig-arrow {
  stroke: var(--muted);
  stroke-width: 1.25;
  fill: none;
}

.fig-arrow-head {
  fill: var(--muted);
}

.fig-field {
  font-family: var(--mono);
  font-size: 11px;
  fill: var(--fg);
}

.fig-dot-public {
  fill: var(--accent);
}

.fig-dot-restricted {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

/* ---------- incident timeline (Figure 3) ---------- */
.tl-grid {
  stroke: var(--border);
  stroke-width: 1;
}

.tl-lane {
  stroke: var(--border);
  stroke-width: 1;
}

.tl-month {
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: 0.03em;
  fill: var(--muted);
}

.tl-lane-label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 600;
  fill: var(--fg);
}

.tl-dot-primary {
  fill: var(--accent);
  opacity: 0.4;
}

.tl-dot-primary-key {
  fill: var(--accent);
  stroke: var(--dark-bg);
  stroke-width: 1;
}

.tl-dot-secondary {
  fill: var(--bg);
  stroke: var(--muted);
  stroke-width: 1.25;
  opacity: 0.75;
}

.tl-key-label {
  font-family: var(--sans);
  font-size: 10px;
  font-weight: 600;
  fill: var(--fg);
}

.tl-key-date {
  font-family: var(--mono);
  font-size: 9px;
  fill: var(--muted);
}

.tl-leader {
  stroke: var(--border);
  stroke-width: 1;
}

.tl-legend {
  font-family: var(--sans);
  font-size: 10.5px;
  fill: var(--muted);
}

/* ---------- written steps ---------- */
.approach .steps {
  border-top: 1px solid var(--border);
}

.approach .step {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 0 2rem;
  padding: 2.1rem 0;
  border-bottom: 1px solid var(--border);
}

.approach .step-label {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.approach .key {
  display: flex;
  height: 6px;
  width: 56px;
  border-radius: 1px;
  overflow: hidden;
}

.approach .key i {
  flex: 1;
  display: block;
}

.approach .step h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.006em;
  line-height: 1.25;
  margin: 0;
}

.approach .step h3 em {
  display: block;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

.approach .step p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--fg);
  line-height: 1.6;
  max-width: 620px;
}

.approach .step p + p {
  margin-top: 0.6rem;
}

.approach .regimes {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.approach .regime {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0 1.5rem;
  align-items: start;
}

.approach .regime .rname {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--fg);
}

.approach .regime .rname span {
  font-weight: 400;
  color: var(--muted);
}

.approach .regime p {
  font-size: 0.92rem;
}

@media (max-width: 760px) {
  .approach .step {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .approach .regime {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .approach .regime .chip {
    max-width: 180px;
  }
}

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

/* ---------- reference implementation ---------- */
.demo .dek {
  color: var(--fg);
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 680px;
  margin: 0 0 1.1rem;
}

.demo .dek a {
  color: var(--accent);
}

.demo-outro {
  font-size: 0.95rem;
  color: var(--muted);
}

.demo-outro a {
  color: var(--accent);
}

.stats {
  display: flex;
  flex-wrap: wrap;
  margin: 0 0 2rem;
  padding: 1.25rem 0;
}

.stat {
  flex: 1 1 0;
  min-width: 160px;
  padding: 0 1.5rem;
}

.stat + .stat {
  border-left: 1px solid var(--border);
}

.stat-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 640px) {
  .stats {
    flex-direction: column;
  }

  .stat {
    padding: 0.75rem 0;
  }

  .stat + .stat {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  margin: 0 0 0.5rem;
}

caption {
  caption-side: top;
  text-align: left;
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--muted);
  margin-bottom: 0.85rem;
}

caption strong {
  color: var(--fg);
  font-weight: 600;
}

th,
td {
  text-align: left;
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

th {
  font-weight: 600;
  color: var(--muted);
  border-bottom: 2px solid var(--fg);
}

tbody tr:last-child td {
  border-bottom: none;
}

.note {
  font-size: 0.98rem;
  color: var(--muted);
}

.discussion p {
  font-size: 1rem;
  color: var(--fg);
  line-height: 1.65;
  max-width: 700px;
}

.bibtex pre {
  background: var(--dark-bg);
  color: var(--dark-fg);
  border: 1px solid #2a2d33;
  border-radius: var(--radius-md);
  padding: 1.1rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.82rem;
  box-shadow: var(--shadow-sm);
}

footer {
  width: 100vw;
  margin: 3.5rem 0 0 50%;
  transform: translateX(-50%);
  background: var(--dark-bg);
  color: #b7bcc4;
  font-size: 1rem;
  line-height: 1.6;
}

footer::before {
  content: "";
  display: block;
  height: 6px;
  background: linear-gradient(
    to right,
    var(--highlight) 0%,
    var(--accent) 55%,
    var(--dark-bg) 100%
  );
}

.footer__container {
  max-width: 840px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
}

footer p {
  margin: 0 auto;
  max-width: 480px;
}

.footer-brand {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--dark-fg);
}

.footer-brand a {
  text-decoration: none;
  color: var(--dark-fg);
}

.footer-brand a:hover {
  text-decoration: underline;
}

.footer-text {
  display: block;
  font-size: 0.9rem;
}

.footer-icon {
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  margin-right: 0.3rem;
}

footer a {
  color: var(--highlight);
}

footer a:hover {
  text-decoration: underline;
}

a {
  color: var(--accent);
}
