/* ============================================================
   Research Project Page — style.css
   ============================================================ */

/* ---------- Announcement Bar ---------- */
.announcement-bar {
  width: 100%;
  background: linear-gradient(90deg, #1e2a4a, #2a1e4a, #1e2a4a);
  background-size: 200% 100%;
  animation: bar-slide 6s ease infinite;
  color: #c8d4ff;
  text-align: center;
  padding: 10px 16px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  border-bottom: 1px solid rgba(108, 142, 247, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}

@keyframes bar-slide {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---------- CSS Variables ---------- */
:root {
  --color-bg:          #0d0f14;
  --color-bg-alt:      #13161e;
  --color-surface:     #1a1d27;
  --color-border:      #2a2d3a;
  --color-text:        #e2e4ed;
  --color-text-muted:  #8b90a8;
  --color-text-subtle: #5a5f78;
  --color-accent:      #6c8ef7;
  --color-accent-2:    #a78bfa;
  --color-accent-glow: rgba(108, 142, 247, 0.15);
  --color-highlight:   rgba(108, 142, 247, 0.08);
  --color-white:       #ffffff;

  --font-sans:  'Inter', system-ui, sans-serif;
  --font-serif: 'Crimson Pro', Georgia, serif;
  --font-mono:  'JetBrains Mono', 'Fira Code', monospace;

  --radius-sm:  6px;
  --radius-md:  12px;
  --radius-lg:  20px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 40px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 40px rgba(108, 142, 247, 0.12);

  --transition: 0.2s ease;

  --container-width: 1100px;
  --narrow-width:    760px;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

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

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}
a:hover { color: var(--color-white); }

img, video {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
}

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

/* ---------- Layout ---------- */
.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.container.narrow {
  max-width: var(--narrow-width);
}

/* ---------- Navigation bar (sticky, minimal) ---------- */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent), var(--color-accent-2), transparent);
  z-index: 100;
}

/* ---------- Hero / Header ---------- */
.hero {
  padding: 6rem 0 4rem;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(108,142,247,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(167,139,250,0.08) 0%, transparent 60%);
  pointer-events: none;
}

.paper-title {
  font-family: var(--font-sans);
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-white);
  margin-bottom: 2rem;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

/* Authors */
.authors {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.4rem 1.2rem;
  font-size: 1rem;
  margin-bottom: 0.6rem;
}

.author a {
  color: var(--color-text);
  font-weight: 500;
  transition: color var(--transition);
}
.author a:hover { color: var(--color-accent); }
.author sup { color: var(--color-accent); font-size: 0.7em; margin-left: 1px; }

.affiliations {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.2rem 1.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 2.5rem;
}
.affiliations sup { color: var(--color-accent); }

/* Teaser */
.teaser {
  max-width: 900px;
  margin: 0 auto;
}

.teaser figure {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  padding: 5px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.teaser img {
  border-radius: calc(var(--radius-lg) - 4px);
  width: 100%;
  object-fit: cover;
  min-height: 300px;
  background: linear-gradient(135deg, var(--color-surface), var(--color-bg-alt));
}

.teaser figcaption {
  padding: 1rem 1rem 0.5rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  text-align: left;
  line-height: 1.5;
}

/* ---------- Sections ---------- */
.section {
  padding: 5rem 0;
}

#abstract  { background: var(--color-bg-alt); }
#method    { background: var(--color-bg); }
#references { background: var(--color-bg-alt); }

.section-title {
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-white);
  margin-bottom: 0.75rem;
  text-align: center;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}

.section-title::after {
  content: '';
  display: block;
  height: 3px;
  width: 40px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-2));
  border-radius: 2px;
  margin: 0.5rem auto 0;
}

.section-divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 2.5rem 0 2rem;
}

.section-subtitle {
  text-align: center;
  color: var(--color-text);
  font-size: 1.5rem;
  max-width: 640px;
  margin: 0 auto 3rem;
}

/* ---------- Abstract ---------- */
.abstract-text {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  line-height: 1.85;
  color: var(--color-text);
  margin-bottom: 1.2rem;
}
.abstract-text:last-child { margin-bottom: 0; }

/* ---------- Method Cards ---------- */
.method-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.method-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.method-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-glow);
}

.method-icon {
  font-size: 1.5rem;
  color: var(--color-accent);
  margin-bottom: 0.75rem;
}

.method-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-white);
  margin-bottom: 0.6rem;
}

.method-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.65;
}

/* ---------- Figures ---------- */
figure {
  margin: 0;
}

.figure-wide {
  margin: 2rem 0;
}

