/* newlywedkit.com — Venue Slideshow & Presentation Theme
   Refined dark/ambient wedding theater with Champagne Gold (#C5A880) accents */

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #0b0a0a;
  color: #faf8f5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Layout Metrics — slideshow.js reads these via cssPx() so the responsive
   media queries drive both stylesheet geometry and conveyor/flight math.
   ========================================================================== */
:root {
  --tile: 208px;
  --rail-w: 232px;
  --slide-pad: 244px;

  /* Newlywedkit Brand Palette */
  --nw-gold: #c5a880;
  --nw-gold-light: #dfcca8;
  --nw-gold-dark: #9e8058;
  --nw-gold-glow: rgba(197, 168, 128, 0.28);
  --nw-theater-bg: #141312;
  --nw-theater-deep: #0b0a0a;
  --nw-card-bg: rgba(18, 17, 16, 0.84);
  --nw-text-ivory: #faf8f5;
  --nw-text-muted: #d6d2cc;
}

@media (max-width: 1100px) {
  :root {
    --tile: 128px;
    --rail-w: 152px;
    --slide-pad: 164px;
  }
}

@media (max-width: 700px) {
  :root {
    --tile: 88px;
    --rail-w: 104px;
    --slide-pad: 12px;
  }
}

/* ==========================================================================
   Stage — Ambient Wedding Theater Background
   Warm obsidian vignette with subtle champagne warmth for theater projection
   ========================================================================== */
#stage {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(197, 168, 128, 0.06) 0%, transparent 65%),
    radial-gradient(circle at 50% 40%, #1c1a18 0%, #141312 45%, #0b0a0a 100%);
  background-color: var(--nw-theater-deep);
}

/* Exactly one photo on screen at a time. Its own blurred cover fills bars.
   Side padding keeps the photo clear of rails; slideshow.js derives its
   fly-target math from --slide-pad. */
#stage .slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0 var(--slide-pad);
}

/* Blurred cover image filling the letterbox bars */
#stage .slide .bg {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  filter: blur(36px) brightness(0.48) saturate(1.1);
  transform: scale(1.22);
}

/* Foreground active photo / video */
#stage .slide .fg {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.75),
    0 0 1px rgba(197, 168, 128, 0.35);
}

#stage .slide .fg.kenburns {
  animation: kb 14s ease-out both;
}

@keyframes kb {
  from { transform: scale(1.0); }
  to { transform: scale(1.045); }
}

/* Caption overlay on current slide */
#stage .slide .cap {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  max-width: 70vw;
  padding: 0.55rem 1.4rem;
  border-radius: 999px;
  background: var(--nw-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(197, 168, 128, 0.4);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 16px var(--nw-gold-glow);
  color: var(--nw-text-ivory);
  font: 500 clamp(14px, 2.2vh, 22px) system-ui, -apple-system, sans-serif;
  letter-spacing: 0.02em;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ==========================================================================
   Idle Screen — Ambient Wedding Couple Monogram & Title
   Shown before first photos are uploaded, with soft champagne gold dividers
   ========================================================================== */
#idle {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  color: var(--nw-text-ivory);
  text-align: center;
  font-family: system-ui, -apple-system, sans-serif;
  z-index: 1;
  background: radial-gradient(circle at 50% 50%, rgba(197, 168, 128, 0.08) 0%, transparent 60%);
  padding: 2rem;
}

#idle.hidden {
  display: none !important;
}

#idleLogo {
  max-height: 22vh;
  max-width: 60vw;
  border-radius: 14px;
  border: 1px solid rgba(197, 168, 128, 0.35);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.5),
    0 0 24px var(--nw-gold-glow);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px;
}

#idleTitle {
  font-family: "Playfair Display", Didot, "Bodoni MT", "Cormorant Garamond", "Cinzel", "Georgia", serif;
  font-size: clamp(2.4rem, 5.5vw, 4.4rem);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #fff;
  text-shadow:
    0 2px 20px rgba(0, 0, 0, 0.8),
    0 0 35px var(--nw-gold-glow);
  line-height: 1.2;
  margin: 0;
  position: relative;
}

/* Elegant Champagne Gold Divider below Idle Title */
#idleTitle::after {
  content: "";
  display: block;
  width: 140px;
  height: 2px;
  margin: 1.2rem auto 0;
  background: linear-gradient(90deg, transparent, var(--nw-gold) 30%, var(--nw-gold-light) 50%, var(--nw-gold) 70%, transparent);
  border-radius: 999px;
  box-shadow: 0 0 10px var(--nw-gold);
}

#idleSub {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: clamp(0.95rem, 1.8vw, 1.25rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--nw-gold-light);
  opacity: 0.92;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
  animation: idlePulse 4s ease-in-out infinite;
}

@keyframes idlePulse {
  0%, 100% { opacity: 0.8; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

/* ==========================================================================
   Memory Counter Pill (Top-Right)
   Sits left of the right rail so it never overlaps the "up next" tile.
   ========================================================================== */
#count {
  position: fixed;
  top: 16px;
  right: calc(var(--rail-w) + 16px);
  color: var(--nw-text-ivory);
  background: var(--nw-card-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(197, 168, 128, 0.38);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(197, 168, 128, 0.15);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font: 600 13px/1.2 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.03em;
  z-index: 3;
  white-space: nowrap;
}

/* ==========================================================================
   Scannable QR Code Card (Bottom-Left)
   High-contrast, elegant card with pure white QR tile for camera recognition
   across ballrooms, dining tables, and dim wedding venues.
   ========================================================================== */
#qrBox {
  position: fixed;
  left: 20px;
  bottom: 56px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  padding: 14px 16px;
  background: var(--nw-card-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(197, 168, 128, 0.45);
  border-radius: 16px;
  box-shadow:
    0 12px 36px rgba(0, 0, 0, 0.65),
    0 0 16px var(--nw-gold-glow);
  text-align: center;
}

/* Subtle Champagne Gold Top Glow Accent Bar */
#qrBox::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--nw-gold) 50%, transparent);
  border-radius: 999px;
}

#qrLabel {
  color: var(--nw-text-ivory);
  font: 600 13px/1.35 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Pure high-contrast white card for the QR code — essential for camera optical autofocus */
#qrImg {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  background: #ffffff;
  padding: 8px;
  box-sizing: border-box;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  display: block;
}

