/* SPLIT project page — paper-specific styles layered on top of index.css */

:root {
  --split-accent: #dc2626;
  --split-accent-soft: #fef2f2;
  --split-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  /* WCAG AA on white, --background-secondary and --split-accent-soft */
  --split-muted: #5f6b7a;
  /* Darker red for small text on --split-accent-soft, where --split-accent is only 4.41:1 */
  --split-accent-ink: #b91c1c;
}

/* ---------- Venue badge ---------- */
.venue-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.35rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--background-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.venue-badge .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--split-accent);
}

/* ---------- Title ---------- */
.publication-title .split-mark {
  font-weight: 800;
  color: var(--split-accent);
}

.title-sub {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.52em;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text-secondary);
}

.author-affil {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.author-affil sup {
  font-weight: 700;
  color: var(--text-primary);
}

/* ---------- Layout containment ---------- */
/* Bulma's .hero is `display:flex; flex-direction:column`, so .container is a
   flex item. Its `margin: 0 auto` sits on the cross axis, which suppresses the
   stretch that would otherwise size it to the parent, leaving it sized by
   content: the `white-space: pre` BibTeX block and the nowrap table cells
   inflated it to 1294px and 605px inside a 375px viewport. .hero's
   overflow:hidden then clipped that instead of letting the inner scroller work,
   so the document reported no overflow while content was cut off and iOS panned.
   Giving the container a definite width is what contains it.

   Deliberately no max-width here: Bulma's own container caps (960/1152/1344px,
   and 960 flat for is-max-desktop) must stay authoritative. */
.hero,
.hero-body,
.section {
  min-width: 0;
  max-width: 100%;
}

.hero > .container,
.hero-body > .container,
.section > .container {
  width: 100%;
  min-width: 0;
}

/* Columns need only the min-content floor removed. Setting a width here would
   override Bulma's explicit column widths (.is-four-fifths, .is-8) and fight
   the -0.75rem gutter margins on the row. */
.container > .columns,
.columns > .column {
  min-width: 0;
}

/* The BibTeX block is `white-space: pre`, so its min-content width is one long
   line. Wrap it instead of demanding ~1250px of horizontal scroll. */
pre,
pre#bibtex-code {
  min-width: 0;
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow-x: auto;
}

/* ---------- Section furniture ---------- */
.section-lead {
  max-width: 44rem;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-secondary);
}

.mini-title {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--split-muted);
  text-align: left;
}

/* ---------- Figures ---------- */
.figure {
  margin: 0;
}

.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: #fff;
}

.figure figcaption {
  margin-top: 0.9rem;
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  text-align: left;
}

.figure figcaption b {
  color: var(--text-primary);
}

.figure-row > * {
  min-width: 0;
}

.figure-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2.5rem;
  /* 1fr would be minmax(auto, 1fr): a wide table then grows its track
     instead of scrolling. Zero the floor and let the items shrink. */
  margin-top: 2rem;
  align-items: start;
}

/* ---------- Headline numbers ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 1rem;
  margin: 2.25rem 0 0;
}

.stat {
  padding: 1.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background-primary);
  text-align: center;
}

.stat .stat-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--split-accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat .stat-value .pct {
  font-size: 0.5em;
  font-weight: 700;
  margin-left: 0.1em;
}

.stat .stat-label {
  margin-top: 0.55rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.stat .stat-note {
  margin-top: 0.3rem;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--split-muted);
}

.stat .stat-note .vs {
  color: var(--text-secondary);
}

/* ---------- Takeaway list ---------- */
.takeaways {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.85rem 2rem;
  margin: 2.25rem 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.takeaways li {
  position: relative;
  padding-left: 1.5rem;
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.takeaways li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--split-accent);
}

.takeaways li b {
  color: var(--text-primary);
}

/* ---------- Method cards ---------- */
.method-grid > *,
.protocol-grid > *,
.stat-grid > *,
.takeaways > * {
  min-width: 0;
}

.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  text-align: left;
}

.method-card {
  padding: 1.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background-primary);
  box-shadow: var(--shadow-sm);
}

.method-card .tag {
  display: inline-block;
  margin-bottom: 0.7rem;
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  background: var(--split-accent-soft);
  font-family: var(--split-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--split-accent-ink);
}

.method-card h3 {
  margin: 0 0 0.75rem;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--text-primary);
}

.method-card p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

.eq {
  max-width: 100%;
  margin: 0 0 1rem;
  padding: 0.9rem 1rem;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 8px;
  background: var(--background-secondary);
  color: var(--text-primary);
  text-align: center;
}

/* ---------- KaTeX ---------- */
/* Display math: KaTeX adds its own vertical margin; the .eq box supplies padding. */
.eq .katex-display {
  margin: 0;
}

/* Inline math should ride the prose size, not KaTeX's default 1.21em. */
.katex {
  font-size: 1.05em;
}

.eq .katex-display > .katex {
  font-size: 1.12em;
}

/* A single scroller: the .eq box owns it, so a too-wide equation cannot nest
   two scrollbars or clip with no affordance. */
.katex-display {
  overflow: visible;
  padding: 0.15rem 0;
}



/* The MathML copy is for assistive tech and clipboard; keep it out of sight. */
.katex .katex-mathml {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  padding: 0;
  border: 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

/* ---------- Fusion strip ---------- */
.fusion-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
  margin-top: 1.5rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--border-color);
  border-left: 3px solid var(--split-accent);
  border-radius: var(--border-radius);
  background: var(--background-primary);
  text-align: left;
}

.fusion-strip .fusion-eq {
  flex: 0 0 auto;
  color: var(--text-primary);
}

.fusion-strip .fusion-eq .katex-display {
  margin: 0;
}

