/* ===========================
   Gallery placeholders
   File: gallery-placeholder.css
   =========================== */


/* ===========================
   BASE PLACEHOLDER BACKGROUNDS
   =========================== */

.gallery-main {
  background:
    linear-gradient(135deg, #EAF7FF 0%, #DDF3FF 45%, #E8FFF6 100%);
}

.gallery-placeholder-main {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  border-radius: inherit;
  isolation: isolate;
  pointer-events: none;
  background:
    linear-gradient(135deg, #EAF7FF 0%, #DDF3FF 45%, #E8FFF6 100%);
  box-shadow:
    inset 0 0 0 1px rgba(30, 136, 229, 0.12),
    0 8px 22px rgba(15, 63, 92, 0.08);
}


/* ===========================
   THUMB PLACEHOLDER LAYOUT
   =========================== */

.gallery-placeholder-thumbs {
  display: none;
}

@media (min-width: 700px) {
  .gallery-strip {
    min-height: 82px;
  }

  .gallery-placeholder-thumbs {
    display: flex;
    gap: 8px;
    width: 100%;
    padding: 0;
  }

  .gallery-placeholder-thumbs span {
    position: relative;
    flex: 0 0 auto;
    width: 124px;
    height: 70px;
    overflow: hidden;
    border-radius: 4px;
    isolation: isolate;
    pointer-events: none;
    background:
      linear-gradient(135deg, #EAF7FF 0%, #DDF3FF 50%, #E8FFF6 100%);
    box-shadow:
      inset 0 0 0 1px rgba(30, 136, 229, 0.12),
      0 6px 16px rgba(15, 63, 92, 0.08);
  }
}

@media (max-width: 699px) {
  #g-strip.gallery-strip {
    min-height: 0;
    margin-top: 0;
    padding: 0;
  }

  .gallery-placeholder-thumbs {
    display: none !important;
  }
}

#g-strip .thumb-shell {
  flex: 0 0 auto;
}


/* ===========================
   SHARED SOFT INTERIOR FILL
   =========================== */

.gallery-placeholder-main::before,
.gallery-placeholder-thumbs span::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      rgba(255, 255, 255, 0.18) 35%,
      rgba(142, 230, 193, 0.22) 50%,
      rgba(255, 255, 255, 0.18) 65%,
      transparent 100%
    );
  transform: translateX(-120%);
  animation: phSoftFill 2.2s ease-in-out infinite;
}

.gallery-placeholder-main::after,
.gallery-placeholder-thumbs span::after {
  display: none;
}


/* ===========================
   BORDER TRACE LINES
   Used by main + thumb placeholder HTML
   =========================== */

.ph-border {
  position: absolute;
  z-index: 2;
  display: block;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(30, 136, 229, 0),
    rgba(30, 136, 229, 0.95),
    rgba(142, 230, 193, 1),
    rgba(30, 136, 229, 0)
  );
}

.ph-top {
  left: 0;
  top: 0;
  width: 100%;
  height: 2px;
  transform-origin: left center;
  transform: scaleX(0);
  animation: phTop 2.2s ease-in-out infinite;
}

.ph-right {
  right: 0;
  top: 0;
  width: 2px;
  height: 100%;
  transform-origin: top center;
  transform: scaleY(0);
  animation: phRight 2.2s ease-in-out infinite;
  background: linear-gradient(
    180deg,
    rgba(30, 136, 229, 0),
    rgba(30, 136, 229, 0.95),
    rgba(142, 230, 193, 1),
    rgba(30, 136, 229, 0)
  );
}

.ph-bottom {
  right: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  transform-origin: right center;
  transform: scaleX(0);
  animation: phBottom 2.2s ease-in-out infinite;
}

