/* ---------- live display screens ---------- */
.page--display { background: #000; color: #fff; overflow: hidden; height: 100vh; }
.display { position: fixed; inset: 0; overflow: hidden; background: #000; cursor: none; }
.display.is-awake { cursor: default; }
.display__stage { position: absolute; inset: 0; perspective: 1800px; }

/* single-photo slides: blurred fill behind a letterboxed photo */
.slide { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; }
.slide__backdrop { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(40px) brightness(.45) saturate(1.2); transform: scale(1.1); }
.slide__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 20px 50px rgb(0 0 0 / .5)); }

.slide.is-entering { z-index: 2; animation: var(--in) 1.4s cubic-bezier(.22,.8,.26,1) both; }
.slide.is-leaving  { z-index: 1; animation: var(--out) 1.4s cubic-bezier(.55,0,.45,1) both; }

.fx-fade     { --in: fade-in;   --out: fade-out; }
.fx-slide    { --in: slide-in;  --out: slide-out; }
.fx-zoom     { --in: zoom-in;   --out: zoom-out; }
.fx-kenburns { --in: fade-in;   --out: fade-out; }
.fx-flip     { --in: flip-in;   --out: flip-out; }
.fx-blur     { --in: blur-in;   --out: blur-out; }

.fx-kenburns .slide__img,
.fx-kenburns .slide__backdrop { animation: kenburns var(--duration, 9s) linear both; }
.fx-kenburns .slide__img { object-fit: cover; filter: none; }

@keyframes fade-in   { from { opacity: 0; } }
@keyframes fade-out  { to   { opacity: 0; } }
@keyframes slide-in  { from { transform: translateX(100%); } }
@keyframes slide-out { to   { transform: translateX(-35%); opacity: .2; } }
@keyframes zoom-in   { from { transform: scale(1.35); opacity: 0; } }
@keyframes zoom-out  { to   { transform: scale(.8); opacity: 0; } }
@keyframes flip-in   { from { transform: rotateY(-90deg); opacity: 0; } 50% { opacity: 1; } }
@keyframes flip-out  { to   { transform: rotateY(90deg); opacity: 0; } }
@keyframes blur-in   { from { filter: blur(30px); opacity: 0; transform: scale(1.05); } }
@keyframes blur-out  { to   { filter: blur(30px); opacity: 0; } }
@keyframes kenburns  { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.16) translate(var(--kb-x), var(--kb-y)); } }

/* polaroid table */
.display__stage[data-mode=polaroid] { background: radial-gradient(circle at 50% 40%, #3d2c20, #120d0a 75%); }
.polaroid {
  position: absolute; left: var(--x); top: var(--y); margin: 0;
  width: clamp(220px, 26vw, 460px); padding: 3% 3% 0; background: #fbf8f1; border-radius: 3px;
  box-shadow: 0 25px 50px rgb(0 0 0 / .55);
  transform: rotate(var(--r)); animation: drop-in 1.1s cubic-bezier(.2,.9,.3,1.2) both;
}
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; }
.polaroid figcaption { color: #3b2d22; font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: clamp(14px, 1.4vw, 26px); text-align: center; padding: .5em .3em .8em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 2.6em; }
.polaroid.is-new { outline: 4px solid #E89B2B; outline-offset: 6px; }
.polaroid.is-leaving { animation: lift-out 1.2s ease both; }
@keyframes drop-in { from { opacity: 0; transform: translateY(-40px) scale(1.6) rotate(calc(var(--r) * -2)); } }
@keyframes lift-out { to { opacity: 0; transform: translateY(30px) scale(.85) rotate(var(--r)); } }

/* mosaic wall */
.display__stage[data-mode=mosaic] { display: grid; gap: 6px; padding: 6px; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); }
.display__stage[data-tiles="1"] { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.display__stage[data-tiles="2"] { grid-template-columns: repeat(2, 1fr); grid-template-rows: 1fr; }
.display__stage[data-tiles="3"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: 1fr; }
.display__stage[data-tiles="4"] { grid-template-columns: repeat(2, 1fr); grid-template-rows: repeat(2, 1fr); }
.display__stage[data-tiles="6"] { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 1fr); }
.tile { background: #111 center / cover no-repeat; border-radius: 4px; animation: fade-in .8s ease both; }
.tile.is-swapping { animation: tile-flip 1.4s ease both; }
.tile.is-new { box-shadow: inset 0 0 0 4px #E89B2B; }
@keyframes tile-flip { 0% { transform: rotateX(0); } 50% { transform: rotateX(90deg); filter: brightness(.4); } 100% { transform: rotateX(0); } }

/* overlays */
.display__caption {
  position: absolute; left: 3vw; bottom: 3.5vh; z-index: 5; max-width: 60vw;
  display: flex; flex-direction: column; gap: .2em; padding: .9em 1.3em; border-radius: 16px;
  background: rgb(10 7 5 / .55); backdrop-filter: blur(10px); font-size: clamp(16px, 1.6vw, 32px);
}
.display__caption strong { font-weight: 700; }
.display__caption span:last-child { opacity: .85; }
.display__caption.is-in { animation: caption-in .9s .5s cubic-bezier(.2,.8,.2,1) both; }
@keyframes caption-in { from { opacity: 0; transform: translateY(20px); } }
.display__new { align-self: flex-start; background: #E89B2B; color: #1B1410; font-size: .6em; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; padding: .2em .7em; border-radius: 999px; }

.display__qr {
  position: absolute; right: 2.5vw; bottom: 3.5vh; z-index: 5; display: grid; justify-items: center; gap: .4rem;
  padding: .8rem; background: #fff; color: #1B1410; border-radius: 14px; font-weight: 700; font-size: clamp(12px, .9vw, 18px);
}
.display__qr .qr-svg { width: clamp(90px, 8vw, 170px); height: auto; }

.display__empty { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; text-align: center; background: radial-gradient(circle at 50% 35%, #3a2a1f, #0d0907 70%); }
.display__empty h1 { font-size: clamp(2rem, 5vw, 5rem); color: #FAF7F2; }
.display__empty p { font-size: clamp(1rem, 1.8vw, 2rem); color: #d9cbb8; }
.display__empty-qr { background: #fff; padding: 1rem; border-radius: 18px; margin: 1rem 0; }
.display__empty-qr .qr-svg { width: clamp(160px, 18vw, 320px); height: auto; }
.display__url { font-family: ui-monospace, monospace; color: #E89B2B !important; }

.display__toolbar {
  position: absolute; top: 2vh; right: 2vw; z-index: 10; display: flex; gap: .5rem; align-items: center;
  padding: .5rem; border-radius: 999px; background: rgb(10 7 5 / .7); backdrop-filter: blur(8px);
  opacity: 0; transition: opacity .4s; pointer-events: none;
}
.display.is-awake .display__toolbar { opacity: 1; pointer-events: auto; }
.display__toolbar select, .display__toolbar button { font: inherit; color: #fff; background: #2a2019; border: 0; border-radius: 999px; padding: .45rem .9rem; cursor: pointer; }
.display__toolbar button[aria-pressed=false] { opacity: .45; text-decoration: line-through; }
.display__status { width: 10px; height: 10px; border-radius: 50%; background: #C8815E; margin: 0 .4rem; }
.display__status.is-live { background: #9BC56F; box-shadow: 0 0 0 4px rgb(155 197 111 / .25); }

@media (prefers-reduced-motion: reduce) {
  .slide.is-entering, .slide.is-leaving, .polaroid, .tile { animation-duration: .01s !important; }
}
