/* CoupleFlow project page. Plain static CSS, no build step. */

:root {
  color-scheme: light;
  --bg: #fbfbf9;
  --surface: #ffffff;
  --surface-2: #f2f3f5;
  --text: #1d1f22;
  --muted: #5a5f67;
  --faint: #8a8f97;
  --border: #e2e4e8;
  --link: #1f63b8;
  --btn-bg: #1d1f22;
  --btn-text: #ffffff;
  --btn-hover: #3a3d42;
  /* figure palette from Fig. 1: neural (blue), acoustic (orange), coupling (green) */
  --neural: #2a78d6;
  --acoustic: #d9572a;
  --coupling: #138a60;
  --ours-bg: rgba(42, 120, 214, 0.075);
  --tldr-bg: #f1f6fd;
  --prop-bg: #f3faf6;
  --code-bg: #f4f5f7;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.04);
  --radius: 12px;
  --maxw: 960px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121315;
    --surface: #1a1c1f;
    --surface-2: #222529;
    --text: #e6e7e9;
    --muted: #a6abb3;
    --faint: #7d838c;
    --border: #2f3338;
    --link: #8dbdf6;
    --btn-bg: #e6e7e9;
    --btn-text: #121315;
    --btn-hover: #c9ccd1;
    --neural: #6ba9f2;
    --acoustic: #f08a5d;
    --coupling: #4cc896;
    --ours-bg: rgba(107, 169, 242, 0.12);
    --tldr-bg: #172131;
    --prop-bg: #15231d;
    --code-bg: #1d2024;
    --shadow: none;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 64px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

a {
  color: var(--link);
  text-underline-offset: 2px;
}

.container {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 16px;
}

/* ---------------------------------------------------------------- hero */
.hero {
  text-align: center;
  padding: 56px 0 28px;
}

.hero h1 {
  margin: 0 auto 18px;
  max-width: 880px;
  font-size: clamp(1.55rem, 1.05rem + 2.2vw, 2.45rem);
  line-height: 1.22;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero h1 .name {
  display: block;
  font-size: 1.25em;
  margin-bottom: 6px;
}

.authors {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 1.02rem;
}

.authors p {
  margin: 0;
}

.author-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 28px;
  color: var(--text);
  font-size: 1.12rem;
  font-weight: 600;
}

.authors .affiliation {
  margin-top: 4px;
}

.authors .emails {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 20px;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 0.86rem;
}

.emails a {
  color: var(--muted);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn:hover,
.btn:focus-visible {
  background: var(--btn-hover);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

/* a button whose target does not exist yet (arXiv before posting) */
.btn-placeholder,
.btn-placeholder:hover {
  background: transparent;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
  cursor: default;
}

.btn-placeholder .soon {
  font-weight: 400;
}

/* ---------------------------------------------------------------- nav */
.toc {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.toc ul {
  display: flex;
  gap: 4px;
  margin: 0 auto;
  padding: 8px 16px;
  max-width: var(--maxw);
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  white-space: nowrap;
}

.toc ul::-webkit-scrollbar {
  display: none;
}

.toc a {
  display: block;
  padding: 4px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.toc a:hover,
.toc a:focus-visible {
  background: var(--surface-2);
  color: var(--text);
}

/* ---------------------------------------------------------------- sections */
section {
  padding: 40px 0 8px;
}

h2 {
  margin: 0 0 16px;
  font-size: 1.6rem;
  line-height: 1.3;
  letter-spacing: -0.005em;
}

h3 {
  margin: 34px 0 10px;
  font-size: 1.18rem;
  line-height: 1.35;
}

p {
  margin: 0 0 14px;
}

ul,
ol {
  margin: 0 0 16px;
  padding-left: 1.3em;
}

li {
  margin-bottom: 8px;
}

.lead {
  color: var(--muted);
  margin-top: -6px;
}

.tldr {
  margin: 8px 0 0;
  padding: 18px 20px;
  border-left: 4px solid var(--neural);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--tldr-bg);
}

.tldr p {
  margin: 0;
}

.abstract p {
  text-align: justify;
  hyphens: auto;
}

/* ---------------------------------------------------------------- stat tiles */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 18px 0 22px;
}

.stat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat .value {
  display: block;
  font-size: 1.55rem;
  font-weight: 700;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat .value.up {
  color: var(--acoustic);
}

.stat .value.down {
  color: var(--neural);
}

.stat .label {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

/* ---------------------------------------------------------------- figures */
figure {
  margin: 24px 0 28px;
}

.fig-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff; /* figures converted from PDF have white backgrounds */
  box-shadow: var(--shadow);
}

.fig-card img {
  display: block;
  width: 100%;
  height: auto;
}

figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

figcaption b,
.tab-caption b {
  color: var(--text);
}

.fig-row {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 20px;
  align-items: start;
}

.fig-row figure {
  margin: 0;
}

/* ---------------------------------------------------------------- tables */
.table-block {
  margin: 20px 0 28px;
}

.tab-caption {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 7px 9px;
  text-align: center;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

thead th {
  background: var(--surface-2);
  font-weight: 600;
}

thead tr:first-child th {
  border-bottom-color: transparent;
}

thead tr + tr th {
  font-weight: 500;
  color: var(--muted);
}

tbody th {
  text-align: left;
  font-weight: 500;
}

thead th.left {
  text-align: left;
}

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

tr.sep th,
tr.sep td {
  border-top: 2px solid var(--border);
}

tr.subhead th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
  background: var(--surface-2);
}

td.ours,
th.ours {
  background: var(--ours-bg);
}

td.group-start,
th.group-start {
  border-left: 1px solid var(--border);
}

td.left {
  text-align: left;
}

.pm {
  margin-left: 1px;
  font-size: 0.78em;
  color: var(--muted);
}

table strong {
  font-weight: 700;
}

.note {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 0.82rem;
}

/* ---------------------------------------------------------------- math and propositions */
.eq {
  margin: 16px 0 18px;
  padding: 6px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 0;
}

.prop {
  margin: 18px 0 20px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--coupling);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--prop-bg);
}

.prop p:last-child {
  margin-bottom: 0;
}

.prop .prop-title {
  font-weight: 700;
}

/* ---------------------------------------------------------------- bibtex */
.bibtex {
  position: relative;
}

.bibtex pre {
  margin: 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 0.85rem;
  line-height: 1.55;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: 600 0.8rem var(--font);
  cursor: pointer;
}

.copy-btn:hover,
.copy-btn:focus-visible {
  background: var(--surface-2);
}

/* ---------------------------------------------------------------- footer */
footer {
  margin-top: 48px;
  padding: 24px 0 40px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: 0.85rem;
}

footer p {
  margin: 0 0 6px;
}

/* ---------------------------------------------------------------- small screens */
@media (max-width: 720px) {
  body {
    font-size: 16px;
  }

  .hero {
    padding: 36px 0 20px;
  }

  .fig-row {
    grid-template-columns: 1fr;
  }

  .fig-row figure + figure {
    margin-top: 8px;
  }

  .fig-card {
    padding: 8px;
  }

  .abstract p {
    text-align: left;
  }

  .bibtex pre {
    padding-top: 48px;
  }
}

/* column-group dividers in table bodies */
.t-main tbody td:nth-child(3),
.t-main tbody td:nth-child(7),
.t-main tbody td:nth-child(11),
.t-main tbody td:nth-child(15),
.t-spatial tbody td:nth-child(2),
.t-spatial tbody td:nth-child(4),
.t-spatial tbody td:nth-child(6),
.t-spatial tbody td:nth-child(8),
.t-track tbody td:nth-child(2),
.t-track tbody td:nth-child(4),
.t-loso tbody td:nth-child(2),
.t-loso tbody td:nth-child(3),
.t-loso tbody td:nth-child(7) {
  border-left: 1px solid var(--border);
}

/* Table 1 has 16 columns: keep it inside the 960px column on desktop */
.t-main {
  font-size: 0.82rem;
}

.t-main th,
.t-main td {
  padding: 6px 5px;
}

.fig-card a {
  display: block;
}
