/* Slideshow display -- built for a TV across a room, so everything is large,
   high contrast, and free of anything that looks like a web page. */

:root {
  /* Wedding palette, off the actual invitation: gold script on a soft white/
     ivory ground, a real forest green as the secondary accent -- not a
     washed-out sage. Lives mainly in the chrome (title, badges, buttons,
     glows) rather than over the photos themselves -- they stay the show. */
  --accent: #3F7A34;
  --gold: #A67C2E;
  --sage-deep: #274020;
  --bg: #FAF7EF;
  --text: #1F2A1A;
  --slide-ms: 8000ms;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  cursor: none;
}

body {
  background:
    radial-gradient(78% 55% at 15% -4%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 68%),
    radial-gradient(56% 40% at 62% 0%, color-mix(in srgb, var(--gold) 26%, transparent), transparent 64%),
    radial-gradient(70% 50% at 100% 100%, color-mix(in srgb, var(--sage-deep) 22%, transparent), transparent 70%),
    var(--bg);
}

body.show-cursor { cursor: default; }

#stage {
  position: fixed;
  inset: 0;
}

.frame-border {
  position: fixed;
  inset: 0;
  z-index: 45;
  pointer-events: none;
  border: 9px solid transparent;
  border-image: linear-gradient(135deg, var(--accent), var(--gold) 50%, var(--accent)) 1;
  box-shadow:
    inset 0 0 55px -14px color-mix(in srgb, var(--accent) 38%, transparent),
    inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* --- slides ------------------------------------------------------------- */

.slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1400ms ease-in-out;
  will-change: opacity;
}

.slide.visible { opacity: 1; }

/* A soft wash behind collages so the gaps between photos aren't dead black. */
.slide-wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(100% 70% at 78% 10%, color-mix(in srgb, var(--gold) 28%, transparent), transparent 58%),
    radial-gradient(110% 80% at 85% 80%, color-mix(in srgb, var(--accent) 32%, transparent), transparent 65%),
    radial-gradient(90% 70% at 8% 92%, color-mix(in srgb, var(--sage-deep) 26%, transparent), transparent 60%),
    var(--bg);
}

.frame {
  position: absolute;
  overflow: hidden;
  border-radius: 10px;
  background: #F1EBDD;
  box-shadow:
    0 24px 50px -14px rgba(31, 42, 26, 0.45),
    0 0 0 2.5px color-mix(in srgb, var(--gold) 62%, rgba(0, 0, 0, 0.1)),
    0 0 46px -16px color-mix(in srgb, var(--accent) 55%, transparent);
  animation: frame-in 1200ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.frame img {
  width: 100%;
  height: 100%;
  /* contain, not cover -- the whole photo is always visible. Faces sit in
     different places in different photos, so no fixed crop bias can protect
     all of them; showing everything is the only crop that's never wrong.
     Any letterbox gap this leaves is covered by the frame's blurred
     backdrop (see buildSlide in slideshow.js). */
  object-fit: contain;
  object-position: center;
  display: block;
  position: relative;
}

/* Who sent this photo, when name tags are on. Small and corner-anchored on
   purpose -- it's a credit, not a caption competing with the picture. */
.frame-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  max-width: calc(100% - 16px);
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(10, 10, 14, 0.6);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: clamp(0.62rem, 0.95vw, 0.88rem);
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08);
}

@keyframes frame-in {
  from { opacity: 0; transform: translateY(26px) scale(0.965) rotate(var(--rot, 0deg)); }
  to   { opacity: 1; transform: translateY(0)    scale(1)     rotate(var(--rot, 0deg)); }
}

/* Full-bleed single photo. */
.frame.full {
  inset: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

/* A blurred copy of the photo fills whatever letterbox gap contain-fit
   leaves, on any frame size -- full-bleed solo slides and collage cells
   alike. */
.backdrop {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  filter: blur(46px) saturate(140%) brightness(0.42);
  transform: scale(1.12);
}

/* --- Ken Burns ---------------------------------------------------------- */

.kb {
  animation-name: var(--kb, kb-in);
  animation-duration: var(--kb-ms, 9000ms);
  animation-timing-function: linear;
  animation-fill-mode: both;
}

@keyframes kb-in    { from { transform: scale(1.00) translate(0,0); }        to { transform: scale(1.13) translate(-1.2%, 0.8%); } }
@keyframes kb-out   { from { transform: scale(1.13) translate(1.0%, -0.9%); } to { transform: scale(1.00) translate(0,0); } }
@keyframes kb-left  { from { transform: scale(1.10) translate(2.4%, 0); }     to { transform: scale(1.10) translate(-2.4%, 0); } }
@keyframes kb-right { from { transform: scale(1.10) translate(-2.4%, 0); }    to { transform: scale(1.10) translate(2.4%, 0); } }
@keyframes kb-up    { from { transform: scale(1.11) translate(0, 2.2%); }     to { transform: scale(1.11) translate(0, -2.2%); } }

/* --- empty state -------------------------------------------------------- */

.empty {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(70% 50% at 20% 0%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 64%),
    radial-gradient(55% 40% at 80% 100%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 67%),
    var(--bg);
  z-index: 40;
}

.empty-card { text-align: center; }

.empty h1 {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(3rem, 8vw, 5.8rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0 0 0.25em;
  color: var(--gold);
}

.empty p {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: clamp(1rem, 1.8vw, 1.6rem);
  color: color-mix(in srgb, var(--text) 65%, transparent);
  margin: 0 0 2em;
  font-weight: 400;
}

.empty-qr {
  width: clamp(220px, 26vw, 380px);
  height: auto;
  border-radius: 16px;
  padding: 18px;
  background: #fff;
  border: 1px solid rgba(43, 50, 38, 0.1);
  box-shadow:
    0 24px 50px -18px rgba(31, 42, 26, 0.4),
    0 0 46px -14px color-mix(in srgb, var(--accent) 55%, transparent);
}

.empty-url {
  margin-top: 1.4em;
  font-size: clamp(0.9rem, 1.4vw, 1.3rem);
  color: color-mix(in srgb, var(--text) 50%, transparent);
  font-variant-numeric: tabular-nums;
}

/* --- event title -----------------------------------------------------
   Parked in the top-left corner, out of the way of whatever's actually on
   screen -- a center banner sat right over people's faces on solo slides.
   Set in the same flowing script as the invitation, so it reads as a
   monogram rather than a party badge -- calm and romantic, not flashy. */

.event-title {
  position: fixed;
  left: 2vw;
  top: 1.6vw;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 20px;
  border-radius: 999px;
  background: linear-gradient(
    100deg,
    color-mix(in srgb, var(--accent) 50%, rgba(12, 12, 16, 0.6)),
    color-mix(in srgb, var(--sage-deep) 46%, rgba(12, 12, 16, 0.6))
  );
  backdrop-filter: blur(14px);
  box-shadow:
    0 8px 26px rgba(0, 0, 0, 0.5),
    0 0 0 1.5px color-mix(in srgb, var(--gold) 70%, rgba(255, 255, 255, 0.15)),
    0 0 38px -10px color-mix(in srgb, var(--accent) 65%, transparent);
}

.event-title-text {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(1.5rem, 2.8vw, 2.5rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  line-height: 1;
  background: linear-gradient(
    100deg,
    #fff 0%,
    var(--gold) 35%,
    var(--gold) 65%,
    #fff 100%
  );
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-shine 16s ease-in-out infinite;
}

.event-title-icon {
  flex: none;
  width: 12px;
  height: 12px;
  color: var(--gold);
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--gold) 60%, transparent));
  animation: title-twinkle 5s ease-in-out infinite;
}

