/* The Black Hole Lab — exhibit styling */

@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-400-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-500-latin.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Space Grotesk';
  src: url('../assets/fonts/SpaceGrotesk-700-latin.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-400-latin.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-500-latin.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('../assets/fonts/Inter-600-latin.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --bg: #05070d;
  --panel: rgba(10, 14, 26, 0.82);
  --panel-solid: #0b1020;
  --ink: #e8ecf7;
  --ink-dim: #9aa5c4;
  --amber: #ffb35c;
  --amber-hot: #ffd27a;
  --ember: #ff7a3c;
  --sky: #8fb7ff;
  --line: rgba(150, 170, 230, 0.14);
  --glow: 0 0 24px rgba(255, 179, 92, 0.25);
  --radius: 14px;
  --font-display: 'Space Grotesk', 'Avenir Next', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#gl {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
}
#gl:active { cursor: grabbing; }

/* ---------- brand ---------- */
.brand {
  position: fixed;
  top: 18px;
  left: 22px;
  pointer-events: none;
  z-index: 5;
}
.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(255, 179, 92, 0.35);
}
.brand .tagline {
  margin: 2px 0 0;
  font-size: 0.8rem;
  color: var(--amber);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* ---------- readout ---------- */
.readout {
  position: fixed;
  left: 16px;
  right: 452px;
  bottom: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}
.readout-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  gap: 8px;
  align-items: baseline;
  white-space: nowrap;
}
.ro-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
}
.ro-value {
  font-family: var(--font-display);
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--amber-hot);
  font-variant-numeric: tabular-nums;
}
.ro-hint .ro-value { color: var(--sky); font-weight: 400; }

/* ---------- panel ---------- */
.panel {
  position: fixed;
  top: 14px;
  right: 14px;
  bottom: 14px;
  width: min(410px, 92vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  transition: transform 0.35s cubic-bezier(0.3, 1, 0.4, 1), opacity 0.3s;
}
.tabs {
  display: flex;
  gap: 2px;
  padding: 10px 10px 0;
  flex-wrap: wrap;
}
.tab {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--ink-dim);
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 8px 2px;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--amber-hot); border-bottom-color: var(--amber); }
.tab-pages { flex: 1; overflow-y: auto; padding: 16px 18px 22px; scrollbar-width: thin; scrollbar-color: rgba(255,179,92,.3) transparent; }
.tab-page { display: none; animation: fadeUp 0.35s ease; }
.tab-page.active { display: block; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tab-page h2 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  margin: 2px 0 4px;
  color: var(--ink);
}
.page-sub, .journey-sub {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--ink-dim);
  line-height: 1.45;
}

/* ---------- journey ---------- */
.journey-dots { display: flex; gap: 7px; margin: 6px 0 14px; }
.j-dot {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-dim);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s;
}
.j-dot.active { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 10px rgba(255,179,92,.6); }
.j-dot:hover { border-color: var(--amber-hot); }

.journey-card {
  background: rgba(255, 179, 92, 0.05);
  border: 1px solid rgba(255, 179, 92, 0.18);
  border-radius: var(--radius);
  padding: 16px;
}
.journey-step-num {
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--amber);
  font-weight: 600;
  margin-bottom: 6px;
}
.journey-card h3 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--amber-hot);
}
.journey-card p { font-size: 0.92rem; line-height: 1.62; margin: 0 0 10px; color: #dde3f2; }
.journey-card p:last-child { margin-bottom: 0; }
.journey-card strong { color: var(--amber-hot); font-weight: 600; }
.journey-card em { color: var(--sky); font-style: italic; }
.journey-try {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--amber);
  background: rgba(255, 179, 92, 0.08);
  border-radius: 0 8px 8px 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #f4e7d3;
}
.journey-nav { display: flex; gap: 8px; margin-top: 14px; }

/* ---------- buttons ---------- */
.btn {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid transparent;
}
.btn.primary {
  background: linear-gradient(135deg, var(--ember), var(--amber));
  color: #1a0e02;
  box-shadow: var(--glow);
  flex: 1;
}
.btn.primary:hover { filter: brightness(1.12); transform: translateY(-1px); }
.btn.ghost {
  background: rgba(150, 170, 230, 0.08);
  border-color: var(--line);
  color: var(--ink);
}
.btn.ghost:hover { background: rgba(150, 170, 230, 0.16); }
.btn:disabled { opacity: 0.35; cursor: default; }
.btn.wide { width: 100%; margin-top: 10px; }

/* ---------- controls ---------- */
.control { margin-bottom: 18px; }
.control label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 500;
  margin-bottom: 7px;
}
.control output { color: var(--amber-hot); font-size: 0.8rem; }
.control-note { margin: 5px 0 0; font-size: 0.76rem; color: var(--ink-dim); line-height: 1.4; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, #3a2410, var(--ember), var(--amber-hot));
  outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff4e0;
  border: 3px solid var(--amber);
  box-shadow: 0 0 12px rgba(255, 179, 92, 0.7);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff4e0;
  border: 3px solid var(--amber);
  box-shadow: 0 0 12px rgba(255, 179, 92, 0.7);
  cursor: pointer;
}

