/* =================================================================
   VC-Tooler — Project Page
   Inspired by the academic-project-page-template (Nerfies / VideoScore2).
   ================================================================= */

:root {
  --bg: #ffffff;
  --bg-soft: #f6f8fa;
  --bg-band: #f0f3f6;
  --fg: #1f2328;
  --fg-soft: #57606a;
  --accent: #1f6feb;
  --accent-2: #6e40c9;
  --border: #d0d7de;
  --pill-bg: #1f2328;
  --pill-fg: #ffffff;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --max-w: 1080px;
  --radius: 14px;
  --font-sans: "Inter", "Helvetica Neue", "Segoe UI", system-ui,
               "PingFang SC", "Hiragino Sans GB", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

code, pre {
  font-family: var(--font-mono);
}

/* ---------- Layout ---------- */

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

section { padding: 56px 0; }
section.band { background: var(--bg-band); }
section.soft { background: var(--bg-soft); }

h1, h2, h3, h4 { font-weight: 700; color: var(--fg); margin: 0 0 16px; }
h2.section-title {
  font-size: 36px;
  text-align: center;
  margin-bottom: 32px;
  letter-spacing: -0.01em;
}

p { margin: 0 0 16px; color: var(--fg); }
p.lead { font-size: 18px; color: var(--fg-soft); }

/* ---------- Hero ---------- */

.hero {
  padding: 72px 24px 48px;
  text-align: center;
  background: linear-gradient(180deg, #fbfcfd 0%, #ffffff 100%);
}
.hero h1 {
  font-size: 56px;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  background: linear-gradient(90deg, #1f6feb 0%, #6e40c9 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero h2.subtitle {
  font-size: 28px;
  font-weight: 500;
  color: var(--fg-soft);
  margin-bottom: 28px;
  letter-spacing: -0.005em;
}
.hero .authors {
  font-size: 18px;
  margin: 0 auto 6px;
  max-width: 880px;
  color: var(--fg);
}
.hero .authors sup { color: var(--accent); }
.hero .affil {
  color: var(--fg-soft);
  font-size: 16px;
  margin-bottom: 14px;
}
.hero .note {
  color: var(--fg-soft);
  font-size: 15px;
  margin-bottom: 24px;
}

/* ---------- Pill button row ---------- */

.pill-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin: 28px 0 12px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--pill-bg);
  color: var(--pill-fg);
  border-radius: 999px;
  font-size: 15px;
  font-weight: 500;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.pill:hover {
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
  opacity: 0.95;
}
.pill svg { width: 18px; height: 18px; }

/* ---------- Teaser ---------- */

.teaser {
  margin: 36px auto 0;
  max-width: 920px;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.teaser img { width: 100%; }
.teaser .caption {
  padding: 14px 22px;
  font-size: 15px;
  color: var(--fg-soft);
  text-align: left;
  border-top: 1px solid var(--border);
  background: #fbfcfd;
}

/* ---------- Section content ---------- */

.section-body { max-width: 880px; margin: 0 auto; }
.section-body p { font-size: 17px; }

/* Justify body prose for a clean block edge, keep hyphenation graceful. */
.section-body p,
.grid-2 p,
.teaser .caption {
  text-align: justify;
  text-justify: inter-word;
  -webkit-hyphens: auto;
  hyphens: auto;
}

/* ---------- Highlights cards ---------- */

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-top: 8px;
}
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  font-size: 30px;
  background: var(--bg-soft);
  border-radius: 50%;
}
.card h4 {
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--fg);
}
.card p {
  font-size: 15px;
  color: var(--fg-soft);
  margin: 0;
  line-height: 1.55;
}

/* ---------- Figure ---------- */

figure {
  margin: 0 auto 24px;
  max-width: 100%;
  text-align: center;
}
figure img {
  margin: 0 auto;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
}
figcaption {
  margin-top: 10px;
  font-size: 14px;
  color: var(--fg-soft);
  text-align: center;
  padding: 0 12px;
}

/* ---------- Two-column ---------- */

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: center;
}
@media (max-width: 800px) {
  .grid-2 { grid-template-columns: 1fr; }
  .cards  { grid-template-columns: 1fr; }
}

/* ---------- Equal-height figure row ----------
   Two figures side by side on one row, both images the SAME height even when
   their aspect ratios differ (e.g. a wide 3:1 chart next to a square word cloud).
   Each column widens/narrows to its image's natural aspect ratio at that height. */
