/* Interactive panel styling: gate explorer and CHAIR caption browser. */

:root {
  --pass: #2e7d4f;
  --pass-bg: #e8f5ec;
  --fail: #c0392b;
  --fail-bg: #fdecea;
  --unk: #8a8a8a;
  --unk-bg: #f2f2f2;
  --rule: #e3e3e3;
  --ink: #363636;
  --muted: #6b6b6b;
  --accent: #2b6cb0;
}

.demo {
  font-family: 'Noto Sans', sans-serif;
  color: var(--ink);
}

.demo-hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.demo-note {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.85rem;
  line-height: 1.5;
}

/* ---------------------------------------------------------------- shared */

.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.pill-pass { background: var(--pass-bg); color: var(--pass); }
.pill-fail { background: var(--fail-bg); color: var(--fail); }
.pill-unk  { background: var(--unk-bg);  color: var(--unk); }
.pill-warn { background: #fdf1dd; color: #8a5a12; }

.mono {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.85em;
}

/* -------------------------------------------------------- gate explorer */

.gate-wrap {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
}

.gate-list {
  border: 1px solid var(--rule);
  border-radius: 8px;
  max-height: 900px;
  overflow-y: auto;
  background: #fff;
}

.gate-group {
  padding: 0.5rem 0.85rem 0.2rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #fafafa;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 1;
}

.gate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.55rem 0.85rem;
  border: 0;
  border-bottom: 1px solid #f0f0f0;
  background: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  font-size: 0.86rem;
  color: var(--ink);
}

.gate-row:hover { background: #f7fbff; }

.gate-row.is-active {
  background: #eaf3fb;
  box-shadow: inset 3px 0 0 var(--accent);
  font-weight: 600;
}

.gate-row-name { flex: 1; min-width: 0; }

.gate-dots { display: flex; gap: 3px; flex: none; }

.gate-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  display: inline-block;
}

.gate-dot.d-pass { background: #4caf7d; }
.gate-dot.d-fail { background: #e07a6f; }
.gate-dot.d-unk  { background: #d6d6d6; }

.gate-detail {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 1.25rem 1.4rem 1.4rem;
  background: #fff;
  min-width: 0;
}

.gate-detail h3 {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0 0 0.15rem;
}

.gate-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.gate-meta span::after { content: ' · '; }
.gate-meta span:last-child::after { content: ''; }

.gate-cards {
  display: grid;
  grid-template-columns: 1.55fr 1fr 1fr;
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}

.gate-card {
  border: 1px solid var(--rule);
  border-left-width: 3px;
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.gate-card.c-pass { border-left-color: var(--pass); }
.gate-card.c-fail { border-left-color: var(--fail); }
.gate-card.c-unk  { border-left-color: #d0d0d0; }

.gate-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
}

.gate-verdict { margin-bottom: 1rem; }

.gate-verdict .pill {
  font-size: 0.8rem;
  padding: 0.25rem 0.75rem;
}

.gate-card-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin: 0.15rem 0 0.35rem;
}

.gate-card-value.v-pass { color: var(--pass); }
.gate-card-value.v-fail { color: var(--fail); }

.gate-card-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  line-height: 1.4;
}

.gate-card-sub { font-size: 0.72rem; color: var(--muted); }

.gate-viz {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.4rem;
  margin-bottom: 1.1rem;
}

.viz-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.viz-caption { font-size: 0.74rem; color: var(--muted); margin-top: 0.3rem; }

.gate-viz svg { width: 100%; height: auto; display: block; }

.gate-behavior {
  border-top: 1px solid var(--rule);
  padding-top: 0.9rem;
  font-size: 0.85rem;
  line-height: 1.55;
}

.gate-behavior dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  margin-top: 0.5rem;
}

.gate-correction {
  margin-top: 0.9rem;
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  background: #fff8e6;
  border: 1px solid #f2dfa8;
  font-size: 0.78rem;
  line-height: 1.5;
  color: #7a5c14;
}

/* --------------------------------------------------------- CHAIR browser */

.chair-summary {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  margin-bottom: 1.4rem;
}

.chair-summary th,
.chair-summary td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  text-align: right;
}

.chair-summary th:first-child,
.chair-summary td:first-child { text-align: left; }

