/* ============================================================
   Gallery Display — stylesheet
   Tuned for a TV / kiosk screen: pure black, no chrome, no scroll.
   ============================================================ */

:root {
  --transition-ms: 1400ms;
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

/* Must win over the display values set on .hud / .setup below. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body.cursor-hidden { cursor: none; }

/* ------------------------------------------------------------
   Video — the YouTube slot that plays before and after a full pass
   ------------------------------------------------------------ */

.video {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: #000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms linear, visibility 0s linear 600ms;
}

.video.is-visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 600ms linear, visibility 0s linear 0s;
}

.video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ------------------------------------------------------------
   Background music — a player that exists but is never seen.
   No controls, no branding, nothing clickable.
   ------------------------------------------------------------ */

.music {
  position: fixed;
  left: 0;
  bottom: 0;
  width: 240px;
  height: 240px;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

.music iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* The stage dims out before the video takes over. */
.stage { transition: opacity 600ms linear; }
.stage.is-dim { opacity: 0; }

/* ------------------------------------------------------------
   Start gate — one click, so the browser will allow audio
   ------------------------------------------------------------ */

.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(120% 120% at 50% 0%, #17181c 0%, #000 70%);
  cursor: pointer;
  text-align: center;
  padding: 6vmin;
}

.gate-card h1 {
  margin: 0.6em 0 0.3em;
  font-size: clamp(26px, 5vmin, 60px);
  letter-spacing: -0.02em;
  font-weight: 600;
}

.gate-card p {
  margin: 0;
  opacity: 0.6;
  font-size: clamp(14px, 2vmin, 24px);
}

.gate-mark {
  width: clamp(56px, 9vmin, 120px);
  height: clamp(56px, 9vmin, 120px);
  margin: 0 auto;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  position: relative;
  animation: gatePulse 2.4s ease-in-out infinite;
}

.gate-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 54%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: clamp(9px, 1.5vmin, 20px) 0 clamp(9px, 1.5vmin, 20px) clamp(15px, 2.5vmin, 33px);
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.85);
}

@keyframes gatePulse {
  0%, 100% { transform: scale(1);    border-color: rgba(255, 255, 255, 0.5); }
  50%      { transform: scale(1.07); border-color: rgba(255, 255, 255, 0.9); }
}

/* ------------------------------------------------------------
   Marquee — the continuous belt
   ------------------------------------------------------------ */

.track {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.tile {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  will-change: transform;
  backface-visibility: hidden;
}

/* Each tile is sized to the image's own aspect ratio, so the image
   fills it exactly — no letterboxing, no cropping, whatever shape
   the source photo is. */
.tile img {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ------------------------------------------------------------
   Stage + slides (slideshow mode)
   ------------------------------------------------------------ */

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: #000;
}

.slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  will-change: opacity, transform;
  backface-visibility: hidden;
  transition:
    opacity var(--transition-ms) var(--ease-out),
    transform var(--transition-ms) var(--ease-out);
}

/* Blurred backdrop, only shown when the photo is letterboxed */
.slide-bg {
  position: absolute;
  inset: -6%;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  filter: blur(48px) saturate(1.25) brightness(0.5);
  transform: scale(1.12);
  opacity: 0;
  transition: opacity 600ms linear;
}

.slide-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  will-change: transform;
  backface-visibility: hidden;
}

.slide.fit-cover  .slide-img { object-fit: cover; }
.slide.fit-contain .slide-img { object-fit: contain; }
.slide.fit-contain .slide-bg { opacity: 1; }

/* ------------------------------------------------------------
   Enter / exit states per transition type
   Order matters: exit rules come after active rules.
   ------------------------------------------------------------ */

/* fade + kenburns (kenburns is a fade plus a slow drift on the image) */
.slide[data-t="fade"],
.slide[data-t="kenburns"] { opacity: 0; }
.slide[data-t="fade"].is-active,
.slide[data-t="kenburns"].is-active { opacity: 1; }

/* zoom */
.slide[data-t="zoom"] { opacity: 0; transform: scale(1.08); }
.slide[data-t="zoom"].is-active { opacity: 1; transform: scale(1); }

/* slide / push */
.slide[data-t="slide"] { opacity: 1; transform: translate3d(100%, 0, 0); }
.slide[data-t="slide"].is-active { transform: translate3d(0, 0, 0); }