.event-title-icon:last-of-type { animation-delay: 2.5s; }

@keyframes title-shine {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes title-twinkle {
  0%, 100% { opacity: 0.6; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1); }
}

/* --- corner prompt ------------------------------------------------------ */

/* Sized so a phone can actually scan this off a TV from a few metres away --
   a small tasteful badge is useless if nobody can read the code. */
.corner {
  position: fixed;
  right: 2vw;
  bottom: 2vw;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 26vw;
  padding: 11px 18px 11px 11px;
  border-radius: 16px;
  background:
    linear-gradient(120deg, color-mix(in srgb, var(--accent) 30%, transparent), transparent 55%),
    rgba(12, 12, 16, 0.68);
  backdrop-filter: blur(14px);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.5),
    0 0 0 1.5px color-mix(in srgb, var(--gold) 62%, rgba(255, 255, 255, 0.15)),
    0 0 40px -12px color-mix(in srgb, var(--accent) 62%, transparent);
  transition: opacity 600ms ease;
}

.corner-qr {
  /* Smaller than before -- still scannable from across the room, but no
     longer competing with the photo for real estate. */
  width: clamp(78px, 6.4vw, 118px);
  height: auto;
  border-radius: 9px;
  background: #fff;
  padding: 7px;
  display: block;
  flex: none;
}

.corner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.28;
  min-width: 0;
}

.corner-text strong {
  font-size: clamp(0.82rem, 1.05vw, 1.05rem);
  font-weight: 600;
  letter-spacing: 0.005em;
  color: #fff;
}

.corner-text span {
  font-size: clamp(0.72rem, 0.9vw, 0.9rem);
  color: rgba(255, 255, 255, 0.55);
}

/* --- badges and toasts -------------------------------------------------- */

.badge {
  position: fixed;
  left: 2.2vw;
  bottom: 2.2vw;
  z-index: 30;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: clamp(0.9rem, 1.2vw, 1.2rem);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #1a1013;
  background: linear-gradient(120deg, var(--accent), var(--gold));
  box-shadow: 0 0 60px color-mix(in srgb, var(--accent) 70%, transparent);
  animation: pop 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes pop {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.toast {
  position: fixed;
  top: 2.2vw;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  padding: 10px 20px;
  border-radius: 10px;
  background: rgba(200, 60, 60, 0.9);
  color: #fff;
  font-size: 0.95rem;
}

/* --- tap/click controls -------------------------------------------------- */

.controls {
  position: fixed;
  left: 50%;
  bottom: 2.2vw;
  transform: translateX(-50%);
  z-index: 35;
  display: flex;
  gap: 6px;
  padding: 8px;
  border-radius: 999px;
  background: rgba(12, 12, 16, 0.68);
  backdrop-filter: blur(14px);
  box-shadow:
    0 10px 34px rgba(0, 0, 0, 0.5),
    0 0 0 1.5px color-mix(in srgb, var(--gold) 58%, rgba(255, 255, 255, 0.15)),
    0 0 38px -12px color-mix(in srgb, var(--accent) 62%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms ease;
}

body.show-cursor .controls { opacity: 1; pointer-events: auto; }

.ctrl-btn {
  width: clamp(44px, 4.4vw, 56px);
  height: clamp(44px, 4.4vw, 56px);
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.ctrl-btn:active {
  background: linear-gradient(135deg, var(--accent), var(--gold));
  color: #1a1013;
}
.ctrl-btn.off { color: rgba(255, 255, 255, 0.35); }

.hidden { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .slide { transition-duration: 300ms; }
  .kb, .frame { animation: none !important; }
  .event-title-text, .event-title-icon { animation: none !important; }
}
