/* ------------------------------------------------
   1) Basic Reset & Dark Mode
------------------------------------------------ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body.dark-mode {
  background: #111;
  color: #fff;
  font-family: Arial, sans-serif;
}

/* ------------------------------------------------
   2) HERO BANNER (Index Page)
------------------------------------------------ */
.hero {
  height: 350px;
  background-position: center;
  background-size: cover;
  position: relative;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.hero-overlay h1 {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.hero-overlay p {
  font-size: 1rem;
}

/* ------------------------------------------------
   3) ALBUM GRID (Top-Level Index)
------------------------------------------------ */
.album-grid {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 24px;
  margin: 40px auto;
  max-width: 1200px;
}

.album-card {
  background: #222;
  border-radius: 4px;
  overflow: hidden;
  width: 220px;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.4);
  transition: transform 0.2s;
}

.album-card:hover {
  transform: scale(1.02);
}

.album-thumb {
  display: block;
  width: 100%;
  height: 160px;
  background-size: cover;
  background-position: center;
  text-decoration: none;
}

.album-caption {
  padding: 10px;
}

.album-caption h2 {
  font-size: 1.2rem;
  margin-bottom: 5px;
}

.album-caption .count {
  font-size: 0.9rem;
  color: #aaa;
}

/* ------------------------------------------------
   4) SLIDESHOW (Category Pages)
------------------------------------------------ */
/* The slideshow container fills nearly the entire viewport */
#slideshow {
  position: relative;
  width: 100%;
  height: 99vh;
  overflow: hidden;  /* Prevents background from showing */
  background: #000;
  object-fit: contain;
}

/* "no-animation" images: display them fully inside the container */
.no-animation {
  /* Turn off any Ken Burns or transform-based animation: */
  animation: none;
  transition: opacity 1s ease-in-out;

  /* Let the browser handle the aspect ratio with object-fit: contain */
  object-fit: contain;
  width: auto;
  height: auto;

  /* Keep them from overflowing the container: */
  max-width: calc(100% - 60px); 
  max-height: calc(100% - 60px);
  margin: 0;
}

/* Center a no-animation image in the container */
#slide-image.no-animation,
#slide-image-next.no-animation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Slideshow images default to absolute positioning and fill container. */
#slideshow img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Ensures image fills the container */
  transition: opacity 1s ease-in-out;
}

/* Ken Burns effect with CSS variables if no random effect is applied */
#slide-image,
#slide-image-next {
  width: 100%;
  height: 100%;
  object-fit: cover;
  --start-scale: 1;
  --end-scale: 1.2;
  --start-x: 0;
  --start-y: 0;
  --end-x: 0;
  --end-y: 0;
  animation: kenburns 8s ease-in-out infinite alternate;
  transition: opacity 0.5s ease-in-out;
}

/* Ken Burns keyframes with dynamic CSS variables */
@keyframes kenburns {
  0% {
    transform: scale(var(--start-scale)) translate(var(--start-x), var(--start-y));
  }
  100% {
    transform: scale(var(--end-scale)) translate(var(--end-x), var(--end-y));
  }
}

/* ------------------------------------------------
   5) FADING OVERLAY FOR SLIDESHOW CONTROLS
------------------------------------------------ */
#slideshowOverlay {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  gap: 10px;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

#slideshowOverlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-btn {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  padding: 10px 15px;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.nav-btn:hover {
  background: rgba(62, 91, 231, 0.7);
}

.image-counter {
  color: #fff;
  font-size: 1rem;
  margin-left: 15px;
  align-self: center;
}
.image-counter .current {
  font-size: 2em;    /* Bigger size */
  font-weight: bold; /* Bold weight */
  margin-right: 0.2em;
}
.image-counter .total {
  font-size: 1em;
  font-weight: normal;
}

#slideshow:fullscreen,
#slideshow:-webkit-full-screen {
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------
   6) NAVIGATION ICON (Back Button)
------------------------------------------------ */
.back-overlay {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.back-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.back-btn {
  display: inline-block;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  padding: 10px 15px;
  font-size: 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.back-btn:hover {
  opacity: 1;
  background: rgba(62, 91, 231, 0.7);
}

#controls {
  position: absolute;
  top: 20px;
  left: 20px;
}

#controls .btn.nav-icon {
  width: 30px;
  height: 20px;
  cursor: pointer;
  position: relative;
}

#controls .btn.nav-icon span,
#controls .btn.nav-icon span::before,
#controls .btn.nav-icon span::after {
  position: absolute;
  width: 100%;
  height: 4px;
  background: #fff;
  border-radius: 2px;
  transition: 0.3s;
}

