/* The Long Gallery — the upstairs hall: portrait wall, three doors, and the
 * ceiling's business. Shell-only (gallery.js, gallery-scene.js,
 * attic-progress.js); no hunt engine may require this file. */

body.gallery-body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(4.5rem + env(safe-area-inset-top, 0)) 1.25rem
    calc(2.5rem + env(safe-area-inset-bottom, 0));
  background:
    radial-gradient(ellipse 100% 40% at 50% 0%, rgba(178, 126, 132, 0.08), transparent 60%),
    var(--bg);
  text-align: center;
}

.gallery-door-back {
  color: var(--fg-secondary);
  text-decoration: none;
}

.gallery-shell-head {
  width: min(100%, 30rem);
}

.gallery-title-link {
  color: inherit;
  text-decoration: none;
}

.gallery-title-link:hover,
.gallery-title-link:focus-visible {
  text-decoration: none;
  outline: none;
}

.gallery-wordmark {
  margin: 0;
  color: #efe9ff;
  font-size: 2rem;
  font-weight: 600;
}

.gallery-shell-eyebrow {
  margin: 0.7rem 0 0;
  color: var(--fg-secondary);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
}

.gallery-main {
  width: min(100%, 40rem);
  margin: 2.4rem 0 0;
  padding: 0;
}

.gallery-head {
  text-align: center;
  margin-bottom: 0.6rem;
}
.gallery-eyebrow {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 0 0 0.3rem;
}
.gallery-title {
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  margin: 0 0 0.4rem;
  color: var(--fg);
}
.gallery-note {
  color: var(--fg-secondary);
  margin: 0 auto 1rem;
  max-width: 30rem;
}
.gallery-framing {
  color: color-mix(in srgb, var(--accent-2) 72%, var(--fg-secondary));
  font-size: 0.86rem;
  line-height: 1.45;
  margin: -0.45rem auto 1.05rem;
  max-width: 28rem;
}