/* Exit styles are chosen by the INCOMING transition, so mixed
   galleries hand off to each other cleanly. */
.slide.exit-fade,
.slide.exit-kenburns { opacity: 0; transform: translate3d(0, 0, 0); }
.slide.exit-zoom { opacity: 0; transform: scale(0.96); }
.slide.exit-slide { opacity: 1; transform: translate3d(-100%, 0, 0); }

/* ------------------------------------------------------------
   Ken Burns drift — four directions, picked at random per slide
   ------------------------------------------------------------ */

.slide[data-t="kenburns"] .slide-img {
  animation-timing-function: linear;
  animation-fill-mode: both;
  animation-iteration-count: 1;
}

.kb-1 .slide-img { animation-name: kb1; }
.kb-2 .slide-img { animation-name: kb2; }
.kb-3 .slide-img { animation-name: kb3; }
.kb-4 .slide-img { animation-name: kb4; }

@keyframes kb1 { from { transform: scale(1.00) translate3d(0, 0, 0); }        to { transform: scale(1.12) translate3d(-1.6%, -1.2%, 0); } }
@keyframes kb2 { from { transform: scale(1.12) translate3d(1.6%, 1.0%, 0); }  to { transform: scale(1.00) translate3d(0, 0, 0); } }
@keyframes kb3 { from { transform: scale(1.04) translate3d(1.8%, -1.0%, 0); } to { transform: scale(1.14) translate3d(-1.2%, 1.2%, 0); } }
@keyframes kb4 { from { transform: scale(1.14) translate3d(-1.4%, 1.4%, 0); } to { transform: scale(1.02) translate3d(1.4%, -0.8%, 0); } }

/* Respect people who get motion sick — falls back to a plain fade */
@media (prefers-reduced-motion: reduce) {
  .slide[data-t="kenburns"] .slide-img { animation: none !important; }
  .slide[data-t="slide"] { transform: none; opacity: 0; }
  .slide[data-t="slide"].is-active { opacity: 1; }
  .slide.exit-slide { transform: none; opacity: 0; }
}

/* ------------------------------------------------------------
   HUD (press H) — hidden by default, this is a TV after all
   ------------------------------------------------------------ */

.hud {
  position: fixed;
  left: 2.2vmin;
  bottom: 2.2vmin;
  z-index: 20;
  display: flex;
  gap: 1.2em;
  align-items: baseline;
  padding: 0.7em 1.1em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: clamp(12px, 1.5vmin, 20px);
  letter-spacing: 0.02em;
}

.hud-gallery { font-weight: 600; }
.hud-count, .hud-state { opacity: 0.6; font-variant-numeric: tabular-nums; }

/* Optional thin progress line at the very bottom */
.progress {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  z-index: 15;
  background: rgba(255, 255, 255, 0.10);
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: rgba(255, 255, 255, 0.75);
  transform-origin: left center;
}

/* Transient key-press feedback */
.toast, .volume {
  position: fixed;
  top: 3vmin;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  padding: 0.6em 1.2em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  font-size: clamp(13px, 1.6vmin, 22px);
  opacity: 0;
  transition: opacity 220ms linear;
}
.toast.is-visible { opacity: 1; }

/* Sound state, bottom-right, only while a video is on screen. */
.volume {
  top: auto;
  left: auto;
  bottom: 3vmin;
  right: 3vmin;
  transform: none;
  opacity: 1;
}

/* ------------------------------------------------------------
   First-run / empty state
   ------------------------------------------------------------ */

.setup {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 6vmin;
  background: radial-gradient(120% 120% at 50% 0%, #17181c 0%, #000 70%);
}

.setup-card {
  max-width: 62ch;
  line-height: 1.6;
}

.setup-card h1 {
  margin: 0 0 0.4em;
  font-size: clamp(24px, 4vmin, 46px);
  letter-spacing: -0.02em;
}

.setup-card p { margin: 0 0 1.4em; opacity: 0.75; font-size: clamp(14px, 1.9vmin, 22px); }
.setup-card ol { margin: 0; padding-left: 1.3em; opacity: 0.75; font-size: clamp(14px, 1.9vmin, 22px); }
.setup-card li { margin-bottom: 0.7em; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 5px;
  padding: 0.12em 0.42em;
  font-size: 0.9em;
}