#controls .btn.nav-icon span {
  top: 50%;
  transform: translateY(-50%);
}

#controls .btn.nav-icon span::before {
  content: '';
  top: -10px;
}

#controls .btn.nav-icon span::after {
  content: '';
  top: 10px;
}

/* ------------------------------------------------
   7) FOOTER
------------------------------------------------ */
footer {
  text-align: center;
  color: #888;
  padding: 20px;
  font-size: 0.9rem;
}

/* ------------------------------------------------
   Additional Styling for Stopped Animation
------------------------------------------------ */
#slide-image.no-animation {
  object-fit: contain;
  padding: 0px;
}
#slideshow img.no-animation {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  
  width: auto;
  height: auto;
  max-width: calc(100% - 20px);
  max-height: calc(100% - 20px);

  object-fit: contain;
  margin: 0;
  animation: none; /* Turn off Ken Burns or fade */

  /* The "inner" black frame (border) */
  border: 5px solid black;

  /* The "outer" white frame using box-shadow. No blur, just an extra ring. */
  box-shadow: 0 0 0 5px #b9b7b7;
}

#slide-image {
  z-index: 1;
}
#slide-image-next {
  z-index: 2;
}

.kenburns-active {
  animation: kenburns 8s ease-in-out infinite alternate;
}

/* crossfadeIn and crossfadeOut keyframes for fancy fade transitions */
@keyframes crossfadeIn {
  0% {
    opacity: 0;
    transform: scale(1.1) translateX(20px) rotate(5deg);
    filter: blur(5px);
  }
  50% {
    opacity: 0.5;
    transform: scale(1.05) translateX(10px) rotate(2deg);
    filter: blur(2px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateX(0) rotate(0deg);
    filter: blur(0px);
  }
}

@keyframes crossfadeOut {
  0% {
    opacity: 1;
    transform: scale(1) translateX(0) rotate(0deg);
    filter: blur(0px);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.95) translateX(-10px) rotate(-2deg);
    filter: blur(2px);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateX(-20px) rotate(-5deg);
    filter: blur(5px);
  }
}

.avant-fade-in {
  animation: crossfadeIn 10s ease-in-out forwards;
}

.avant-fade-out {
  animation: crossfadeOut 10s ease-in-out forwards;
}

/* Fullscreen prompt overlay */
.fullscreen-prompt {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.fullscreen-prompt button {
  padding: 1rem 2rem;
  font-size: 1.2rem;
  cursor: pointer;
}

/* ------------------------------------------------
   8) RESPONSIVE DESIGN
   Optimierungen für mobile Endgeräte
------------------------------------------------ */

/* --- Ab ca. 768px und kleiner (Tablets, kleine Laptops, Hochformat-Smartphones) --- */
@media (max-width: 768px) {
  .hero {
    height: 220px; /* Weniger Höhe für kleine Bildschirme */
  }

  .hero-overlay h1 {
    font-size: 1.8rem; /* Reduziertes Font-Size */
  }

  .hero-overlay p {
    font-size: 0.9rem;
  }

  .album-grid {
    gap: 16px; /* Geringerer Abstand */
    margin: 20px auto;
  }

  .album-card {
    width: 180px; /* Kleiner, passt besser nebeneinander */
  }
}

/* --- Ab ca. 480px und kleiner (typische Smartphones) --- */
@media (max-width: 480px) {
  .hero {
    height: 180px; /* Nochmals reduzieren für sehr kleine Screens */
  }

  .hero-overlay h1 {
    font-size: 1.4rem;
    text-align: center;
  }

  .hero-overlay p {
    font-size: 0.85rem;
    text-align: center;
  }

  .album-grid {
    display: grid; 
    grid-template-columns: 1fr 1fr;
    margin: 20px auto;
    gap: 12px;
  }

  .album-card {
    width: 100%; 
    max-width: 160px; 
    margin: 0 auto;
  }

  .album-thumb {
    height: 120px;
  }

  .album-caption h2 {
    font-size: 1rem;
  }

  /* Buttons und Overlays anpassen */
  #slideshowOverlay {
    top: 10px;
    right: 10px;
  }

  .nav-btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  .image-counter {
    font-size: 0.9rem;
  }

  /* Back-Button verschieben und verkleinern */
  .back-overlay {
    top: 10px;
    left: 10px;
  }

  .back-btn {
    padding: 8px 10px;
    font-size: 0.9rem;
  }

  /* Footer Text verkleinern */
  footer {
    font-size: 0.8rem;
    padding: 10px;
  }
}