.figure-wide img {
  width: 100%;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

figure figcaption {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  text-align: center;
  margin-top: 0.75rem;
  line-height: 1.5;
}

/* ---------- References ---------- */
.references-list {
  padding-left: 1.5rem;
  counter-reset: ref-counter;
}

.references-list li {
  font-size: 0.9rem;
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: 1rem;
  padding-left: 0.5rem;
}

.references-list li em { color: var(--color-text); font-style: italic; }
.references-list li strong { color: var(--color-text); }

.ref-link {
  font-size: 0.8rem;
  color: var(--color-accent);
  margin-left: 0.4rem;
}

.cite-tag {
  font-size: 0.75em;
  vertical-align: super;
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.cite-tag:hover {
  text-decoration: underline;
}

/* ---------- Footer ---------- */
.footer {
  padding: 2rem 0;
  text-align: center;
  border-top: 1px solid var(--color-border);
  font-size: 0.85rem;
  color: var(--color-text-subtle);
}

.footer a { color: var(--color-text-muted); }
.footer a:hover { color: var(--color-accent); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .paper-title { font-size: 1.6rem; }
  .section { padding: 3.5rem 0; }
  .section-title { font-size: 1.5rem; }
  .hero { padding: 4rem 0 3rem; }
  .method-grid { grid-template-columns: 1fr; }
  .affiliations { flex-direction: column; align-items: center; gap: 0.25rem; }
}

@media (max-width: 480px) {
  .container { padding: 0 1.25rem; }
}

/* ---------- Fade-in animation (triggered by JS) ---------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children inside grids */
.method-grid .method-card:nth-child(2) { transition-delay: 0.1s; }
.method-grid .method-card:nth-child(3) { transition-delay: 0.2s; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-accent); }

/* ---------- Selection ---------- */
::selection {
  background: rgba(108, 142, 247, 0.3);
  color: var(--color-white);
}

/* ── HSV Explorer ──────────────────────────────────────────────────────── */
.hsv-explorer {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
  padding: 1.25rem 1.5rem 1.5rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

/* ── Fadeable elements (caption + image cols only, wheel stays visible) ── */
.hsv-fadeable {
  transition: opacity 0.3s ease;
}

/* ── Section caption (changes per sample) ── */
.hsv-section-caption {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--color-text);
  font-family: var(--font-serif);
  font-weight: 400;
  letter-spacing: 0.01em;
  text-align: center;
  min-height: 1.2em;
}

/* ── 3-column row ── */
.hsv-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: start;
}

.hsv-col {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

/* ── Reference images ── */
.hsv-col-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* ── Main interactive image ── */
.hsv-imgbox {
  position: relative;
  width: 100%;
}

/* Background reference copy — sets the container height */
.hsv-bg-ref {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

/* HSV canvas floats on top of the reference, semi-transparent */
#hsv-img-canvas {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: var(--radius-sm);
  cursor: crosshair;
  opacity: 0.85;
}

.hsv-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  border-radius: var(--radius-sm);
}

/* Blend slider */
.hsv-blend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.hsv-blend-lbl {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.hsv-opacity-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 3px;
  background: var(--color-border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.hsv-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
}

.hsv-opacity-slider::-moz-range-thumb {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  border: none;
  cursor: pointer;
}

/* ── Per-image captions ── */
.hsv-img-caption {
  margin: 0;
  font-size: 0.68rem;
  color: var(--color-text-muted);
  font-family: var(--font-mono);
  text-align: center;
  line-height: 1.3;
  min-height: 1em;
}

/* ── Viz (wheel) column ── */
.hsv-col-viz {
  align-items: center;
  gap: 0.6rem;
}

.hsv-viz-label {
  font-size: 0.68rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-family: var(--font-mono);
  text-align: center;
}

/* Donut wheel — scales to fill the column */
.hsv-wheel-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
}

#hsv-wheel-bg {
  display: block;
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
}

.hsv-wheel-fg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

.hsv-values-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  justify-content: center;
}

.hsv-val-item {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  font-family: var(--font-mono);
}

.hsv-val-lbl {
  font-size: 0.62rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.hsv-val-num {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  min-width: 2.5ch;
  text-align: right;
}

.hsv-val-unit {
  font-size: 0.62rem;
  color: var(--color-text-muted);
}

.hsv-hint {
  margin: 0;
  font-size: 0.62rem;
  color: var(--color-text-subtle);
  font-family: var(--font-mono);
  text-align: center;
  font-style: italic;
}

/* ── Dot nav ── */
.hsv-dots {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.hsv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-text-subtle);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}

.hsv-dot.active {
  background: var(--color-accent);
  transform: scale(1.4);
}

.hsv-dot:hover:not(.active) {
  background: var(--color-text-muted);
}

@media (max-width: 540px) {
  .hsv-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 340px) {
  .hsv-row {
    grid-template-columns: 1fr;
  }
}
