/* ================================================================
   StochGRT Project Page — Stylesheet
   ================================================================ */

/* ── Reset & Variables ── */

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

:root {
  --c-bg: #fafafa;
  --c-surface: #ffffff;
  --c-primary: #1a56db;
  --c-primary-light: #e8eefb;
  --c-text: #1e293b;
  --c-text-secondary: #64748b;
  --c-border: #e2e8f0;
  --c-accent: #7c3aed;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --max-w: 960px;
  --radius: 10px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Navigation ── */

nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}

nav .nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

nav .brand {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--c-primary);
}

nav .links {
  display: flex;
  gap: 1.75rem;
}

nav .links a {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

nav .links a:hover {
  color: var(--c-primary);
}

/* ── Hero ── */

.hero {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
  text-align: center;
}

.hero h1 {
  font-size: 2.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero .venue {
  display: inline-block;
  background: var(--c-primary-light);
  color: var(--c-primary);
  font-weight: 600;
  font-size: 0.8rem;
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 1.5rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.hero .subtitle {
  font-size: 1.15rem;
  color: var(--c-text-secondary);
  max-width: 640px;
  margin: 0 auto 2rem;
}

/* Authors */

.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1.5rem;
  margin-bottom: 1.75rem;
}

.authors a {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
}

.authors a:hover {
  text-decoration: underline;
}

.authors .marks {
  font-size: 0.75rem;
  vertical-align: super;
  color: var(--c-text-secondary);
}

.affiliations {
  font-size: 0.85rem;
  color: var(--c-text-secondary);
  margin-bottom: 2rem;
}

/* Action buttons */

.actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--c-primary);
  color: #fff;
}

.btn-primary:hover {
  background: #1747b3;
}

.btn-outline {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}

.btn-outline:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ── Sections ── */

section {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

section h2 {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1.25rem;
}

section h2::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 1.3em;
  background: var(--c-primary);
  border-radius: 2px;
  margin-right: 0.6rem;
  vertical-align: text-bottom;
}

section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.section-desc {
  color: var(--c-text-secondary);
  margin-bottom: 1rem;
  font-size: 0.75rem;
}

/* ── Teaser ── */

.teaser-img {
  width: 100%;
  display: block;
  margin: 1rem auto;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}

/* ── Abstract ── */

.abstract p {
  font-size: 1.02rem;
  color: var(--c-text-secondary);
}

/* ── Method ── */

.method-row {
  display: flex;
  gap: 1.5rem;
  align-items: start;
  margin-top: 1rem;
}

.method-img {
  width: 50%;
  flex-shrink: 0;
  border-radius: var(--radius);
  border: 1px solid var(--c-border);
}

.method-text {
  flex: 1;
  min-width: 0;
}

@media (max-width: 768px) {
  .method-row {
    flex-direction: column;
  }

  .method-img {
    width: 100%;
  }

  .teaser-img {
    width: 100%;
  }
}

/* ── Placeholder ── */

.placeholder {
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ── BibTeX ── */

.bibtex-block {
  background: #1e293b;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.7;
  overflow-x: auto;
  position: relative;
}

.bibtex-block .copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94a3b8;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: var(--font-sans);
  font-weight: 500;
  transition: background 0.15s;
}

.bibtex-block .copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ── Related ── */

.related-list {
  list-style: none;
  margin-top: 0.75rem;
}

.related-list li {
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--c-border);
}

.related-list li:last-child {
  border-bottom: none;
}

.related-list a {
  color: var(--c-primary);
  text-decoration: none;
  font-weight: 500;
}

.related-list a:hover {
  text-decoration: underline;
}

.related-list .meta {
  font-size: 0.82rem;
  color: var(--c-text-secondary);
  margin-top: 0.15rem;
}

/* ── Footer ── */

footer {
  text-align: center;
  padding: 3rem 1.5rem;
  font-size: 0.82rem;
  color: var(--c-text-secondary);
  border-top: 1px solid var(--c-border);
  margin-top: 2rem;
}

footer a {
  color: var(--c-primary);
  text-decoration: none;
}

/* ================================================================
   Shared interactive control styles
   ================================================================ */

.play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  flex-shrink: 0;
}

.play-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.range-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  outline: none;
  background: #e2e8f0;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--c-primary);
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.range-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.range-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: var(--c-primary);
  cursor: grab;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.speed-group {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  align-items: center;
}


.speed-btn {
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--c-text-secondary);
}

.speed-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
}

.speed-btn.active {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
}

.controls-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
}

.time-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--c-text);
  min-width: 72px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   Equal-Time Comparison
   ================================================================ */

