/* Mythos Museum — gallery styling. Dark marble, brass and glass. */

:root {
  --gold: #c9a227;
  --gold-soft: rgba(201, 162, 39, 0.55);
  --ink: #ece5d3;
  --ink-dim: #a89e88;
  : rgba(12, 14, 24, 0.92);
  --panel-border: rgba(201, 162, 39, 0.35);
  --night: #070912;
  --col-bg: #0b0d18;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--night);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

/* ---------- three-column layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 340px 1fr 340px;
  height: 100vh;
  height: 100dvh;
  width: 100%;
  min-height: 0;
}

.col-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px;
  background: var(--col-bg);
  border-right: 1px solid var(--panel-border);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
}

.col-right {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 20px;
  background: var(--col-bg);
  border-left: 1px solid var(--panel-border);
  overflow-y: auto;
  min-height: 0;
  min-width: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-soft) transparent;
}

#stage, .stage {
  position: relative;
  inset: auto;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}
#stage canvas { display: block; }

/* ---------- top bar / header card (left column) ---------- */

.topbar {
  position: static;
  z-index: auto;
  display: block;
  padding: 18px 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  flex: 0 0 auto;
}

.brand-block { pointer-events: auto; }

.back-link {
  display: inline-block;
  color: var(--gold);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}
.back-link:hover { text-decoration: underline; }

.topbar h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.8);
}

.subtitle {
  margin: 3px 0 0;
  color: var(--ink-dim);
  font-size: 13.5px;
  letter-spacing: 0.01em;
}

.top-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  pointer-events: auto;
  flex-shrink: 0;
}

/* ---------- buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}
.btn:hover { border-color: var(--gold); background: rgba(30, 32, 48, 0.85); }
.btn:active { transform: scale(0.97); }
.btn-accent { color: #ffd968; border-color: var(--gold-soft); }
.btn-small { font-size: 12.5px; padding: 6px 14px; }

/* ---------- exhibit (plaque) panel (left column, below header) ---------- */

.panel {
  position: relative;
  z-index: auto;
  flex: 1 1 auto;
  min-height: 0;
  width: auto;
  max-height: none;
  overflow-y: auto;
  padding: 22px 24px 20px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(0, 0, 0, 0.4);
  transition: opacity 0.35s ease, transform 0.35s ease;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-soft) transparent;
}
.panel.closed {
  opacity: 0;
  transform: translateX(-24px);
  pointer-events: none;
}

.panel-close {
  position: absolute;
  top: 8px; right: 12px;
  border: none;
  background: none;
  color: var(--ink-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
}
.panel-close:hover { color: var(--ink); }

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 11.5px;
  letter-spacing: 0.01em;
}

.panel h2 {
  margin: 0 0 4px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 27px;
  font-weight: 600;
}

.origin {
  margin: 0 0 10px;
  color: var(--ink-dim);
  font-size: 13px;
  font-style: italic;
}

.tagline {
  margin: 0 0 12px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16.5px;
  color: #ffd968;
}

.description {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
}

.fact {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--gold);
  background: rgba(201, 162, 39, 0.08);
  border-radius: 0 4px 4px 0;
}
.fact-label {
  margin: 0 0 4px;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--gold);
}
.fact-text { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink); }

/* ---------- exhibit navigation / switcher (right column) ---------- */

.exhibit-nav {
  position: static;
  z-index: auto;
  transform: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  overflow-y: auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: var(--gold-soft) transparent;
}

#now-viewing {
  position: absolute;
  z-index: 20;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 6px 14px;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(8, 9, 16, 0.72);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  letter-spacing: 0.06em;
  color: var(--ink);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  pointer-events: none;
  max-width: calc(100% - 24px);
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-btn {
  appearance: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--gold);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
  flex-shrink: 0;
}
.nav-btn:hover { border-color: var(--gold); }
.nav-btn:active { transform: scale(0.94); }

.dots { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dot {
  appearance: none;
  width: 11px; height: 11px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--gold-soft);
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.dot:hover { transform: scale(1.25); }
.dot.active { background: var(--gold); transform: scale(1.3); }

/* ---------- misc (stage overlays) ---------- */

.hint {
  position: absolute;
  z-index: 15;
  left: 0; right: 0;
  bottom: 14px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-dim);
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.9);
  pointer-events: none;
  padding: 0 12px;
  margin: 0;
}
.hint a { color: var(--ink-dim); }

#tooltip {
  position: absolute;
  z-index: 30;
  pointer-events: none;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--panel-border);
  background: rgba(8, 9, 16, 0.88);
  color: #ffd968;
  font-size: 12.5px;
  letter-spacing: 0.05em;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  transform: translate(-50%, -160%);
}
#tooltip.show { opacity: 1; }

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: var(--night);
  color: var(--ink-dim);
  font-size: 15px;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 24px;
  transition: opacity 0.5s ease;
}
.overlay.gone { opacity: 0; pointer-events: none; }
.overlay-error { background: rgba(7, 9, 18, 0.97); line-height: 1.6; }

