/* ==========================================================================
   Image Placeholder Styles - Golden Wedding Theme
   With graceful fallback: img shows when file exists, placeholder shows when not
   ========================================================================== */

.image-placeholder,
.hero-image-placeholder,
.gallery-placeholder {
  background: linear-gradient(135deg, #FDF8F0 0%, #F7E7CE 50%, #FDF8F0 100%);
  border: 2px dashed rgba(201, 168, 76, 0.4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  width: 100%;
}

/* When image loads, container adapts to image size */
.image-placeholder img,
.hero-image-placeholder img,
.gallery-placeholder img {
  position: relative;
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  z-index: 2;
}

/* Placeholder min-height only when no image loaded */
.image-placeholder:not(:has(img)) {
  min-height: 250px;
}

.hero-image-placeholder {
  min-height: 400px;
  border-radius: 0;
  border: none;
  background: var(--gradient-hero);
}

.hero-image-placeholder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
}

.gallery-placeholder {
  aspect-ratio: 4/3;
}

.gallery-placeholder img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Hide placeholder content when image is present and loaded */
.image-placeholder:has(img) .placeholder-content,
.hero-image-placeholder:has(img) .placeholder-content,
.gallery-placeholder:has(img) .placeholder-content {
  position: absolute;
  z-index: 1;
  opacity: 0;
}

/* Show placeholder content when image fails to load */
.image-placeholder img[src=""],
.image-placeholder img:not([src]),
.hero-image-placeholder img[src=""],
.hero-image-placeholder img:not([src]),
.gallery-placeholder img[src=""],
.gallery-placeholder img:not([src]) {
  display: none;
}

/* Fallback for browsers without :has() - JS adds this class */
.placeholder-hidden {
  display: none !important;
}

.placeholder-content {
  text-align: center;
  padding: 2rem;
  z-index: 1;
}

.placeholder-content i {
  font-size: 3rem;
  color: rgba(201, 168, 76, 0.5);
  margin-bottom: 1rem;
  display: block;
}

.placeholder-text {
  font-family: var(--font-secondary);
  color: var(--color-warm-gray);
  font-size: 1rem;
  margin-bottom: 0.5rem;
  font-style: italic;
}

.placeholder-filename {
  font-family: monospace;
  color: var(--color-gold);
  font-size: 0.8rem;
  background: rgba(201, 168, 76, 0.1);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  display: inline-block;
}

/* Responsive placeholder heights */
@media (max-width: 768px) {
  .image-placeholder:not(:has(img)) { min-height: 180px; }
  .hero-image-placeholder { min-height: 250px; }
  .gallery-placeholder { aspect-ratio: 4/3; }
  .placeholder-content i { font-size: 2rem; }
  .placeholder-text { font-size: 0.9rem; }
}