/* ==========================================================================
   Side Rails & Up Next Queue
   Conveyor glides up one slot per slide; gap must stay 10px to match railStep()
   ========================================================================== */
.rail {
  position: fixed;
  top: 0;
  bottom: 0;
  width: var(--rail-w);
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}

#railL {
  left: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to right, rgba(12, 11, 10, 0.5) 0%, transparent 100%);
}

#railR {
  right: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(to left, rgba(12, 11, 10, 0.5) 0%, transparent 100%);
}

/* Feathered track container: masks the top and bottom edge transitions */
#railLTrack, #railRTrack {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 8%, black 92%, transparent 100%);
}

/* Keep gap: 10px in sync with railStep() in slideshow.js */
.rail-track {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  will-change: transform;
}

.rail-tile {
  width: var(--tile);
  height: var(--tile);
  object-fit: cover;
  border-radius: 12px;
  opacity: 0.45;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(197, 168, 128, 0.2);
  transition: opacity 0.3s ease;
}

/* Pinned "Up Next" Tile at the top of the right rail */
#upnext {
  flex: none;
  padding: 12px 12px 4px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 3;
}

#upnext span {
  color: var(--nw-gold);
  font: 700 11px system-ui, -apple-system, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  gap: 5px;
}

#upnext span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--nw-gold);
  box-shadow: 0 0 6px var(--nw-gold);
}

#upnext img {
  width: var(--tile);
  height: var(--tile);
  object-fit: cover;
  border-radius: 12px;
  outline: 2px solid var(--nw-gold);
  box-shadow:
    0 4px 20px rgba(197, 168, 128, 0.4),
    0 4px 14px rgba(0, 0, 0, 0.6);
  opacity: 1;
}

/* Flying clone for the FLIP zoom-to-fill transition */
.fly {
  position: fixed;
  z-index: 4;
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  box-shadow:
    0 8px 36px rgba(0, 0, 0, 0.75),
    0 0 24px var(--nw-gold-glow);
  outline: 1px solid rgba(197, 168, 128, 0.5);
  transition:
    left 1.15s cubic-bezier(.22, .61, .36, 1),
    top 1.15s cubic-bezier(.22, .61, .36, 1),
    width 1.15s cubic-bezier(.22, .61, .36, 1),
    height 1.15s cubic-bezier(.22, .61, .36, 1);
}

.fly.fade {
  transition: opacity 0.55s ease;
  opacity: 0;
}

/* ==========================================================================
   Guest Message Ticker (Bottom Edge)
   Frosted dark marquee bar displaying guestbook messages
   ========================================================================== */
#ticker {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(20, 19, 18, 0.78) 0%, rgba(10, 9, 8, 0.94) 100%);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(197, 168, 128, 0.35);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.55);
  padding: 0.55rem 0;
  white-space: nowrap;
}

#tickerTrack {
  display: inline-flex;
  gap: 6rem;
  animation: tickerScroll linear infinite;
  will-change: transform;
}

@keyframes tickerScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

#ticker .msg {
  color: var(--nw-text-ivory);
  font: 500 15px/1.3 system-ui, -apple-system, sans-serif;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  display: inline-flex;
  align-items: center;
}

/* ==========================================================================
   Hint & Utilities
   ========================================================================== */
#hint {
  position: fixed;
  bottom: 48px;
  right: 18px;
  color: rgba(223, 204, 168, 0.65);
  font: 500 12px system-ui, -apple-system, sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 3;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   Responsive Adaptations (Mobile Screens <= 700px)
   Queue tracks hide; "Up next" floats in top-right corner; QR code compacts
   ========================================================================== */
@media (max-width: 700px) {
  #railL, #railLTrack, #railRTrack {
    display: none !important;
  }

  /* Shrink right rail to just the pinned upnext tile */
  #railR {
    top: 0;
    bottom: auto;
    left: auto;
    right: 0;
    width: auto;
    height: auto;
    overflow: visible;
    background: none;
  }

  #upnext {
    padding: 8px 10px 0;
    gap: 3px;
  }

  #upnext span {
    font-size: 9px;
  }

  #upnext img {
    border-radius: 8px;
    width: 68px;
    height: 68px;
  }

  #count {
    top: 10px;
    left: 10px;
    right: auto;
    font-size: 11px;
    padding: 0.25rem 0.6rem;
  }

  #qrBox {
    left: 10px;
    bottom: 42px;
    padding: 8px 10px;
    gap: 6px;
    border-radius: 12px;
  }

  #qrLabel {
    font-size: 11px;
  }

  #qrImg {
    width: 72px;
    height: 72px;
    padding: 4px;
    border-radius: 8px;
  }

  #hint {
    display: none;
  }

  #stage .slide .cap {
    max-width: 88vw;
    bottom: 10%;
    font-size: 13px;
    padding: 0.4rem 0.9rem;
  }

  #ticker {
    padding: 0.35rem 0;
  }

  #ticker .msg {
    font-size: 13px;
  }
}