.chair-summary thead th {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.chair-summary tr.is-ours { background: #eef6f1; font-weight: 600; }

.chair-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-bottom: 1.1rem;
}

.chair-controls select,
.chair-controls button {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border: 1px solid #cfcfcf;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  color: var(--ink);
}

.chair-controls button:hover { background: #f2f8ff; border-color: var(--accent); }
.chair-controls button:disabled { opacity: 0.45; cursor: default; }

.chair-counter { font-size: 0.85rem; color: var(--muted); margin-left: auto; }

.chair-card {
  display: grid;
  grid-template-columns: minmax(0, 300px) minmax(0, 1fr);
  gap: 1.4rem;
  align-items: start;
}

.chair-image img {
  width: 100%;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--rule);
}

.chair-gt {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  line-height: 1.6;
  color: var(--muted);
}

.chair-gt b { color: var(--ink); }

.chair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
  min-width: 0;
}

.cap-box {
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.7rem 0.85rem;
  min-width: 0;
}

.cap-box.is-ours { border-color: #a9d3bc; background: #fbfefc; }

.cap-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.45rem;
}

.cap-name { font-weight: 600; font-size: 0.85rem; }

.cap-text {
  font-size: 0.83rem;
  line-height: 1.6;
  max-height: 15rem;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  mask-image: linear-gradient(to bottom, #000 calc(100% - 1.6rem), transparent);
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 1.6rem), transparent);
}

.tok-halluc {
  background: #fde3df;
  color: #a3271a;
  border-bottom: 2px solid #e07a6f;
  padding: 0 1px;
  font-weight: 600;
}

.tok-correct {
  background: #e4f3ea;
  color: #1f6b45;
  border-bottom: 2px solid #79c39b;
  padding: 0 1px;
}

.chair-legend {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  align-items: center;
}

@media screen and (max-width: 860px) {
  .gate-wrap,
  .chair-card { grid-template-columns: minmax(0, 1fr); }
  .gate-list { max-height: 300px; }
  .chair-grid { grid-template-columns: minmax(0, 1fr); }
  .gate-cards { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------------------------------------ figures */

/* Figure exports vary from 743 px to 2258 px wide, so size them from the
   column rather than letting intrinsic width decide. */
.fig {
  display: block;
  width: 100%;
  height: auto;
  margin: 0 auto;
}

/* The A1 panel is wide and short (2.5:1); at full column width it dwarfs
   everything around it. */
.fig-narrow { max-width: 700px; }

/* ------------------------------------------------------- page header */

/* Two affiliations, so authors carry their affiliation as color and the
   affiliation line repeats it as a marker. Superscripts are then free to
   mean only what the notes below say they mean. */
.aff-asu   { --aff: #2b6cb0; }
.aff-adobe { --aff: #9146b8; }

.publication-authors .author-block a,
.publication-authors .author-block a:hover {
  color: var(--aff) !important;
}

.venue-badge {
  font-family: 'Google Sans', sans-serif;
  font-size: 1.6rem;
  font-weight: 600;
  color: #4a4a4a;
  letter-spacing: 0.01em;
  margin-bottom: 0.65rem;
}

.publication-subtitle {
  color: #555;
  margin-top: -0.35rem !important;
  margin-bottom: 2.25rem !important;
  text-wrap: balance;
}

.author-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.1rem 0.45rem;
  margin-bottom: 0.85rem;
}

/* A superscript otherwise grows the line box above the baseline, which drops the
   two marked names about 5 px below the two unmarked ones. */
.author-line sup,
.affiliation-line sup,
.publication-notes sup {
  line-height: 0;
  position: relative;
  top: -0.45em;
  vertical-align: baseline;
  font-size: 0.7em;
}

.affiliation-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.3rem 1.6rem;
  color: #363636;
  margin-bottom: 1.4rem;
}

.affiliation-line > span { color: #363636; }

.aff-mark {
  color: var(--aff);
  font-size: 0.8em;
  margin-right: 0.4em;
  vertical-align: 0.05em;
}

.publication-notes {
  font-size: 0.9rem;
  color: #6b6b6b;
  margin-bottom: 2rem;
}

.publication-notes p { margin: 0 0 0.3rem; }
.publication-notes a { color: #6b6b6b; text-decoration: underline; }

.publication-links { margin-top: 0.25rem; }
.publication-links .button { margin: 0.3rem 0.25rem; }

.hero .hero-body { padding-bottom: 3.5rem; }

@media screen and (max-width: 640px) {
  .venue-badge { font-size: 1.2rem; }
}

.bibtex-note {
  font-size: 0.88rem;
  color: #6b6b6b;
  max-width: 60ch;
  margin-bottom: 0.9rem !important;
}

.teaser .hero-body { padding-top: 0; padding-bottom: 2rem; }

.teaser-caption {
  font-size: 0.92rem;
  line-height: 1.6;
  color: #555;
  max-width: 78ch;
  margin: 1.1rem auto 0;
  text-align: center;
}
