/* gallery.css — base shell, layer stacking and the entry screen.
   Owned by the lead. HUD, artwork and guide chrome live in their own files. */

:root {
  --gold: #c9a227;
  --gold-soft: #e6c860;
  --ink: #0b0a10;
  --paper: #f4f1ea;
  --muted: rgba(244, 241, 234, 0.62);
  --panel: rgba(14, 13, 20, 0.82);
  --panel-line: rgba(233, 226, 208, 0.16);
  --radius: 14px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  touch-action: none;
}

/* --- Layer stack -------------------------------------------------------- */
/* CSS3D iframes sit at the bottom; the WebGL canvas paints on top of them and
   punches transparent holes where the artworks are. */

#css3d-layer {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  pointer-events: none; /* the artwork system enables this per-frame on focus */
}

#css3d-layer > div { pointer-events: none; }

#gl-canvas {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* The roots are transparent to the pointer. Each module re-enables
   `pointer-events` on its own interactive parts.
   Do NOT add a blanket `#hud-root > * { pointer-events: auto }` here: an ID
   selector outranks the module stylesheets, so it would override the
   deliberate `pointer-events: none` on full-screen overlays (the artwork focus
   chrome, the guide panel, the room title) and those invisible layers would
   then swallow clicks meant for the artworks. */
#hud-root, #guide-root, #artwork-root {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

/* --- Reticle ------------------------------------------------------------ */

.reticle {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 4;
  translate: -50% -50%;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
/* Only ever shown while the pointer is locked, where it is the cursor. With a
   normal visible cursor a second dot in the middle of the screen just reads as
   something being broken, so it stays hidden and the real cursor plus the
   hover highlight do the signalling. */
.reticle.is-visible { opacity: 0; }
body.is-pointer-locked .reticle.is-visible { opacity: 0.75; }

/* The cursor is the affordance now. */
body.is-pointing-at-art { cursor: pointer; }
.reticle span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 0, 0, 0.6);
  transition: all 0.2s var(--ease);
}
.reticle.is-hot span {
  width: 16px;
  height: 16px;
  background: transparent;
  border: 2px solid var(--gold-soft);
  box-shadow: 0 0 12px rgba(201, 162, 39, 0.7);
}

/* --- Entry / loading screen --------------------------------------------- */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(201, 162, 39, 0.14), transparent 55%),
    linear-gradient(180deg, #0e0d15 0%, #08070c 100%);
  transition: opacity 0.6s var(--ease), visibility 0.6s;
}
.loading-screen.is-gone { opacity: 0; visibility: hidden; }
.loading-screen[hidden] { display: none; }

.loading-inner { max-width: 560px; }
.loading-mark { color: var(--gold); opacity: 0.9; margin-bottom: 18px; }

.loading-screen h1 {
  font-family: var(--serif);
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 500;
  letter-spacing: 0.01em;
  margin: 0 0 12px;
}
.loading-sub {
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.98rem;
  margin: 0 0 30px;
}

.loading-bar {
  height: 2px;
  background: rgba(244, 241, 234, 0.12);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 14px;
}
.loading-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--gold-soft));
  transition: width 0.4s var(--ease);
}
.loading-status {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  min-height: 1.2em;
  margin: 0 0 28px;
}
.loading-status.is-error { color: #ff8686; text-transform: none; letter-spacing: 0; }

.enter-btn {
  font: inherit;
  font-size: 1rem;
  padding: 14px 34px;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.55);
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.22), rgba(201, 162, 39, 0.08));
  color: var(--paper);
  cursor: pointer;
  transition: all 0.25s var(--ease);
}
.enter-btn:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.36), rgba(201, 162, 39, 0.16));
  transform: translateY(-1px);
}
.enter-btn:disabled { opacity: 0.35; cursor: progress; }
.enter-btn:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }

.loading-hint {
  margin: 26px 0 0;
  font-size: 0.8rem;
  color: rgba(244, 241, 234, 0.42);
  line-height: 2;
}
kbd {
  font: inherit;
  font-size: 0.72rem;
  padding: 2px 7px;
  margin: 0 1px;
  border-radius: 5px;
  border: 1px solid rgba(244, 241, 234, 0.2);
  background: rgba(244, 241, 234, 0.06);
}

.noscript {
  position: fixed;
  inset: 0;
  z-index: 99;
  display: grid;
  place-items: center;
  padding: 40px;
  text-align: center;
  background: var(--ink);
  line-height: 1.7;
}
.noscript a { color: var(--gold-soft); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