.switch-row { margin-bottom: 14px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { display: none; }
.switch-track {
  flex: 0 0 42px;
  width: 42px; height: 24px;
  border-radius: 12px;
  background: rgba(150, 170, 230, 0.18);
  border: 1px solid var(--line);
  position: relative;
  transition: background 0.25s;
}
.switch-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #c8d2ee;
  transition: all 0.25s;
}
.switch input:checked + .switch-track {
  background: linear-gradient(135deg, var(--ember), var(--amber));
  box-shadow: 0 0 14px rgba(255, 179, 92, 0.45);
}
.switch input:checked + .switch-track::after { left: 20px; background: #1a0e02; }
.switch-label { font-size: 0.88rem; line-height: 1.35; }
.switch-label em { display: block; font-style: normal; font-size: 0.74rem; color: var(--ink-dim); }

.hint-card {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: rgba(143, 183, 255, 0.07);
  border: 1px solid rgba(143, 183, 255, 0.2);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #d7e3fb;
}

/* ---------- quiz & challenges ---------- */
.quiz-card {
  background: rgba(150, 170, 230, 0.05);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.quiz-q { margin: 0 0 10px; font-size: 0.9rem; line-height: 1.5; font-weight: 500; }
.quiz-num {
  font-family: var(--font-display);
  color: var(--amber);
  font-weight: 700;
  margin-right: 4px;
}
.quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.quiz-opt {
  text-align: left;
  background: rgba(150, 170, 230, 0.07);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.83rem;
  line-height: 1.4;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.18s;
}
.quiz-opt:not(:disabled):hover { background: rgba(255, 179, 92, 0.12); border-color: rgba(255,179,92,.4); }
.quiz-opt.correct { background: rgba(90, 220, 140, 0.15); border-color: rgba(90, 220, 140, 0.55); color: #c8f5da; }
.quiz-opt.wrong { background: rgba(255, 92, 72, 0.12); border-color: rgba(255, 92, 72, 0.45); color: #ffd9d4; }
.quiz-why { margin: 10px 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--ink-dim); }

.challenge-head {
  font-family: var(--font-display);
  font-size: 1.05rem;
  margin: 22px 0 10px;
  color: var(--amber-hot);
}
.challenge-count { font-size: 0.8rem; color: var(--amber); margin-left: 6px; }
.challenge-card {
  position: relative;
  background: rgba(255, 179, 92, 0.05);
  border: 1px solid rgba(255, 179, 92, 0.16);
  border-radius: var(--radius);
  padding: 13px 14px;
  margin-bottom: 10px;
}
.challenge-card h4 { margin: 0 0 5px; font-family: var(--font-display); font-size: 0.95rem; }
.challenge-card p { margin: 0; font-size: 0.83rem; line-height: 1.5; color: #dde3f2; }
.challenge-card details { margin-top: 8px; font-size: 0.78rem; color: var(--ink-dim); }
.challenge-card summary { cursor: pointer; color: var(--sky); }
.challenge-card details p { margin-top: 5px; color: var(--ink-dim); }
.challenge-card.completed { border-color: rgba(90, 220, 140, 0.5); background: rgba(90, 220, 140, 0.06); }
.ch-badge {
  position: absolute;
  top: 10px; right: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #7fe7ab;
}

/* ---------- facts & glossary ---------- */
.fact-card {
  border-left: 3px solid var(--amber);
  background: rgba(255, 179, 92, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 12px 14px;
  margin-bottom: 11px;
}
.fact-card h4 { margin: 0 0 5px; font-family: var(--font-display); font-size: 0.95rem; color: var(--amber-hot); }
.fact-card p { margin: 0; font-size: 0.85rem; line-height: 1.55; color: #dde3f2; }

.glossary-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 7px;
  background: rgba(150, 170, 230, 0.04);
}
.glossary-item summary {
  cursor: pointer;
  padding: 10px 13px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--amber-hot);
  list-style: none;
}
.glossary-item summary::before { content: '＋ '; color: var(--amber); }
.glossary-item[open] summary::before { content: '－ '; }
.glossary-item p {
  margin: 0;
  padding: 0 13px 12px;
  font-size: 0.84rem;
  line-height: 1.55;
  color: #dde3f2;
}

/* ---------- how real ---------- */
#real-box h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--amber-hot);
  margin: 16px 0 8px;
}
#real-box h3:first-child { margin-top: 4px; }
#real-box ul { margin: 0; padding-left: 18px; }
#real-box li { font-size: 0.84rem; line-height: 1.55; margin-bottom: 8px; color: #dde3f2; }
#real-box li strong { color: var(--amber-hot); }
#real-box li em { color: var(--sky); }
.real-foot {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 10px;
  background: rgba(143, 183, 255, 0.07);
  border: 1px solid rgba(143, 183, 255, 0.2);
  font-size: 0.83rem;
  line-height: 1.5;
  color: #d7e3fb;
}

/* ---------- tour label ---------- */
.tour-label {
  position: fixed;
  z-index: 6;
  transform: translate(-50%, -140%);
  background: var(--panel);
  border: 1px solid rgba(255, 179, 92, 0.5);
  border-radius: 999px;
  padding: 6px 14px 6px 9px;
  font-family: var(--font-display);
  font-size: 0.8rem;
  color: var(--amber-hot);
  pointer-events: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--glow);
  white-space: nowrap;
  animation: labelFloat 2.4s ease-in-out infinite;
}
@keyframes labelFloat { 0%,100% { margin-top: 0; } 50% { margin-top: -7px; } }
.tour-label-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px var(--amber);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.5); } }

