/* HOPE project page — self-contained stylesheet (no CSS framework). */

:root {
  /* ---- palette (swap this block to restyle the whole page) ----
     --grad-a -> --grad-b is the wordmark gradient only; --accent carries the UI.
     --contact stays red on purpose — red *means* contact in every paper figure,
     so no other element is allowed to claim it. --ink-rgb feeds every shadow and
     translucent overlay so they stay tinted with the palette. */
  --grad-a: #667eea;
  --grad-b: #f093fb;
  --accent: #1d4ed8;
  --accent-bright: #3b82f6;
  --accent-soft: rgba(29, 78, 216, 0.08);
  --contact: #dc2626;
  --contact-soft: rgba(220, 38, 38, 0.1);
  --ink: #12162e;
  --ink-rgb: 18, 22, 46;
  --ink-soft: #444c6b;
  --ink-faint: #79819d;
  --surface: #ffffff;
  --surface-tint: #f5f6fc;
  --border: #e1e4f0;
  --code-bg: #12142c;
  --code-fg: #d8dcf0;
  --media-bg: #e7eaf6;
  /* ---- end palette ---- */

  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(var(--ink-rgb), 0.06), 0 4px 14px rgba(var(--ink-rgb), 0.05);
  --shadow-md: 0 4px 10px rgba(var(--ink-rgb), 0.08), 0 14px 36px rgba(var(--ink-rgb), 0.1);
  --font-sans: 'Inter', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --max: 1080px;
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}

img, video { max-width: 100%; }

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

.mono { font-family: var(--font-mono); }
.accent { color: var(--accent); }

/* ---------------------------------------------------------------- layout */

.section { padding: 5rem 1.5rem; }
.section--tint { background: var(--surface-tint); }
.container { max-width: var(--max); margin: 0 auto; }
.container--wide { max-width: 1240px; }
.container--narrow { max-width: 820px; }

.section-title {
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  font-weight: 800;
  letter-spacing: -0.022em;
  margin: 0 0 0.6rem;
  text-align: center;
}
.section-lede {
  max-width: 660px;
  margin: 0 auto 2.4rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 1.03rem;
}
.section-title + .section-lede { margin-top: 0.4rem; }
.section-title:only-child { margin-bottom: 2.2rem; }

.subhead {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 0.35rem;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.5rem;
}

/* ------------------------------------------------------------------ hero */

.hero { padding: 4.5rem 1.5rem 3rem; text-align: center; }

.wide-only { display: none; }
@media (min-width: 720px) { .wide-only { display: inline; } }