.ph-left {
  left: 0;
  bottom: 0;
  width: 2px;
  height: 100%;
  transform-origin: bottom center;
  transform: scaleY(0);
  animation: phLeft 2.2s ease-in-out infinite;
  background: linear-gradient(
    0deg,
    rgba(30, 136, 229, 0),
    rgba(30, 136, 229, 0.95),
    rgba(142, 230, 193, 1),
    rgba(30, 136, 229, 0)
  );
}

/* ===========================
   Curated placeholder layout
   right-side desktop category tiles
   =========================== */

.gallery-placeholder-curated {
  display: none;
}

@media (min-width: 1024px) {
  .gallery-placeholder-curated {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .gallery-placeholder-curated span {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 8px;
    isolation: isolate;
    pointer-events: none;
    background:
      linear-gradient(135deg, #EAF7FF 0%, #DDF3FF 50%, #E8FFF6 100%);
    box-shadow:
      inset 0 0 0 1px rgba(30, 136, 229, 0.12),
      0 6px 16px rgba(15, 63, 92, 0.08);
  }

  .gallery-placeholder-curated span::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background:
      linear-gradient(
        110deg,
        transparent 0%,
        rgba(255, 255, 255, 0.18) 35%,
        rgba(142, 230, 193, 0.22) 50%,
        rgba(255, 255, 255, 0.18) 65%,
        transparent 100%
      );
    transform: translateX(-120%);
    animation: phSoftFill 2.2s ease-in-out infinite;
  }

  .gallery-placeholder-curated span:nth-child(2) .ph-border,
  .gallery-placeholder-curated span:nth-child(2)::before {
    animation-delay: .16s;
  }

  .gallery-placeholder-curated span:nth-child(3) .ph-border,
  .gallery-placeholder-curated span:nth-child(3)::before {
    animation-delay: .32s;
  }
}

/* Main placeholder: slightly thicker and slower */
.gallery-placeholder-main .ph-top,
.gallery-placeholder-main .ph-bottom {
  height: 3px;
  animation-duration: 2.6s;
}

.gallery-placeholder-main .ph-right,
.gallery-placeholder-main .ph-left {
  width: 3px;
  animation-duration: 2.6s;
}


/* Thumb stagger */
.gallery-placeholder-thumbs span:nth-child(2) .ph-border,
.gallery-placeholder-thumbs span:nth-child(2)::before {
  animation-delay: .12s;
}

.gallery-placeholder-thumbs span:nth-child(3) .ph-border,
.gallery-placeholder-thumbs span:nth-child(3)::before {
  animation-delay: .24s;
}

.gallery-placeholder-thumbs span:nth-child(4) .ph-border,
.gallery-placeholder-thumbs span:nth-child(4)::before {
  animation-delay: .36s;
}

.gallery-placeholder-thumbs span:nth-child(5) .ph-border,
.gallery-placeholder-thumbs span:nth-child(5)::before {
  animation-delay: .48s;
}


/* ===========================
   CATEGORY PREVIEW PLACEHOLDER
   CSS-only, no extra HTML needed
   =========================== */

.category-preview-tile.gallery-img-shell {
  position: relative;
  isolation: isolate;
  background:
    linear-gradient(135deg, #EAF7FF 0%, #DDF3FF 50%, #E8FFF6 100%);
}

.category-preview-tile.gallery-img-shell:not(.is-loaded)::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      110deg,
      transparent 0%,
      rgba(255, 255, 255, 0.16) 35%,
      rgba(142, 230, 193, 0.22) 50%,
      rgba(255, 255, 255, 0.16) 65%,
      transparent 100%
    );
  transform: translateX(-120%);
  animation: phSoftFill 2.2s ease-in-out infinite;
}

