/* === IMPOSSIBLE COLOR MUSEUM — STYLE === */

:root {
  --void: #080410;
  --deep: #120818;
  --surface: #1a0f24;
  --surface-raised: #241738;
  --border: rgba(255, 0, 110, 0.1);
  --border-hover: rgba(255, 0, 110, 0.25);
  --magenta: #ff006e;
  --cyan: #00e5ff;
  --yellow: #f5e642;
  --violet: #8b5cf6;
  --lime: #a3e635;
  --coral: #ff6b6b;
  --text: #e0d6ec;
  --text-dim: #8a7a9e;
  --text-bright: #f8f4ff;
  --font-display: 'DM Serif Display', Georgia, serif;
  --font-body: 'Syne', system-ui, sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
}

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

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

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  position: relative;
}

/* Grain overlay */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px;
}

/* === NAV === */
.museum-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: rgba(8, 4, 16, 0.88);
  backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.nav-title {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: clamp(0.85rem, 2vw, 1rem);
  color: var(--text-bright);
  letter-spacing: 0.02em;
}

.nav-ticket {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  background: var(--magenta);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.nav-ticket:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(255, 0, 110, 0.35);
}

/* === HERO === */
.museum-hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse 70% 50% at 75% 30%, rgba(255,0,110,0.12), transparent),
              radial-gradient(ellipse 50% 60% at 25% 70%, rgba(0,229,255,0.08), transparent),
              radial-gradient(ellipse 40% 40% at 50% 50%, rgba(245,230,66,0.06), transparent);
  animation: heroPulse 12s ease-in-out infinite alternate;
}

@keyframes heroPulse {
  0% { opacity: 0.7; filter: hue-rotate(0deg); }
  100% { opacity: 1; filter: hue-rotate(25deg); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  padding: 4rem 1.25rem;
  max-width: 680px;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--magenta);
  letter-spacing: 0.18em;
  margin-bottom: 1.25rem;
  opacity: 0;
  animation: fadeSlideUp 0.7s ease forwards 0.2s;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 6rem);
  color: var(--text-bright);
  line-height: 1.05;
  letter-spacing: -0.02em;
  opacity: 0;
  animation: fadeSlideUp 0.7s ease forwards 0.4s;
}

.hero-title em {
  background: linear-gradient(135deg, var(--magenta), var(--cyan), var(--yellow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-intro {
  margin-top: 1.5rem;
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--text-dim);
  max-width: 520px;
  line-height: 1.7;
  opacity: 0;
  animation: fadeSlideUp 0.7s ease forwards 0.6s;
}

.hero-cta {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  opacity: 0;
  animation: fadeSlideUp 0.7s ease forwards 0.8s;
}

.cta-button {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.9rem 2rem;
  background: transparent;
  color: var(--text-bright);
  border: 1px solid var(--text-dim);
  border-radius: 4px;
  width: fit-content;
  transition: all 0.3s ease;
}

.cta-button:hover {
  background: var(--magenta);
  border-color: var(--magenta);
  box-shadow: 0 0 30px rgba(255, 0, 110, 0.3);
}

.cta-note {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

/* === EXHIBITION INTRO === */
.exhibition-intro {
  padding: 4rem 1.25rem 2rem;
  max-width: 720px;
  margin: 0 auto;
}

.intro-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 2rem 1.5rem;
}

.intro-heading {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  color: var(--text-bright);
  margin-bottom: 1rem;
}

.intro-card p {
  font-size: 0.9rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: 0.8rem;
}

.intro-card p:last-child { margin-bottom: 0; }

/* === SECTION LABELS === */
.section-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--magenta);
  letter-spacing: 0.18em;
  padding: 3rem 1.25rem 0.5rem;
  text-align: center;
}

/* === GALLERY === */
.gallery-section {
  padding: 1rem 1.25rem 3rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
}

.gallery-exhibit {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  border: 1px solid var(--border);
}

.gallery-exhibit:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.exhibit-color {
  height: 200px;
  position: relative;
  overflow: hidden;
}

.exhibit-color::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 50%, var(--surface));
}

.exhibit-body {
  padding: 1.25rem 1.25rem 1.5rem;
  background: var(--surface);
}

.exhibit-gallery-num {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--text-dim);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.exhibit-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--text-bright);
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

.exhibit-desc {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}

