/* MOAAII - 3D gallery tour.
   A cube-map room built from CSS 3D transforms; hotspots are DOM elements
   projected onto the same view frustum as the walls.
   Copyright (c) 2026 Spark Fire Technologies. */

html, body.tour { height: 100%; overflow: hidden; background: #05080e; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: #05080e;
}
#stage.dragging { cursor: grabbing; }

#world {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
}

.face {
  position: absolute;
  left: 50%;
  top: 50%;
  transform-style: flat;
  backface-visibility: hidden;
  background-size: 100% 100%;
  background-repeat: no-repeat;
  /* Hairline overlap hides the seam where two faces meet. */
  outline: 1px solid transparent;
}

/* Hotspots live above the cube and are positioned by projection each frame. */
#hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  perspective: 900px;
}

.hs {
  position: absolute;
  pointer-events: auto;
  transform-origin: 50% 50%;
  will-change: transform;
}

/* ------------------------------------------------------------- artwork */

.hs-art {
  width: 190px;
  cursor: pointer;
  filter: drop-shadow(0 22px 30px rgba(0, 0, 0, 0.55));
}
.hs-art .frame {
  border: 9px solid #d8c9a8;
  border-radius: 2px;
  background: #0e0c08;
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.5), 0 3px 0 rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.hs-art .frame img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.hs-art:hover .frame { border-color: #f4e3ba; }
.hs-art .plate {
  margin: 7px auto 0;
  width: 82%;
  padding: 4px 7px;
  background: rgba(9, 12, 18, 0.82);
  border: 1px solid rgba(216, 201, 168, 0.35);
  border-radius: 3px;
  font-family: Georgia, serif;
  font-size: 10.5px;
  line-height: 1.32;
  color: #efe4cd;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.hs-art .plate .yr { display: block; color: #c9a24a; font-size: 9.5px; letter-spacing: 0.06em; }
.hs-art.near .plate { opacity: 1; }

/* ------------------------------------------------------------- doorways */

.hs-door {
  cursor: pointer;
  text-align: center;
  color: #f0e6d2;
  width: 150px;
}
.hs-door .arch {
  width: 62px; height: 62px;
  margin: 0 auto 8px;
  border-radius: 50%;
  border: 2px solid rgba(230, 192, 105, 0.75);
  background: rgba(8, 12, 20, 0.55);
  display: grid; place-items: center;
  box-shadow: 0 0 26px rgba(230, 192, 105, 0.28);
  animation: door-pulse 3.4s ease-in-out infinite;
}
.hs-door .arch svg { width: 26px; height: 26px; fill: none; stroke: #e6c069; stroke-width: 1.8; }
.hs-door .label {
  font-family: Georgia, serif;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
}
.hs-door:hover .arch { background: rgba(230, 192, 105, 0.22); transform: scale(1.08); }
@keyframes door-pulse {
  0%, 100% { box-shadow: 0 0 20px rgba(230, 192, 105, 0.2); }
  50% { box-shadow: 0 0 34px rgba(230, 192, 105, 0.45); }
}

.hs-info { width: 34px; height: 34px; cursor: pointer; }
.hs-info .dot {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(230, 192, 105, 0.8);
  background: rgba(8, 12, 20, 0.7);
  color: #e6c069;
  display: grid; place-items: center;
  font-family: Georgia, serif;
  font-size: 17px;
}

/* ------------------------------------------------------------- chrome */

.tour-top, .tour-bottom {
  position: fixed;
  left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1.1rem;
  pointer-events: none;
}
.tour-top { top: 0; background: linear-gradient(180deg, rgba(5, 8, 14, 0.92), transparent); }
.tour-bottom { bottom: 0; background: linear-gradient(0deg, rgba(5, 8, 14, 0.92), transparent); justify-content: center; }
.tour-top > *, .tour-bottom > * { pointer-events: auto; }

.room-title { font-family: Georgia, serif; font-size: 1.12rem; line-height: 1.25; }
.room-sub { font-size: 0.76rem; color: var(--text-faint); letter-spacing: 0.13em; text-transform: uppercase; }

.tour-actions { margin-left: auto; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

.compass {
  position: fixed;
  right: 1.1rem;
  bottom: 5.2rem;
  width: 74px; height: 74px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(8, 12, 20, 0.75);
  z-index: 20;
  display: grid; place-items: center;
}
.compass svg { width: 100%; height: 100%; }
.compass .needle { transform-origin: 50% 50%; transition: transform 0.08s linear; }

/* ------------------------------------------------------------- panels */

.panel {
  position: fixed;
  z-index: 30;
  background: rgba(10, 15, 24, 0.97);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

#mapPanel {
  left: 1.1rem;
  top: 4.6rem;
  width: 280px;
  max-height: calc(100vh - 11rem);
  overflow: auto;
  padding: 0.9rem;
}
#mapPanel .room-link {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 0.87rem;
  cursor: pointer;
}
#mapPanel .room-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--text); text-decoration: none; }
#mapPanel .room-link.current { background: rgba(201, 162, 74, 0.14); color: var(--brass-bright); }
#mapPanel .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
#mapPanel .count { margin-left: auto; font-size: 0.74rem; color: var(--text-faint); }

#detailPanel {
  right: 0; top: 0; bottom: 0;
  width: min(430px, 100%);
  border-radius: 0;
  border-right: none;
  overflow-y: auto;
  padding: 1.4rem 1.4rem 3rem;
  transform: translateX(100%);
  transition: transform 0.26s cubic-bezier(0.22, 0.8, 0.3, 1);
}
#detailPanel.open { transform: none; }
#detailPanel img.hero { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); background: #0d1420; }

.detail-close { position: absolute; right: 0.9rem; top: 0.9rem; }

.detail-field { margin-top: 0.85rem; }
.detail-field dt { font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-faint); }
.detail-field dd { margin: 0.15rem 0 0; font-size: 0.93rem; }

/* The introduction sits low and to the side: it must never cover the piece a
   visitor walked in to see. */
#introCard {
  position: fixed;
  right: 1.1rem;
  top: 5.4rem;
  width: min(360px, calc(100% - 2.2rem));
  z-index: 40;
  padding: 1.2rem 1.35rem;
}
#introCard h2 { font-size: 1.6rem; margin-bottom: 0.3rem; }
#introCard .intro-text { color: var(--text-dim); font-size: 0.95rem; }

#loadingVeil {
  position: fixed; inset: 0; z-index: 60;
  background: #05080e;
  display: grid; place-items: center;
  transition: opacity 0.4s ease;
}
#loadingVeil.gone { opacity: 0; pointer-events: none; }
#loadingVeil .mark { font-family: Georgia, serif; letter-spacing: 0.4em; color: var(--brass); font-size: 1.1rem; }

.hint-bar {
  font-size: 0.78rem;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  background: rgba(8, 12, 20, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0.35rem 0.95rem;
}
.hint-bar kbd {
  font-family: var(--mono);
  font-size: 0.72rem;
  padding: 0.05rem 0.35rem;
  border: 1px solid var(--line-soft);
  border-radius: 4px;
  color: var(--text-dim);
}

@media (max-width: 780px) {
  #mapPanel { display: none; }
  #mapPanel.forced { display: block; width: min(280px, calc(100% - 2.2rem)); }
  .hs-art { width: 140px; }
  .compass { display: none; }
}