.category-preview-tile.gallery-img-shell:not(.is-loaded)::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  box-shadow:
    inset 0 0 0 1px rgba(30, 136, 229, 0.12),
    0 6px 16px rgba(15, 63, 92, 0.08);
  background:
    linear-gradient(90deg, rgba(30,136,229,0), rgba(30,136,229,.95), rgba(142,230,193,1), rgba(30,136,229,0)) left top / 0% 2px no-repeat,
    linear-gradient(180deg, rgba(30,136,229,0), rgba(30,136,229,.95), rgba(142,230,193,1), rgba(30,136,229,0)) right top / 2px 0% no-repeat,
    linear-gradient(90deg, rgba(30,136,229,0), rgba(30,136,229,.95), rgba(142,230,193,1), rgba(30,136,229,0)) right bottom / 0% 2px no-repeat,
    linear-gradient(0deg, rgba(30,136,229,0), rgba(30,136,229,.95), rgba(142,230,193,1), rgba(30,136,229,0)) left bottom / 2px 0% no-repeat;
  animation: phBoxTrace 2.2s ease-in-out infinite;
}


/* ===========================
   SAFETY
   =========================== */

.gallery-placeholder-main,
.gallery-placeholder-thumbs,
.gallery-placeholder-thumbs span {
  pointer-events: none;
}

.gallery-main > img,
.gallery-main .g-btn {
  position: absolute;
}


/* ===========================
   KEYFRAMES
   =========================== */

@keyframes phSoftFill {
  0% {
    transform: translateX(-120%);
    opacity: 0;
  }

  20% {
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    transform: translateX(120%);
    opacity: 0;
  }
}

@keyframes phTop {
  0%, 8% {
    transform: scaleX(0);
    opacity: 0;
  }

  12%, 28% {
    transform: scaleX(1);
    opacity: 1;
  }

  70%, 100% {
    transform: scaleX(1);
    opacity: 0;
  }
}

@keyframes phRight {
  0%, 26% {
    transform: scaleY(0);
    opacity: 0;
  }

  32%, 46% {
    transform: scaleY(1);
    opacity: 1;
  }

  76%, 100% {
    transform: scaleY(1);
    opacity: 0;
  }
}

@keyframes phBottom {
  0%, 44% {
    transform: scaleX(0);
    opacity: 0;
  }

  50%, 64% {
    transform: scaleX(1);
    opacity: 1;
  }

  82%, 100% {
    transform: scaleX(1);
    opacity: 0;
  }
}

@keyframes phLeft {
  0%, 62% {
    transform: scaleY(0);
    opacity: 0;
  }

  68%, 82% {
    transform: scaleY(1);
    opacity: 1;
  }

  92%, 100% {
    transform: scaleY(1);
    opacity: 0;
  }
}

@keyframes phBoxTrace {
  0%, 8% {
    background-size:
      0% 2px,
      2px 0%,
      0% 2px,
      2px 0%;
    opacity: 0;
  }

  18% {
    background-size:
      100% 2px,
      2px 0%,
      0% 2px,
      2px 0%;
    opacity: 1;
  }

  38% {
    background-size:
      100% 2px,
      2px 100%,
      0% 2px,
      2px 0%;
    opacity: 1;
  }

  58% {
    background-size:
      100% 2px,
      2px 100%,
      100% 2px,
      2px 0%;
    opacity: 1;
  }

  78% {
    background-size:
      100% 2px,
      2px 100%,
      100% 2px,
      2px 100%;
    opacity: 1;
  }

  100% {
    background-size:
      100% 2px,
      2px 100%,
      100% 2px,
      2px 100%;
    opacity: 0;
  }
}


/* ===========================
   REDUCED MOTION
   =========================== */

@media (prefers-reduced-motion: reduce) {
  .gallery-placeholder-main::before,
  .gallery-placeholder-main .ph-border,
  .gallery-placeholder-thumbs span::before,
  .gallery-placeholder-thumbs .ph-border,
  .gallery-placeholder-curated span::before,
  .gallery-placeholder-curated .ph-border,
  .category-preview-tile.gallery-img-shell:not(.is-loaded)::before,
  .category-preview-tile.gallery-img-shell:not(.is-loaded)::after {
    animation: none !important;
  }
}