/* Custom Font */
@font-face {
  font-family: 'CustomFont';
  src: url('../fonts/my-font.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap; /* Show fallback font while loading */
}

/* Reset & Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
  background: #000;
  color: #fff;
}

/* Gallery Container - Full Viewport */
.gallery-container {
  width: 100vw;
  height: 100vh;
  position: relative;
  overflow: hidden;
  background: #000;
}

/* Slides Wrapper - Contains all slides */
.slides-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  touch-action: pan-y pinch-zoom;
}

/* Individual Slide */
.slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  will-change: transform;
  transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.slide.no-transition {
  transition: none;
}

.slide.dragging {
  transition: none;
}

/* Slide positioning */
#currentSlide {
  transform: translateX(0);
  z-index: 2;
}

#nextSlide {
  transform: translateX(100%);
  z-index: 1;
}

/* Image container - sizes to the actual image dimensions */
.image-container {
  position: relative;
  display: inline-block;
  max-width: 100vw;
  max-height: 100vh;
}

/* Image within container */
.slide-image {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
}

/* Orientation-Specific Image Sizing - let images size naturally */
.slide.portrait .image-container {
  max-width: 100vw;
  max-height: 100vh;
}

.slide.portrait .slide-image {
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
}

.slide.landscape .image-container {
  max-width: 100vw;
  max-height: 100vh;
}

.slide.landscape .slide-image {
  width: auto;
  height: auto;
  max-width: 100vw;
  max-height: 100vh;
}

/* CRITICAL: Rotate landscape photos on portrait devices */
/* This ensures long edge of photo aligns with long edge of phone */
@media (orientation: portrait) {
  /* Rotate the entire container, not just the image */
  .slide.landscape .image-container {
    transform: rotate(90deg);
    transform-origin: center center;
    /* After rotation, constrain to rotated viewport dimensions */
    max-width: 100vh;
    max-height: 100vw;
  }

  .slide.landscape .slide-image {
    /* Image sizes naturally within the rotated container */
    width: auto;
    height: auto;
    max-width: 100vh;
    max-height: 100vw;
    /* No rotation on image - the container handles it */
    transform: none;
  }

  .slide.landscape .day-number.left {
    top: 20px;
    left: 20px;
    right: auto;
  }

  .slide.landscape .day-number.right {
    left: auto;
    right: 20px;
    top: 20px;
  }
}

/* Day Number Overlay - positioned relative to image, not screen */
.day-number {
  position: absolute;
  top: 0px;
  font-size: 100px;
  font-weight: 800;
  line-height: 1;
  opacity: 0.85;
  z-index: 20;
  pointer-events: none;
  text-shadow:
    0 2px 6px rgba(0, 0, 0, 0.8),
    0 4px 16px rgba(0, 0, 0, 0.6),
    0 8px 32px rgba(0, 0, 0, 0.4);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.day-number.left {
  left: 20px;
}

.day-number.right {
  right: 20px;
  text-align: right;
}

/* Caption - Fixed position at screen bottom, colors set via JS */
.caption {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  padding: 20px;
  font-size: 24px;
  line-height: 1.4;
  text-align: center;
  z-index: 100;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  font-weight: 1000;
  font-family: 'CustomFont', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  /* Colors set dynamically via JavaScript from config */
}

.caption:empty {
  display: none;
}

/* Orientation hint removed - we rotate photos instead */

/* Loading Indicator */
.loading {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #000;
  z-index: 100;
  transition: opacity 0.3s ease;
}

.loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-text {
  font-size: 18px;
  color: #888;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.6;
  }
  50% {
    opacity: 1;
  }
}

/* Prevent Text Selection During Swipes */
.gallery-container * {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Desktop Optimizations */
@media (min-width: 768px) {
  .day-number {
    font-size: clamp(100px, 15vw, 180px);
  }

  .caption {
    font-size: 18px;
    padding: 30px 40px;
  }
}

/* Landscape Phone Orientation */
@media (max-height: 500px) and (orientation: landscape) {
  .day-number {
    font-size: clamp(50px, 12vh, 90px);
    top: 10px;
  }

  .day-number.left {
    left: 15px;
  }

  .day-number.right {
    right: 15px;
  }

  .caption {
    font-size: 14px;
    padding: 15px 20px;
  }
}