.hero__title {
  font-size: clamp(1.8rem, 4.6vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.14;
  margin: 0 0 0.9rem;
}
.brand-grad {
  background: linear-gradient(100deg, var(--grad-a) 5%, var(--grad-b) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}
.hero__venue {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin: 0 0 1.3rem;
}
.hero__authors { font-size: 1.05rem; color: var(--ink-soft); margin: 0 0 0.35rem; }
.hero__affil { font-size: 0.92rem; color: var(--ink-faint); margin: 0; }
.hero__authors a { color: inherit; }
.hero__authors a:hover { color: var(--accent); }

.links { margin: 1.7rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.btn:hover { background: var(--accent); color: #fff; text-decoration: none; transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
.btn[aria-disabled='true']:hover { background: var(--ink); transform: none; box-shadow: none; }
.btn small { font-weight: 500; opacity: 0.72; }
.btn svg { flex: 0 0 auto; }

/* ------------------------------------------------------------------ tl;dr */

/* Sits in the centred hero but sets its own text left: centred prose of this
   length is harder to read, and the rule gives the block an edge to align to. */
.tldr {
  max-width: 780px;
  margin: 2.4rem auto 0;
  padding-left: 1.15rem;
  border-left: 3px solid var(--accent);
  text-align: left;
}
.tldr p { margin: 0; font-size: 1.12rem; line-height: 1.65; color: var(--ink-soft); }
.tldr__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
  margin-right: 0.45rem;
}

/* ----------------------------------------------------------------- figure */

.figure {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.15rem;
  margin: 2rem 0 0;
}
/* height:auto is load-bearing — without it the img's height attribute (the 2x
   pixel height) wins over the aspect ratio and the figure renders stretched. */
.figure > img { display: block; width: 100%; height: auto; border-radius: 8px; }
.figure figcaption { margin-top: 0.9rem; font-size: 0.85rem; line-height: 1.55; color: var(--ink-faint); }
.figure figcaption b { color: var(--ink-soft); }

.prose { color: var(--ink-soft); }
.prose p { margin: 0 0 1rem; }
.prose b, .prose strong { color: var(--ink); }
.prose--justify p { text-align: justify; text-justify: inter-word; }

/* ------------------------------------------------------------------ video */

.clip {
  border-radius: var(--radius);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-shadow: var(--shadow-md);
  background: var(--media-bg);
}
.clip::-webkit-scrollbar { display: none; }
.clip__inner { position: relative; min-width: 100%; }
.clip video { display: block; width: 100%; height: auto; }
.clip__labels {
  position: absolute;
  inset: 0;
  display: grid;
  pointer-events: none;
}
.clip__labels span {
  align-self: start;
  justify-self: start;
  margin: 0.55rem 0 0 0.55rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(var(--ink-rgb), 0.78);
  color: #fff;
  white-space: nowrap;
}
.clip__labels span.is-ours { background: var(--accent); }
.clip__labels span.is-contact { background: var(--contact); }

.clip--single .clip__labels { grid-template-columns: 426fr 240fr 238fr 240fr; }
.clip--pair .clip__labels { grid-template-columns: 760fr 445fr 445fr; }

.swipe-hint { display: none; }

.hint { margin: 0.7rem 0 0; text-align: center; font-size: 0.8rem; color: var(--ink-faint); }

.strip {
  display: flex;
  gap: 0.55rem;
  margin-top: 1.1rem;
  overflow-x: auto;
  justify-content: safe center;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.strip::-webkit-scrollbar { display: none; }
.thumb {
  flex: 0 0 auto;
  position: relative;
  width: 132px;
  border: 2px solid transparent;
  border-radius: 10px;
  overflow: hidden;
  padding: 0;
  background: none;
  cursor: pointer;
  opacity: 0.68;
  transition: opacity 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.thumb img { display: block; width: 100%; aspect-ratio: 427 / 240; object-fit: cover; object-position: left center; }
.thumb:hover { opacity: 1; transform: translateY(-2px); }
.thumb.is-active { opacity: 1; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.thumb__name {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0.28rem 0.2rem 0.3rem;
  background: var(--surface);
  text-align: center;
}

/* ----------------------------------------------------------------- legend */

.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.4rem;
  margin-top: 1.2rem;
  font-size: 0.78rem;
  color: var(--ink-faint);
}
.legend__item { display: flex; align-items: center; gap: 0.5rem; }
.legend__ramp {
  width: 120px;
  height: 10px;
  border-radius: 999px;
  /* matches the pressure colormap used in the paper figures */
  background: linear-gradient(90deg, #05010f, #1b1b7a, #6a1fa2, #c4356b, #f5a623);
  border: 1px solid var(--border);
}
.legend__swatch { width: 14px; height: 14px; border-radius: 4px; background: var(--contact); }
.legend__arrows { display: inline-flex; gap: 3px; }
.legend__arrows i { width: 8px; height: 8px; border-radius: 50%; display: block; }

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

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 2.2rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 1.4rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: rgba(109, 40, 217, 0.32); }
.card__num {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 8px;
  padding: 0.22rem 0.55rem;
  margin-bottom: 0.85rem;
}
.card__num.is-contact { color: var(--contact); background: var(--contact-soft); }
.card h3 { font-size: 1.03rem; margin: 0 0 0.55rem; }
.card p { font-size: 0.9rem; line-height: 1.55; color: var(--ink-soft); margin: 0; }

/* ----------------------------------------------------------------- tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin-top: 1.4rem;
}
table { border-collapse: collapse; width: 100%; font-size: 0.86rem; }
caption {
  caption-side: top;
  text-align: left;
  padding: 1rem 1.15rem 0.7rem;
  font-size: 0.85rem;
  color: var(--ink-faint);
  line-height: 1.5;
}
caption b { color: var(--ink-soft); }
th, td { padding: 0.5rem 0.85rem; text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-bottom: 1px solid var(--border);
}
thead tr.group th { text-transform: none; letter-spacing: 0; color: var(--ink-soft); border-bottom: none; padding-bottom: 0.15rem; }
tbody td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink-soft); border-top: 1px solid var(--border); }
tbody td:first-child { font-family: var(--font-sans); color: var(--ink); }
tbody tr.is-ours td { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
tbody tr.is-ours td:first-child { color: var(--accent); }
td.best, th.best { font-weight: 700; color: var(--ink); }
tbody tr.is-ours td.best { color: var(--accent); }
td .sub { font-size: 0.78em; color: var(--ink-faint); font-weight: 400; }
.check { color: var(--accent); }
.dash { color: var(--ink-faint); }

details.more {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin-top: 1rem;
  overflow: hidden;
}
details.more > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 0.2s ease;
  margin-left: 2px;
}
details.more[open] > summary::before { transform: rotate(45deg); }
details.more > summary span { font-weight: 400; color: var(--ink-faint); font-size: 0.85rem; }
.more__body { padding: 0 1.2rem 1.4rem; }
.more__body .figure { margin-top: 0.4rem; }
.more__body .table-wrap { box-shadow: none; }

/* ----------------------------------------------------------------- bibtex */

.bibtex { position: relative; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.bibtex pre {
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  padding: 1.5rem 1.6rem;
  margin: 0;
  overflow-x: auto;
}
.copy-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.9rem;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ddd6f0;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 8px;
  padding: 0.32rem 0.7rem;
  cursor: pointer;
}
.copy-btn:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }

/* ----------------------------------------------------------------- footer */

.footer { background: var(--surface-tint); border-top: 1px solid var(--border); padding: 2.6rem 1.5rem; }
.footer p { max-width: var(--max); margin: 0 auto 0.5rem; font-size: 0.82rem; color: var(--ink-faint); text-align: center; }

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

.explore { max-width: 1120px; margin: 0 auto; }

.explore__stage { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.explore__pane { margin: 0; }
.explore__pane figcaption {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
  font-size: 0.8rem;
  color: var(--ink-faint);
  min-height: 30px;
}

/* The clip videos are four-panel strips; the explorer shows only the input
   panel, which is the leftmost 427 of 1146 px. Reusing the same file means the
   browser cache already has it after the results section. */
.explore__crop {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--media-bg);
  box-shadow: var(--shadow-sm);
  aspect-ratio: 427 / 240;
}
/* The clip is a four-panel strip and only the input panel (the leftmost 427 of
   1144 px) belongs here, so the video is blown up to 1144/426 = 268.5% and the
   rest is clipped. Both axes are given explicitly: with `height: auto` the box
   collapses to zero until metadata arrives, which leaves an empty tile if
   preload is deferred. 268.4% x 100% already matches the source's 2292x480
   ratio, so nothing is stretched. */
.explore__crop video {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 268.5%;
  max-width: none;
  height: 100%;
}

.explore__canvas-wrap {
  position: relative;
  border-radius: var(--radius);
  background: var(--media-bg);
  box-shadow: var(--shadow-sm);
  aspect-ratio: 427 / 240;
  overflow: hidden;
}
.explore__canvas-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}
.explore__canvas-wrap canvas:active { cursor: grabbing; }
.explore__status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-faint);
  background: var(--media-bg);
}
.explore__status[hidden] { display: none; }
.explore__reset {
  position: absolute;
  top: 0.5rem;
  right: 0.55rem;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  cursor: pointer;
}
.explore__reset:hover { color: var(--accent); border-color: var(--accent); }

/* segmented control + checkbox */

.seg { display: inline-flex; gap: 0.15rem; background: var(--surface-tint);
       border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem; }
.seg__btn {
  border: none; background: none; font: inherit; font-size: 0.72rem; font-weight: 600;
  color: var(--ink-faint); padding: 0.2rem 0.6rem; border-radius: 999px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg__btn:hover { color: var(--ink); }
.seg__btn.is-active { background: var(--accent); color: #fff; }

/* Not `.check` — the result tables use td.check for their tick marks, and
   display:inline-flex on a <td> drops it out of the table's column model. */
.toggle { display: inline-flex; align-items: center; gap: 0.35rem; font-size: 0.75rem; cursor: pointer; }
.toggle input { accent-color: var(--accent); }

/* transport */

.transport { display: flex; align-items: center; gap: 0.8rem; margin-top: 1.1rem; }
.transport__play {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--accent);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.transport__play:hover { border-color: var(--accent); }
.transport__play .ic-pause { display: none; }
.transport__play[data-state='playing'] .ic-play { display: none; }
.transport__play[data-state='playing'] .ic-pause { display: block; }
.transport__scrub { flex: 1 1 auto; accent-color: var(--accent); min-width: 0; }
.transport__time { flex: 0 0 auto; font-size: 0.75rem; color: var(--ink-faint); }

/* plot */

.plot { margin-top: 1.4rem; }
.plot__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.plot__title { margin: 0; font-size: 0.9rem; font-weight: 700; }
.plot__unit { display: block; font-size: 0.72rem; font-weight: 400; color: var(--ink-faint); }
.plot__svg { display: block; width: 100%; height: auto; margin-top: 0.5rem; overflow: visible; }
.plot__line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot__line.is-dim { opacity: 0.14; }
.plot__grid { stroke: var(--border); stroke-width: 1; }
.plot__axis { stroke: var(--ink-faint); stroke-width: 1; opacity: 0.5; }
.plot__tick { font-family: var(--font-mono); font-size: 11px; fill: var(--ink-faint); }
.plot__panel-title { font-family: var(--font-sans); font-size: 12px; font-weight: 700; }
.plot__hit { fill: transparent; cursor: ew-resize; }
line.plot__head { stroke: var(--ink); stroke-width: 1.5; opacity: 0.55; }

.plot-parts { display: flex; gap: 1rem; margin-top: 0.5rem; font-size: 0.74rem; color: var(--ink-faint); }
.plot-parts[hidden] { display: none; }
.plot-parts span { display: inline-flex; align-items: center; gap: 0.35rem; }

.plot-legend { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.8rem; }
.plot-legend__item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px;
  padding: 0.25rem 0.7rem; font: inherit; font-size: 0.75rem; color: var(--ink-soft);
  cursor: pointer; transition: border-color 0.15s ease, opacity 0.15s ease;
}
.plot-legend__item:hover { border-color: var(--accent); }
.plot-legend__item.is-dim { opacity: 0.4; }
.plot-legend__item i { width: 10px; height: 10px; border-radius: 3px; display: block; }
.plot-legend__name { font-weight: 600; color: var(--ink); }
.plot-legend__val { color: var(--ink-faint); font-variant-numeric: tabular-nums; min-width: 2.6em; text-align: right; }

@media (max-width: 820px) {
  .explore__stage { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------- motion */

.js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s cubic-bezier(0.22, 0.61, 0.36, 1), transform 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  /* A four-panel strip is unreadable at phone width, so let it scroll instead. */
  .clip__inner { width: 860px; }
  .swipe-hint { display: block; }
}

@media (max-width: 640px) {
  .section { padding: 3.2rem 1.15rem; }
  .hero { padding: 3rem 1.15rem 2rem; }
  .clip__labels span { font-size: 0.58rem; padding: 0.15rem 0.4rem; margin: 0.35rem 0 0 0.35rem; }
  .thumb { width: 108px; }
  .prose--justify p { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn:hover, .card:hover, .stat:hover, .thumb:hover { transform: none; }
}