.fusion-strip .fusion-eq .katex-display > .katex {
  font-size: 1.2em;
}

.fusion-strip p {
  flex: 1 1 300px;
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ---------- Protocol ---------- */
.protocol-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-top: 2.25rem;
  text-align: left;
}

.protocol-item {
  padding-top: 0.5rem;
  border-top: 2px solid var(--border-color);
}

.protocol-item .num {
  display: inline-block;
  margin-bottom: 0.6rem;
  font-family: var(--split-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--split-accent);
}

.protocol-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.protocol-item p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* ---------- Tables ---------- */
.table-block {
  margin-top: 2.25rem;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background: var(--background-primary);
}

table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

table.results th,
table.results td {
  padding: 0.45rem 0.7rem;
  text-align: right;
  white-space: nowrap;
  border-bottom: 1px solid var(--border-color);
}

table.results thead th {
  background: var(--background-accent);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-primary);
}

table.results th.group {
  text-align: center;
  font-size: 0.74rem;
  letter-spacing: 0.02em;
}

table.results th:first-child,
table.results td:first-child {
  text-align: left;
  font-weight: 600;
}

table.results tbody th {
  background: none;
  font-size: inherit;
  font-weight: 600;
  color: var(--text-primary);
}

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

table.results tbody tr.group-sep td,
table.results tbody tr.group-sep th {
  border-top: 1px solid var(--border-color);
}

table.results tbody tr.ours {
  background: var(--split-accent-soft);
}

table.results tbody tr.ours td,
table.results tbody tr.ours th {
  color: var(--text-primary);
  font-weight: 700;
}

table.results tbody tr.ours td:first-child,
table.results tbody tr.ours th:first-child {
  color: var(--split-accent-ink);
}

table.results td.best {
  text-decoration: underline;
  text-decoration-color: var(--split-muted);
  text-underline-offset: 3px;
}

table.results td.runner {
  text-decoration: underline;
  text-decoration-color: var(--split-muted);
  text-underline-offset: 3px;
}

table.results .col-sep {
  border-left: 1px solid var(--border-color);
}

table.results td.dim,
.dim {
  color: var(--split-muted);
  font-weight: 400 !important;
}

/* Paired D3/SPLIT columns: highlight by column, since this table has no
   per-row "ours" class to tint. */
table.results .sp {
  background: var(--split-accent-soft);
}

table.results tbody td.sp {
  font-weight: 700;
  color: var(--text-primary);
}

table.results thead th.sp {
  color: var(--split-accent-ink);
}

table.results thead th.sub {
  font-size: 0.72rem;
  font-weight: 600;
}

table.results td.mark {
  text-align: center;
  color: var(--split-accent-ink);
}

table.results td.mark.off {
  color: var(--split-muted);
}

table.results.compact {
  font-size: 0.83rem;
}

table.results.compact th,
table.results.compact td {
  padding: 0.4rem 0.6rem;
}

/* Visually hidden, still announced */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-note {
  margin-top: 0.85rem;
  font-size: 0.87rem;
  line-height: 1.65;
  color: var(--text-secondary);
  text-align: left;
}

.table-note code {
  font-family: var(--split-mono);
  font-size: 0.9em;
}

/* ---------- Misc ---------- */
.inline-link {
  color: var(--primary-color);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.inline-link:hover {
  border-bottom-color: var(--primary-color);
}

kbd.metric {
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: var(--background-accent);
  font-family: var(--split-mono);
  font-size: 0.85em;
  color: var(--text-primary);
}

.ack {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--split-muted);
}

@media screen and (max-width: 768px) {
  .title-sub {
    font-size: 0.6em;
  }
  .hero-body {
    padding: 2.5rem 1.25rem;
  }
  table.results {
    font-size: 0.8rem;
  }
  .stat .stat-value {
    font-size: 2rem;
  }
  .fusion-strip {
    padding: 1.25rem;
  }
  .fusion-strip .fusion-eq {
    width: 100%;
    overflow-x: auto;
  }
  .fusion-strip .fusion-eq .katex-display > .katex {
    font-size: 1.05em;
  }
  .figure-row,
  .method-grid,
  .takeaways,
  .protocol-grid,
  .stat-grid {
    /* minmax(0, 1fr), not 1fr: see .figure-row above */
    grid-template-columns: minmax(0, 1fr);
  }
  .figure-row {
    gap: 2rem;
  }
  .method-card {
    padding: 1.25rem;
  }
  .eq {
    padding: 0.75rem 0.6rem;
  }
  .eq .katex-display > .katex {
    font-size: 0.95em;
  }
  .table-note,
  .section-lead {
    font-size: 0.9rem;
  }
}

/* Very narrow phones: shrink the hero type so the title cannot be clipped. */
@media screen and (max-width: 430px) {
  .publication-title {
    font-size: 1.6rem !important;
    line-height: 1.25 !important;
  }
  .title-sub {
    font-size: 0.72em;
  }
  .publication-authors {
    font-size: 0.95rem !important;
  }
  .author-affil {
    font-size: 0.85rem;
  }
  .hero-body {
    padding: 2rem 1rem;
  }
  .section {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  table.results {
    font-size: 0.78rem;
  }
  table.results th,
  table.results td {
    padding: 0.4rem 0.5rem;
  }
  .stat .stat-value {
    font-size: 1.9rem;
  }
  /* Fit the widest formula rather than leaving it to scroll unnoticed. */
  .eq .katex-display > .katex,
  .fusion-strip .fusion-eq .katex-display > .katex {
    font-size: 0.86em;
  }
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* JS sets the full "Copied!" string; drop the template's appended fragment */
.copy-bibtex-btn.copied .copy-text::after {
  content: none;
}