/* ── the portrait wall (gallery-scene.js) ─────────────────────────────── */
.gallery-wall {
  overflow: hidden;
  padding: 0.6rem 0 1rem;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.gal-wall-row {
  display: flex;
  justify-content: center;
  gap: 0.7rem;
  margin: 0.45rem 0;
  transition: transform 300ms ease-out;
}
.gal-frame {
  width: 34px;
  height: 42px;
  border: 2px solid rgba(216, 196, 154, 0.35);
  border-radius: 2px;
  background:
    radial-gradient(circle at 50% 38%, rgba(233, 237, 255, 0.12), transparent 65%),
    rgba(13, 11, 20, 0.9);
  padding: 0;
  cursor: pointer;
  transition: transform 500ms ease;
}
.gal-frame--tall {
  height: 52px;
}
.gal-frame-sitter {
  display: block;
  width: 10px;
  height: 10px;
  margin: 8px auto 0;
  border-radius: 50%;
  border: 1px solid rgba(233, 237, 255, 0.28);
}
.gal-frame.is-askew {
  transform: rotate(-4deg);
}
.gal-frame.is-askew:nth-child(2n) {
  transform: rotate(3deg);
}
.gal-frame.is-straightened {
  transform: rotate(0deg);
}
.gal-frame.is-nudged {
  animation: gal-nudge 0.4s ease 1;
}
.gal-frame.is-leaning {
  transform: perspective(90px) rotateX(-7deg) scale(1.07);
}
.gal-frame.is-leaning .gal-frame-sitter {
  transform: translateY(2px) scale(1.08);
}

/* ── the three doors ──────────────────────────────────────────────────── */
.gallery-doors {
  display: grid;
  gap: 0.9rem;
  margin: 1rem 0 1.4rem;
}
.gal-door {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--fg);
  text-decoration: none;
  transition: transform 300ms ease, border-color 200ms ease;
}
.gal-door:hover,
.gal-door:focus-visible {
  border-color: rgba(178, 126, 132, 0.5);
}
.gal-door--lit {
  border-color: rgba(232, 197, 106, 0.4);
  box-shadow: 0 0 24px -12px rgba(232, 197, 106, 0.55);
}
.gal-door-figure svg {
  display: block;
  width: 58px;
  height: auto;
}
.gal-lamp-lit {
  animation: gal-lamp 3s ease-in-out infinite;
}
.gal-door-plate {
  display: grid;
  gap: 0.16rem;
  min-width: 0;
}
.gal-door-name {
  font-weight: 650;
  font-size: 1.05rem;
}
.gal-door-room {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.gal-door-line {
  color: var(--fg-secondary);
  font-size: 0.88rem;
}
.gal-keyword {
  display: inline-block;
  transform: rotate(-2deg) translateY(-1px);
  color: var(--accent-2);
}
.gal-door-cue {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}
.gal-progress {
  display: block;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  margin-top: 0.3rem;
}
.gal-progress-fill {
  display: block;
  height: 100%;
  background: var(--accent-2);
}

.gallery-nav--pills {
  width: min(100%, 21rem);
  margin: 1.6rem auto 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.gallery-nav--pills .gallery-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.38rem 0.6rem;
  border: 1px solid rgba(154, 163, 199, 0.14);
  border-radius: 0.6rem;
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.gallery-nav--pills .gallery-pill:hover,
.gallery-nav--pills .gallery-pill:focus-visible {
  border-color: rgba(154, 163, 199, 0.3);
  background: rgba(255, 255, 255, 0.035);
  color: var(--fg-secondary);
  text-decoration: none;
}

.gallery-pill-icon {
  display: inline-flex;
  flex: none;
  color: var(--muted);
  opacity: 0.85;
}

.gallery-nav--pills .gallery-pill:hover .gallery-pill-icon,
.gallery-nav--pills .gallery-pill:focus-visible .gallery-pill-icon {
  color: var(--fg-secondary);
  opacity: 1;
}

.gallery-pill-text {
  display: inline-flex;
  flex-direction: column;
  line-height: 1.2;
}

.gallery-pill-name {
  color: var(--fg-secondary);
  font-size: 0.76rem;
  font-weight: 600;
}

.gallery-pill-sub {
  color: var(--muted);
  font-size: 0.64rem;
  letter-spacing: 0.01em;
}

/* ── the ceiling's business (attic-progress.js) ───────────────────────── */
.attic-way {
  margin: 1.6rem auto 0;
  text-align: center;
}
.attic-way-door {
  display: inline-grid;
  gap: 0.4rem;
  justify-items: center;
  padding: 0.9rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--fg-secondary);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.attic-way-door svg {
  width: 96px;
  height: auto;
}
.attic-way-door--outline {
  opacity: 0.75;
  cursor: pointer;
}
.attic-way-door--waiting {
  cursor: pointer;
}
.attic-way-door[role="button"]:focus-visible {
  outline: 2px solid rgba(232, 197, 106, 0.7);
  outline-offset: 3px;
}
.attic-way-door--open:focus-within {
  border-color: rgba(232, 197, 106, 0.5);
}
.attic-way-climb {
  padding: 0.36rem 0.9rem;
  border: 1px solid rgba(232, 197, 106, 0.42);
  border-radius: 999px;
  color: #e8c56a;
  font-size: 0.82rem;
  text-decoration: none;
}
.attic-way-climb:hover,
.attic-way-climb:focus-visible {
  border-color: rgba(232, 197, 106, 0.75);
}
.attic-way-line {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
  max-width: 17rem;
}
.attic-lock {
  display: inline-flex;
  gap: 0.4rem;
}
.attic-lock-slot {
  appearance: none;
  min-width: 3.2rem;
  padding: 0.2rem 0.5rem;
  border: 1px dashed rgba(216, 196, 154, 0.35);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}
.attic-lock-slot.is-seated {
  border-style: solid;
  border-color: rgba(232, 197, 106, 0.6);
  color: #e8c56a;
}
button.attic-lock-slot.is-seated {
  cursor: pointer;
}
.attic-lock-slot.is-sounding {
  box-shadow: 0 0 0.8rem rgba(232, 197, 106, 0.28);
}
.attic-hatch-dust {
  opacity: 0;
}
.attic-way-door.is-dusted .attic-hatch-dust circle {
  animation: attic-hatch-dust 0.9s ease-out 1;
}
.attic-way-door.is-dusted .attic-hatch-dust circle:nth-child(2n) {
  animation-delay: 70ms;
}
.attic-way--stage2 .attic-way-door.is-creaking svg {
  animation: attic-hatch-creak 0.8s ease-in-out 1;
}

/* ── motion ───────────────────────────────────────────────────────────── */
@keyframes gal-nudge {
  0%, 100% { transform: rotate(0deg); }
  35% { transform: rotate(-1.6deg); }
  70% { transform: rotate(1.2deg); }
}
@keyframes gal-lamp {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
@keyframes attic-hatch-dust {
  0% { opacity: 0; transform: translateY(0); }
  22% { opacity: 0.65; }
  100% { opacity: 0; transform: translateY(13px); }
}
@keyframes attic-hatch-creak {
  0%, 100% { transform: translateY(0); }
  45%, 72% { transform: translateY(3px); }
}

/* One portrait glances at the ceiling (D3) — a slow lift of the sitter's
   mark, held a beat, released. Deniable: no glow, no color, no pointer. */
.gal-frame.is-glancing .gal-frame-sitter {
  animation: gal-glance 2.4s ease-in-out 1;
}
@keyframes gal-glance {
  0%,
  100% {
    transform: none;
  }
  35%,
  70% {
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gal-frame.is-glancing .gal-frame-sitter,
  .gal-frame.is-leaning .gal-frame-sitter,
  .gal-frame.is-nudged,
  .gal-lamp-lit,
  .attic-way-door.is-dusted .attic-hatch-dust circle,
  .attic-way--stage2 .attic-way-door.is-creaking svg {
    animation: none;
  }
  .gal-wall-row,
  .gal-door,
  .gal-frame.is-leaning {
    transform: none !important;
  }
}