.exhibit-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 3px;
  margin-top: 0.75rem;
}

/* === INTERACTIVE EXPERIMENT === */
.interactive-section,
.chromatic-wheel-section,
.binocular-section {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  text-align: center;
}

.experiment-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  color: var(--text-bright);
  margin-top: 0.3rem;
  margin-bottom: 0.6rem;
}

.experiment-desc {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
  max-width: 480px;
  margin: 0 auto 1.5rem;
}

.experiment-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.stare-target {
  width: 180px;
  height: 180px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.5s ease;
  cursor: crosshair;
  position: relative;
}

.stare-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(255,255,255,0.5);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

.experiment-controls {
  display: flex;
  gap: 0.75rem;
}

.exp-btn {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.7rem 1.5rem;
  background: var(--magenta);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.exp-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255, 0, 110, 0.4);
}

.exp-btn.secondary {
  background: transparent;
  border: 1px solid var(--text-dim);
  color: var(--text);
}

.exp-btn.secondary:hover {
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 4px 16px rgba(0, 229, 255, 0.2);
}

.timer-bar {
  width: 180px;
  height: 3px;
  background: var(--surface-raised);
  border-radius: 2px;
  overflow: hidden;
}

.timer-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--magenta), var(--cyan));
  border-radius: 2px;
  transition: width 0.1s linear;
}

.experiment-result {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  min-height: 1.2em;
}

/* === CHROMA WHEEL === */
.wheel-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

#chromaCanvas {
  width: min(300px, 80vw);
  height: min(300px, 80vw);
  border-radius: 50%;
  border: 1px solid var(--border);
}

.wheel-readout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.readout-hue {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-bright);
}

.readout-status {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--lime);
  transition: color 0.3s;
}

.readout-status.impossible {
  color: var(--magenta);
}

.hue-slider {
  width: min(300px, 80vw);
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg,
    hsl(0,100%,50%), hsl(30,100%,50%), hsl(60,100%,50%),
    hsl(90,100%,50%), hsl(120,100%,50%), hsl(150,100%,50%),
    hsl(180,100%,50%), hsl(210,100%,50%), hsl(240,100%,50%),
    hsl(270,100%,50%), hsl(300,100%,50%), hsl(330,100%,50%),
    hsl(360,100%,50%));
  outline: none;
  cursor: pointer;
}

.hue-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  border: 2px solid var(--deep);
  box-shadow: 0 0 8px rgba(0,0,0,0.4);
  cursor: pointer;
}

/* === BINOCULAR RIVALRY === */
.rivalry-demo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 1.5rem 0 1rem;
}

.rivalry-patch {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  transition: background 0.5s ease;
}

.rivalry-gap {
  color: var(--text-dim);
  opacity: 0.4;
}

.merge-icon {
  width: 24px;
  height: 24px;
}

.rivalry-controls {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

/* === FACTS === */
.facts-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

.facts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.fact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.3s;
}

.fact-card:hover {
  border-color: var(--border-hover);
}

.fact-num {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  font-weight: 700;
  color: var(--magenta);
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
}

.fact-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--text-bright);
  margin-bottom: 0.4rem;
}

.fact-body {
  font-size: 0.82rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* === FOOTER === */
.museum-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 1.25rem;
  text-align: center;
}

.footer-brand {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-bright);
}

.footer-tagline {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.footer-fine {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-dim);
  opacity: 0.5;
  margin-top: 1rem;
}

/* === ANIMATIONS === */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0% { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* === RESPONSIVE === */
@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .facts-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero-inner {
    padding: 6rem 2.5rem;
  }

  .museum-nav {
    padding: 0.9rem 2.5rem;
  }

  .stare-target {
    width: 220px;
    height: 220px;
  }

  .rivalry-patch {
    width: 150px;
    height: 150px;
  }

  .section-label {
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }

  .gallery-section {
    padding: 1rem 2.5rem 3rem;
  }
}

@media (min-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-grid .gallery-exhibit:first-child {
    grid-column: span 2;
  }

  .hero-inner {
    padding: 8rem 4rem;
    max-width: 800px;
  }

  .museum-nav {
    padding: 0.9rem 4rem;
  }

  .gallery-section {
    padding: 1rem 4rem 3rem;
  }

  #chromaCanvas {
    width: 350px;
    height: 350px;
  }

  .hue-slider {
    width: 350px;
  }
}
