/* ---------------------------------------------------------
   Global Layout
--------------------------------------------------------- */

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}

body {
  background: #000;
  color: #f5f5f5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow: hidden;
}

#slideshowRoot {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* ---------------------------------------------------------
   Bottom Overlay (Album Title, Controls)
--------------------------------------------------------- */

.overlay {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.85),
    rgba(0, 0, 0, 0.2)
  );
  backdrop-filter: blur(8px);
  z-index: 10000;
}

.overlay-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.album-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.album-subtitle {
  font-size: 0.75rem;
  opacity: 0.75;
}

.overlay-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.overlay-select {
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 10, 10, 0.9);
  color: #f5f5f5;
  font-size: 0.8rem;
  max-width: 260px;
}

.overlay-button {
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 20, 20, 0.9);
  color: #f5f5f5;
  font-size: 0.8rem;
  cursor: pointer;
}

.overlay-button:hover {
  background: rgba(40, 40, 40, 0.95);
}

/* ---------------------------------------------------------
   Settings Panel
--------------------------------------------------------- */

.settings-panel {
  position: fixed;
  right: 1rem;
  bottom: 3.2rem;
  min-width: 260px;
  background: rgba(10, 10, 10, 0.96);
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.7);
  z-index: 10001;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.settings-panel.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.settings-inner {
  padding: 0.75rem 0.9rem 0.9rem;
}

.settings-inner h2 {
  margin: 0 0 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.4rem;
}

.settings-row label {
  font-size: 0.75rem;
  opacity: 0.85;
}

.settings-row input {
  padding: 0.3rem 0.45rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #151515;
  color: #f5f5f5;
  font-size: 0.8rem;
}

.settings-row input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.4);
}

.settings-actions {
  margin-top: 0.6rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.settings-hint {
  font-size: 0.7rem;
  margin-top: 0.55rem;
  opacity: 0.8;
}

.link-preview {
  opacity: 0.9;
}

/* ---------------------------------------------------------
   Frames (Photos on a Table)
--------------------------------------------------------- */

.frame {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  /* Center each frame around its left/top coordinates */
  transform: translate(-50%, -50%);
}

/* JS adds this when a frame should be visible */
.frame-enter-active {
  opacity: 1;
}

/* JS adds this before recycling a frame */
.frame-leave-active {
  opacity: 0;
}

/* White border + shadow, animated as a whole (border + photo) */
.frame-inner {
  display: block;
  border: 12px solid #ffffff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  background: #101010;
  overflow: hidden;

  /* Per-frame variables */
  --tilt: 0deg;
  --zoomStart: 1.04;
  --zoomEnd: 1.10;

  /* Ken Burns animation uses these vars */
  animation: kenburns-slow 22s ease-in-out infinite alternate;
  transform-origin: center center;
}

/* Image fills the frame; height auto works with aspect ratio */
.frame-inner img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: cover;

  /* Do not animate image separately; the frame moves as a whole */
  animation: none !important;
  transform: none !important;
}

/* Ken Burns: rotate + scale based on per-frame vars */
@keyframes kenburns-slow {
  0% {
    transform: rotate(var(--tilt)) scale(var(--zoomStart));
  }
  100% {
    transform: rotate(var(--tilt)) scale(var(--zoomEnd));
  }
}

/* ---------------------------------------------------------
   UI Auto-hide (overlay + settings)
--------------------------------------------------------- */

.overlay-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.overlay,
.settings-panel {
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* ---------------------------------------------------------
   Mobile tweaks
--------------------------------------------------------- */

@media (max-width: 768px) {
  .overlay {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
}
