/* attacca.css: page styles for the Attacca project page.
   The carousel (stage-carousel.css) and comparison (compare.css) components read the
   --primary-color / --text-* / --border-* names, so they are mapped onto the page tokens below. */

:root {
  --bg: #ffffff;
  --bg-alt: #f7f7f5;
  --surface: #ffffff;
  --ink: #14161b;
  --ink-2: #3a3f4b;
  --muted: #6b7180;
  --faint: #9aa0ab;
  --line: #e7e8eb;
  --line-strong: #d4d7dd;
  --accent: #0f766e;
  --accent-ink: #0b5c56;
  --accent-soft: #e8f3f1;
  --stage: #0b0d11;
  --radius: 14px;
  --wrap: 1120px;
  --narrow: 760px;
  --shadow: 0 1px 2px rgba(16, 18, 24, 0.05), 0 10px 30px rgba(16, 18, 24, 0.07);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* names used by stage-carousel.css and compare.css */
  --primary-color: var(--accent);
  --text-primary: var(--ink);
  --text-secondary: var(--muted);
  --border-color: var(--line);
  --background-accent: #f1f2f4;
  --background-secondary: var(--bg-alt);
  --border-radius: 12px;
  --shadow-lg: var(--shadow);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, video { max-width: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid #f2c94c; outline-offset: 2px; }
h1, h2, h3, p, ul, ol, figure { margin: 0; }
b, strong { font-weight: 650; color: var(--ink); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 28px; }
.wrap.narrow { max-width: calc(var(--narrow) + 56px); }

/* ---- top bar ------------------------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.topbar.is-scrolled { border-bottom-color: var(--line); }
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 56px; }
.brand { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; color: var(--ink); }
.brand:hover { text-decoration: none; }
.toc { display: flex; gap: 22px; margin-left: auto; }
.toc a { color: var(--muted); font-size: 14px; font-weight: 500; }
.toc a:hover, .toc a.is-current { color: var(--ink); text-decoration: none; }

/* ---- hero ---------------------------------------------------------------------------------- */
.hero { padding: 76px 0 40px; text-align: center; }
.title { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.wordmark { font-size: 64px; font-weight: 800; letter-spacing: -0.035em; line-height: 1; color: var(--ink); }
.subtitle {
  max-width: 820px;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.3;
  color: var(--ink-2);
}
.authors, .affils { display: flex; flex-wrap: wrap; justify-content: center; list-style: none; padding: 0; }
.authors { gap: 6px 28px; margin-top: 30px; font-size: 18px; font-weight: 550; }
.authors sup, .affils sup { font-size: 0.62em; margin-left: 1px; color: var(--muted); }
.authors a { color: inherit; }
.affils { gap: 6px 22px; margin-top: 8px; font-size: 15.5px; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 28px; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 14.5px;
  font-weight: 600;
}
.btn:hover { background: #2a2e37; text-decoration: none; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.is-ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.is-ghost:hover { background: var(--bg-alt); }
.btn.is-disabled { background: #e9eaed; color: var(--muted); cursor: default; }
.btn .soon {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ---- media frames -------------------------------------------------------------------------- */
.video-frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--stage);
  box-shadow: var(--shadow);
}
.video-frame video { display: block; width: 100%; height: auto; }
.hero-media { padding: 8px 0 72px; }
.hero-media .video-frame { aspect-ratio: 1920 / 810; }
.hero-media .video-frame video { height: 100%; object-fit: cover; }

.video-toggle {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 17, 22, 0.6);
  color: #fff;
  cursor: pointer;
  opacity: 0.85;
}
.video-toggle:hover { opacity: 1; background: rgba(15, 17, 22, 0.82); }
.video-toggle svg { width: 15px; height: 15px; }
.video-toggle .icon-play { display: none; }
.video-toggle.is-paused .icon-play { display: block; }
.video-toggle.is-paused .icon-pause { display: none; }

/* ---- sections ------------------------------------------------------------------------------ */
.section { padding: 84px 0; }
.section.is-alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: var(--narrow); margin: 0 auto 36px; text-align: center; }
.eyebrow {
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h2 { font-size: 34px; font-weight: 750; letter-spacing: -0.022em; line-height: 1.2; color: var(--ink); }
.lead { margin-top: 14px; font-size: 18px; line-height: 1.7; color: var(--ink-2); }
h3 { font-size: 21px; font-weight: 700; letter-spacing: -0.012em; line-height: 1.3; color: var(--ink); }
.sub { margin-top: 72px; }
.sub-head { max-width: var(--narrow); margin: 0 auto 26px; text-align: center; }
.sub-head p { margin-top: 10px; color: var(--ink-2); font-size: 16.5px; }

/* ---- TL;DR --------------------------------------------------------------------------------- */
.tldr {
  padding: 28px 32px 30px;
  border: 1px solid #cfe3df;
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.tldr-label {
  margin-bottom: 14px;
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.tldr ul { display: grid; gap: 12px; padding-left: 1.1em; }
.tldr li { font-size: 17px; line-height: 1.65; color: var(--ink-2); }
.tldr li::marker { color: var(--accent); }

/* ---- figures ------------------------------------------------------------------------------- */
.figure { margin: 0 auto; }
.figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  background: #fff;
}
.figure.is-framed img { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.figure figcaption {
  max-width: var(--narrow);
  margin: 14px auto 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--muted);
  text-align: center;
}
.figure figcaption b { color: var(--ink-2); }
.figure.is-mid { max-width: 920px; }

/* ---- numbered cards ------------------------------------------------------------------------ */
.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 40px;
  padding: 0;
  list-style: none;
}
.card {
  padding: 24px 24px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.card-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
}
.card h3 { font-size: 18px; margin-bottom: 8px; }
.card p { font-size: 15.5px; line-height: 1.65; color: var(--ink-2); }
.section.is-alt .card { background: #fff; }

/* ---- key numbers --------------------------------------------------------------------------- */
.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stat { padding: 24px 22px 22px; text-align: center; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat-num {
  display: block;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.stat-label { display: block; margin-top: 8px; font-size: 14px; line-height: 1.45; color: var(--muted); }

/* ---- tables -------------------------------------------------------------------------------- */
.table-wrap { max-width: 900px; margin: 30px auto 0; overflow-x: auto; }
.table-title { margin-bottom: 10px; font-size: 15px; font-weight: 700; color: var(--ink); text-align: left; }
.rtable { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.rtable th, .rtable td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.rtable thead th {
  border-bottom: 1.5px solid var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.rtable .num { text-align: right; white-space: nowrap; }
.rtable tr.group td {
  padding-top: 16px;
  border-bottom: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.rtable tr.is-ours td { background: var(--accent-soft); font-weight: 700; color: var(--ink); }
.rtable tr.is-ours td:first-child { border-radius: 8px 0 0 8px; }
.rtable tr.is-ours td:last-child { border-radius: 0 8px 8px 0; }
.rtable td .dim { color: var(--muted); font-weight: 400; }
.table-note { max-width: 900px; margin: 12px auto 0; font-size: 14px; line-height: 1.6; color: var(--muted); }
.rtable.is-compact { max-width: 640px; margin: 0 auto; }

/* ---- chain player -------------------------------------------------------------------------- */
.lh-wrap { max-width: 900px; margin: 0 auto; }
.seg { display: flex; justify-content: center; margin-bottom: 18px; }
.seg ul {
  display: inline-flex;
  gap: 4px;
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 999px;
  background: #eceef1;
}
.seg a {
  display: block;
  padding: 7px 18px;
  border-radius: 999px;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 600;
  white-space: nowrap;
}
.seg a:hover { text-decoration: none; color: var(--ink); }
.seg li.is-active a { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 18, 24, 0.12); }
.media-note { max-width: var(--narrow); margin: 16px auto 0; font-size: 14.5px; line-height: 1.6; color: var(--muted); text-align: center; }

/* ---- analysis ------------------------------------------------------------------------------ */
.pair-figs { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: center; }
.cmp-section { margin-top: 56px; }
.cmp-block { padding-top: 34px; border-top: 1px solid var(--line); }
.cmp-block + .cmp-block { margin-top: 34px; }
.cmp-block-head { max-width: var(--narrow); margin: 0 auto 18px; text-align: center; }
.cmp-block-head h3 { font-size: 18px; }
.cmp-block-head p { margin-top: 6px; font-size: 15.5px; color: var(--ink-2); }
.cmp-labels .is-ours { color: var(--accent-ink); }

/* ---- abstract and citation ----------------------------------------------------------------- */
.abstract-text { font-size: 16.5px; line-height: 1.8; color: var(--ink-2); }
.bibtex { position: relative; margin-top: 22px; }
.bibtex pre {
  margin: 0;
  padding: 22px 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-alt);
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--ink-2);
}
.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink-2);
  font: 600 13px var(--font);
  cursor: pointer;
}
.copy-btn:hover { background: var(--bg-alt); }

.footer { padding: 36px 0 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13.5px; text-align: center; }

/* ---- responsive ---------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { border-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .pair-figs { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 18px; }
  .toc { display: none; }
  .hero { padding: 48px 0 28px; }
  .wordmark { font-size: 46px; }
  .subtitle { font-size: 20px; }
  .authors { font-size: 16.5px; margin-top: 22px; }
  .affils { font-size: 14.5px; }
  .section { padding: 60px 0; }
  .hero-media { padding-bottom: 56px; }
  h2 { font-size: 27px; }
  .lead { font-size: 16.5px; }
  .tldr { padding: 22px 20px 24px; }
  .tldr li { font-size: 16px; }
  .stat-num { font-size: 26px; }
  .rtable { font-size: 13.5px; }
  .rtable th, .rtable td { padding: 8px 8px; }
  .seg ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; border-radius: 14px; }
  .seg a { padding: 7px 6px; font-size: 13px; text-align: center; white-space: normal; border-radius: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

/* tighter result tables */
.table-wrap { max-width: 720px; }
.table-note { max-width: 720px; }
.rtable th:first-child, .rtable td:first-child { width: 44%; }
.rtable .num { width: 18%; }
@media (max-width: 760px) {
  .rtable th:first-child, .rtable td:first-child, .rtable .num { width: auto; }
  .rtable thead th { white-space: normal; font-size: 12px; }
  .rtable { font-size: 13px; }
  .rtable th, .rtable td { padding: 7px 6px; }
}
@media (max-width: 760px) {
  .rtable thead th.num { white-space: normal; }
}

/* Analysis figure pair: images share one row and captions share the next, so (a) and (b) line up */
@media (min-width: 961px) {
  .pair-figs { grid-template-rows: auto auto; grid-auto-flow: column; row-gap: 0; align-items: start; }
  .pair-figs > .figure { display: contents; }
  .pair-figs > .figure > img { align-self: center; }
  .pair-figs > .figure > figcaption { margin-top: 14px; }
}
.figure.is-mid figcaption { max-width: 920px; }

/* keep the TL;DR close to the hero video */
.hero-media { padding-bottom: 36px; }
#overview { padding-top: 44px; }
@media (max-width: 760px) {
  .hero-media { padding-bottom: 28px; }
  #overview { padding-top: 32px; }
}

/* hero caption: one sentence per line on wide screens */
.media-note.hero-caption { max-width: none; }
.figure figcaption.wide-caption { max-width: none; }