.eqt-canvas {
  position: relative;
  width: 100%;
  background: #111827;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 1559 / 1039;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.eqt-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  will-change: clip-path;
}

.eqt-noframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111827;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 500;
  will-change: clip-path;
}

.eqt-noframe.hidden {
  display: none;
}

.eqt-badge {
  position: absolute;
  top: 10px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  line-height: 1.5;
  font-weight: 500;
  pointer-events: none;
  white-space: nowrap;
  z-index: 5;
}

.eqt-badge .b-label {
  font-weight: 700;
  font-size: 0.8rem;
}

.eqt-badge .b-psnr {
  color: #4ade80;
  font-weight: 600;
}

/* Diagonal handle */

.eqt-handle {
  position: absolute;
  top: 0;
  height: 100%;
  cursor: ew-resize;
  z-index: 10;
}

.eqt-handle::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 3px;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
}

.eqt-handle:hover::before,
.eqt-handle.active::before {
  background: #fff;
  width: 5px;
}

.eqt-handle-grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 22px;
  height: 38px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.eqt-handle-grip::before {
  content: "\22EE\22EE";
  color: #64748b;
  font-size: 10px;
  letter-spacing: 2px;
}

/* Method progress cards */

.eqt-bottom-row {
  display: flex;
  gap: 1rem;
  align-items: start;
  margin-top: 1rem;
}

.eqt-methods {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.eqt-method-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 8px;
  padding: 0.6rem 0.85rem;
}

.eqt-method-card .mc-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.eqt-method-card .mc-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.eqt-method-card .mc-name {
  font-weight: 600;
  font-size: 0.82rem;
}

.eqt-method-card .mc-bar {
  height: 4px;
  border-radius: 2px;
  background: #e2e8f0;
  margin-bottom: 0.35rem;
  overflow: hidden;
}

.eqt-method-card .mc-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.eqt-method-card .mc-stats {
  font-size: 0.74rem;
  color: var(--c-text-secondary);
  font-variant-numeric: tabular-nums;
}

/* PSNR Chart */

.eqt-chart-wrap {
  flex: 2;
  min-width: 0;
}

.eqt-chart {
  width: 100%;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  cursor: crosshair;
}

.eqt-chart .grid-line   { stroke: #e2e8f0; stroke-width: 0.5; }
.eqt-chart .axis-label   { font-size: 10px; fill: #64748b; }
.eqt-chart .axis-title   { font-size: 11px; fill: #475569; font-weight: 600; }
.eqt-chart .curve         { fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; opacity: 0.85; }
.eqt-chart .cursor-line   { stroke: #1e293b; stroke-width: 1.5; stroke-dasharray: 4 3; opacity: 0.5; }
.eqt-chart .cursor-dot    { stroke: #fff; stroke-width: 2; }
.eqt-chart .plot-border   { fill: none; stroke: #cbd5e1; stroke-width: 1; }
.eqt-chart .legend-label  { font-size: 9px; fill: #475569; font-weight: 600; }

/* ================================================================
   Relighting Animation
   ================================================================ */

.rl-grid {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.rl-scene {
  display: grid;
  grid-template-columns: auto 1fr 1fr;
  gap: 0.75rem;
  align-items: start;
}

.rl-scene-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--c-text);
  text-transform: capitalize;
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 0.25rem;
  grid-row: 1 / -1;
}

.rl-pair {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.rl-pair-imgs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}

.rl-cell {
  position: relative;
  overflow: hidden;
}

.rl-cell img {
  width: 100%;
  display: block;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e2e8f0;
}

.rl-tag {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

.rl-view-label {
  font-size: 0.68rem;
  color: var(--c-text-secondary);
  text-align: center;
  padding: 4px 0;
  border-top: 1px solid var(--c-border);
  font-weight: 500;
}

/* ================================================================
   Responsive
   ================================================================ */

@media (max-width: 768px) {
  .eqt-bottom-row {
    flex-direction: column;
  }

  .eqt-badge {
    font-size: 0.6rem;
    padding: 4px 7px;
  }

  .eqt-handle-grip {
    width: 18px;
    height: 30px;
  }

  .rl-scene {
    grid-template-columns: 1fr;
  }

  .rl-scene-label {
    writing-mode: horizontal-tb;
    transform: none;
    grid-row: auto;
    text-align: center;
    padding: 0.25rem 0;
  }
}

@media (max-width: 640px) {
  .hero h1 {
    font-size: 1.75rem;
  }

  .hero .subtitle {
    font-size: 1rem;
  }

  nav .links {
    gap: 1rem;
  }

  nav .links a {
    font-size: 0.8rem;
  }
}