.spinner {
  width: 42px; height: 42px;
  border-radius: 50%;
  border: 3px solid rgba(201, 162, 39, 0.2);
  border-top-color: var(--gold);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- tablet ---------- */

@media (max-width: 1023px) {
  .layout { grid-template-columns: 272px 1fr 272px; }
  .col-left, .col-right { padding: 14px 12px; gap: 12px; }
  .panel { width: auto; padding: 18px 18px 16px; }
  .topbar { padding: 14px 16px; }
  .topbar h1 { font-size: 27px; }
  .subtitle { font-size: 12px; }
}

/* ---------- mobile: single-column stack
   header -> stage 56vh -> switcher/list -> data/plaque -> controls ---------- */

@media (max-width: 640px) {
  html, body { height: auto; overflow: auto; }

  .layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    padding: 12px;
    gap: 12px;
  }

  /* Flatten the side columns so their children can be ordered in the stack */
  .col-left, .col-right {
    display: contents;
  }

  .topbar { order: 1; width: 100%; padding: 12px; }
  .topbar h1 { font-size: 21px; }
  .subtitle { font-size: 10.5px; }

  #stage, .stage { order: 2; width: 100%; height: 56vh; flex: 0 0 56vh; }

  .exhibit-nav { order: 3; width: 100%; overflow-y: visible; }

  .panel {
    order: 4;
    width: 100%;
    flex: none;
    max-height: none;
    padding: 16px 18px 14px;
  }
  .panel h2 { font-size: 21px; }

  .top-controls { order: 5; width: 100%; flex-direction: row; gap: 6px; }
  .btn { font-size: 12px; padding: 7px 12px; }

  .hint { font-size: 11px; bottom: 8px; }
  #now-viewing { font-size: 14px; top: 10px; }
}

/* The fail overlay must obey its hidden attribute (author display rules would otherwise override it) */
#webgl-fail[hidden]{display:none !important}

/* ================= PREMIUM UI SYSTEM ================= */
/* Fonts & base */
html, body { font-family: "Inter", "Segoe UI", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
::selection { background: rgba(201, 162, 39, 0.4); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
* { scrollbar-width: thin; scrollbar-color: var(--gold-soft) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(201, 162, 39, 0.4); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
.btn, .nav-btn, .dot { transition: background-color 0.18s ease-out, border-color 0.18s ease-out, color 0.18s ease-out, transform 0.18s ease-out, box-shadow 0.18s ease-out; }
#stage canvas { cursor: grab; }
#stage canvas:active { cursor: grabbing; }

/* Surfaces (brass hairline border kept as this gallery's accent identity) */
.topbar, .panel, .exhibit-nav {
  background: color-mix(in srgb, #0c0e18 92%, transparent);
  border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 50px rgba(0, 0, 0, 0.45);
}

/* Titles & eyebrows */
.topbar h1 { font-family: "Archivo", Georgia, serif; font-weight: 600; letter-spacing: -0.01em; }
.subtitle { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; }
.back-link { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; }
.eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; }
.fact-label { font-size: 11px; font-weight: 600; letter-spacing: 0.14em; }

/* Buttons */
.btn {
  min-height: 34px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500;
  background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.10);
}
.btn:hover { transform: translateY(-1px); border-color: var(--gold); background: rgba(255, 255, 255, 0.07); }
.btn[aria-pressed="true"], .btn-accent {
  background: linear-gradient(135deg, var(--gold), color-mix(in srgb, var(--gold) 78%, white));
  color: #0b0e18; border-color: transparent; font-weight: 600;
  box-shadow: 0 6px 18px rgba(201, 162, 39, 0.45);
}
.nav-btn { background: rgba(255, 255, 255, 0.04); border-color: rgba(255, 255, 255, 0.10); }
.nav-btn:hover { transform: translateY(-1px); border-color: var(--gold); }

/* Exhibit dots */
.dot { width: 8px; height: 8px; background: rgba(255, 255, 255, 0.25); border-color: transparent; }
.dot.active {
  background: var(--gold); transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.30), 0 0 12px rgba(201, 162, 39, 0.8);
}

/* Plaque anatomy */
.panel h2 { font-family: "Archivo", Georgia, serif; font-size: 26px; font-weight: 600; letter-spacing: -0.01em; }
.tagline { font-family: "Inter", sans-serif; font-style: italic; font-size: 15px; color: var(--ink-dim); }
.description { font-size: 14px; line-height: 1.65; }
.fact { border-radius: 12px; padding: 12px 14px; }
.fact-text { font-size: 14px; line-height: 1.65; }
@keyframes panelIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
#panel.panel-in { animation: panelIn 0.35s ease-out; }

/* Tooltip, now-viewing, hint */
#tooltip {
  background: rgba(10, 13, 22, 0.92); border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px; font-weight: 500;
}
#now-viewing { font-family: "Archivo", Georgia, serif; letter-spacing: -0.01em; font-weight: 600; }
.hint {
  left: 50%; right: auto; transform: translateX(-50%); bottom: 14px;
  width: max-content; max-width: calc(100% - 24px);
  background: rgba(10, 13, 22, 0.92);  
  border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 999px; padding: 7px 16px;
  font-size: 12px; color: #b8b2a4; text-shadow: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

/* Stage vignette */
#stage::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.38) 100%);
}

/* Loading & failure */
#loading::before {
  content: "THE UNUSUAL MUSEUM"; order: -1;
  font-size: 11px; font-weight: 600; letter-spacing: 0.3em; color: var(--gold);
}
#loading::after {
  content: ""; width: 160px; height: 3px; border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  background-size: 200% 100%; animation: loadSlide 1.2s linear infinite;
}
@keyframes loadSlide { from { background-position: 200% 0; } to { background-position: -100% 0; } }
.overlay-error p {
  max-width: 440px; padding: 28px 30px; margin: 0;
  background: color-mix(in srgb, #0c0e18 92%, transparent);
  border: 1px solid var(--panel-border); border-radius: 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 18px 50px rgba(0, 0, 0, 0.45);
  color: var(--ink-dim); line-height: 1.6;
}
.overlay-error p strong {
  display: block; margin-bottom: 8px;
  font-family: "Archivo", Georgia, serif;
  letter-spacing: -0.01em; font-size: 22px; font-weight: 600; color: var(--ink);
}

@media (prefers-reduced-motion: reduce) {
  #panel.panel-in, #loading::after, .spinner { animation: none; }
  .btn, .nav-btn, .dot { transition: none; }
}