/* ---------- part card ---------- */
.part-card {
  position: fixed;
  z-index: 20;
  width: min(320px, 84vw);
  background: rgba(12, 16, 30, 0.95);
  border: 1px solid rgba(255, 179, 92, 0.45);
  border-radius: var(--radius);
  padding: 15px 16px;
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6), var(--glow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  animation: fadeUp 0.25s ease;
}
.part-card h3 {
  margin: 0 22px 8px 0;
  font-family: var(--font-display);
  font-size: 1.02rem;
  color: var(--amber-hot);
}
.part-card p { margin: 0; font-size: 0.85rem; line-height: 1.6; color: #dde3f2; }
.part-card-close {
  position: absolute;
  top: 8px; right: 10px;
  background: none;
  border: none;
  color: var(--ink-dim);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  padding: 2px 5px;
}
.part-card-close:hover { color: var(--ink); }

/* ---------- photon panel ---------- */
.photon-panel {
  position: fixed;
  left: 18px;
  bottom: 86px;
  z-index: 9;
  width: min(560px, calc(100vw - 480px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px 12px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  animation: fadeUp 0.3s ease;
}
.photon-panel-head { display: flex; justify-content: space-between; align-items: center; }
.photon-panel-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--amber-hot);
}
.photon-panel .part-card-close { position: static; }
#photon-canvas { width: 100%; height: auto; border-radius: 10px; margin-top: 10px; display: block; }
.photon-caption { font-size: 0.79rem; line-height: 1.5; color: #c9d2ea; margin: 10px 0 6px; }
.photon-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.72rem; color: var(--ink-dim); }
.photon-legend span { display: flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 16px; height: 3px; border-radius: 2px; }
.lg-escape { background: #7db2ff; }
.lg-caught { background: #ff5c48; }
.lg-ring { background: #ffd27a; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translate(-50%, -16px);
  z-index: 30;
  background: rgba(16, 22, 40, 0.96);
  border: 1px solid rgba(255, 179, 92, 0.55);
  border-radius: 999px;
  padding: 11px 22px;
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--amber-hot);
  box-shadow: var(--glow), 0 14px 50px rgba(0,0,0,.5);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- fatal ---------- */
.fatal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 30px;
}
.fatal h2 { font-family: var(--font-display); color: var(--amber-hot); }
.fatal p { color: var(--ink-dim); max-width: 420px; line-height: 1.6; }

/* ---------- panel toggle (mobile) ---------- */
.panel-toggle {
  display: none;
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 40;
  width: 46px; height: 46px;
  border-radius: 14px;
  background: var(--panel);
  border: 1px solid rgba(255, 179, 92, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.panel-toggle span {
  display: block;
  width: 20px; height: 2px;
  background: var(--amber-hot);
  border-radius: 2px;
  transition: all 0.3s;
}
.panel-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.panel-toggle.is-open span:nth-child(2) { opacity: 0; }
.panel-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .panel-toggle { display: flex; }
  .panel {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    max-height: 62vh;
    transform: translateY(calc(100% + 20px));
    opacity: 0;
    pointer-events: none;
    /* no slide transition on mobile: calc()<->none transform transitions can
       wedge on low-power compositors, leaving the panel visible-but-dead */
    transition: none;
  }
  .panel.open { transform: none; opacity: 1; pointer-events: auto; }
  .photon-panel {
    left: 10px;
    right: 10px;
    bottom: 86px;
    width: auto;
    max-height: 52vh;
    overflow-y: auto;
  }
  .brand { top: 12px; left: 14px; }
  .readout { bottom: 12px; gap: 6px; }
  .readout-chip { padding: 6px 11px; }
  .ro-hint { display: none; }
}

@media (min-width: 921px) {
  .readout.shifted { left: 590px; }
}
@media (max-width: 920px) {
  .readout { right: 16px; }
}
@media (max-height: 560px) {
  .readout { justify-content: flex-start; }
}