.equal-figs {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
}
.equal-figs figure {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.equal-figs figure img {
  height: 240px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
@media (max-width: 760px) {
  .equal-figs { flex-wrap: wrap; align-items: center; }
  .equal-figs figure img { height: auto; width: 100%; }
}

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; }
table.results {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
table.results th, table.results td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
table.results th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--fg);
  position: sticky;
  top: 0;
}
table.results td:first-child, table.results th:first-child {
  text-align: left;
  white-space: nowrap;
}
table.results tr.group-head th {
  background: #eaeef2;
  text-align: left;
  font-style: italic;
  color: var(--fg-soft);
  font-weight: 600;
}
table.results tr.ours td { background: #f1f6ff; font-weight: 600; }
table.results tr.delta td { color: var(--accent); font-weight: 600; }
table.results td.best { font-weight: 700; }
table.results td.second { text-decoration: underline; }

/* ---------- BibTeX ---------- */

.bibtex {
  background: #0d1117;
  color: #c9d1d9;
  border-radius: 10px;
  padding: 20px 22px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  overflow-x: auto;
  white-space: pre;
}

/* ---------- Case study ---------- */

.case {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.case h4 { color: var(--accent-2); margin-bottom: 12px; font-size: 17px; }
.case .turns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.turn {
  background: var(--bg-soft);
  border-radius: 10px;
  padding: 14px;
  font-size: 14.5px;
}
.turn .turn-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.turn pre.tool-call {
  background: #0d1117;
  color: #79c0ff;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  overflow-x: auto;
  margin: 8px 0 0;
  white-space: pre-wrap;
}
.case-img-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.case-img-row img {
  height: 130px;
  width: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ---------- Footer ---------- */

footer {
  background: #0d1117;
  color: #8b949e;
  padding: 30px 24px;
  text-align: center;
  font-size: 14px;
}
footer a { color: #79c0ff; }

/* ---------- Responsive ---------- */

@media (max-width: 720px) {
  .hero h1 { font-size: 38px; }
  .hero h2.subtitle { font-size: 22px; }
  h2.section-title { font-size: 28px; }
  body { font-size: 16px; }
}

/* ---- Collapsible tool-schema cards ---- */
details.tool-schema {
  border: 2px solid var(--border);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
  transition: box-shadow .2s, border-color .2s;
}
details.tool-schema:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 10px rgba(31,111,235,.12);
}
details.tool-schema[open] {
  border-color: var(--accent);
  box-shadow: 0 4px 14px rgba(31,111,235,.14);
}

/* summary row — clearly clickable */
details.tool-schema summary {
  cursor: pointer;
  padding: 14px 18px;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: linear-gradient(180deg, #f0f5fb 0%, #e6edf5 100%);
  border-bottom: 1px solid transparent;
  border-left: 4px solid var(--accent);
  transition: background .15s;
}
details.tool-schema:hover summary {
  background: linear-gradient(180deg, #e8f0fb 0%, #dae3f0 100%);
}
details.tool-schema[open] summary {
  border-bottom-color: var(--border);
  background: linear-gradient(180deg, #dce8f7 0%, #cfdbeb 100%);
}

details.tool-schema summary::-webkit-details-marker { display: none; }

/* chevron icon — rotates on expand */
details.tool-schema summary::after {
  content: '\25B6';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  font-size: 10px;
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--accent);
  transition: transform .18s ease, background .15s;
  flex-shrink: 0;
}
details.tool-schema:hover summary::after {
  background: var(--accent);
  color: #fff;
}
details.tool-schema[open] > summary::after {
  transform: rotate(90deg);
  background: var(--accent);
  color: #fff;
}

/* schema name */
.schema-name code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  font-size: 14px;
  color: var(--accent-2);
  background: rgba(110,64,201,.08);
  padding: 3px 8px;
  border-radius: 4px;
}

/* category tag (pill) */
.schema-tag {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: 3px 10px;
  border-radius: 999px;
  color: #fff;
}
.schema-tag.tag-edit   { background: #e67e22; }
.schema-tag.tag-ground { background: #27ae60; }
.schema-tag.tag-math   { background: #8e44ad; }
.schema-tag.tag-text   { background: #2980b9; }

/* code block */
details.tool-schema pre {
  margin: 0;
  padding: 18px 22px;
  background: #1e1e2e;
  color: #cdd6f4;
  font-size: 13px;
  line-height: 1.55;
  overflow-x: auto;
  border-top: 1px solid var(--border);
}
details.tool-schema pre code {
  font-family: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
  white-space: pre;
  display: block;
}
