/* ==========================================================================
   AVECINA INTERNATIONAL SCHOOL — PHOTO GALLERY COMPONENT STYLES
   --------------------------------------------------------------------------
   Responsive activities photo grid, accessible lightbox dialog, category pills,
   live filtering, and Cloudinary upload & credential management modal.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HERO & SUBHEADER
   -------------------------------------------------------------------------- */
.gallery-hero {
  padding: 44px 0 28px;
  text-align: center;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}

.gallery-breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 14px;
}

.gallery-breadcrumbs a {
  color: var(--navy);
  font-weight: 500;
  text-decoration: none;
  transition: color 0.15s ease;
}

.gallery-breadcrumbs a:hover {
  color: var(--green);
  text-decoration: underline;
}

.gallery-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.8vw, 3rem);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
}

.gallery-standfirst {
  max-width: 720px;
  margin: 0 auto 20px;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Editorial Representative-Image Notice */
.gallery-editorial-notice {
  max-width: 760px;
  margin: 18px auto 0;
  padding: 12px 20px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper-raised);
  display: inline-flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--ink-soft);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.gallery-editorial-notice i {
  color: var(--navy);
  margin-top: 3px;
  flex-shrink: 0;
  font-size: 0.95rem;
}

.gallery-editorial-notice span {
  flex: 1 1 auto;
}

@media (max-width: 640px) {
  .gallery-editorial-notice {
    padding: 10px 14px;
    font-size: 0.82rem;
    gap: 10px;
  }
}

/* --------------------------------------------------------------------------
   2. FILTER & TOOLBAR SECTION
   -------------------------------------------------------------------------- */
.gallery-controls-section {
  padding: 24px 0 16px;
  background: var(--paper);
  position: sticky;
  top: var(--header-h, 78px);
  z-index: 100;
  border-bottom: 1px solid var(--rule);
  backdrop-filter: blur(8px);
}

.gallery-search-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.gallery-search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 320px;
  max-width: 520px;
}

.gallery-search-box i.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  font-size: 0.9rem;
  pointer-events: none;
}

.gallery-search-input {
  width: 100%;
  padding: 10px 38px 10px 38px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  color: var(--ink);
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-search-input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(22, 48, 95, 0.12);
}

.gallery-search-clear {
  position: absolute;
  right: 105px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-faint);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 6px;
  display: none;
}

.gallery-search-submit-btn {
  background: var(--navy);
  color: #ffffff;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  flex-shrink: 0;
  white-space: nowrap;
}

.gallery-search-submit-btn:hover {
  background: var(--green);
  transform: translateY(-1px);
}

.gallery-meta-count {
  font-size: 0.88rem;
  color: var(--ink-soft);
  font-weight: 500;
}

.gallery-meta-count strong {
  color: var(--ink);
  font-weight: 700;
}

/* Category Filter Pills Carousel (Hidden per user specification in favor of Photo Albums) */
.gallery-pills-carousel {
  position: relative;
  display: none !important;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.gallery-pills-nav-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.9rem;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease;
  z-index: 2;
}

.gallery-pills-nav-btn:hover:not(:disabled) {
  background: var(--navy);
  color: #ffffff;
  transform: scale(1.08);
}

.gallery-pills-nav-btn:disabled {
  opacity: 0.28;
  cursor: not-allowed;
  pointer-events: none;
}

.gallery-pills-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 6px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
}

.gallery-pills-wrapper::-webkit-scrollbar {
  display: none;
  height: 0;
  width: 0;
}

.gallery-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  background: var(--paper-raised);
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}

.gallery-pill:hover {
  background: var(--paper-sunk);
  color: var(--ink);
  border-color: var(--rule-strong);
}

.gallery-pill.active {
  background: var(--navy);
  color: var(--on-navy);
  border-color: var(--navy);
}

/* --------------------------------------------------------------------------
   2B. ALBUMS INTRO & OPENED ALBUM NAVIGATION
   -------------------------------------------------------------------------- */
.gallery-albums-intro {
  margin-bottom: 28px;
}

.gallery-albums-intro-content {
  border-bottom: 1.5px solid var(--rule);
  padding-bottom: 16px;
}

.gallery-albums-main-heading {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.gallery-albums-main-heading i {
  color: var(--navy);
  font-size: 1.3rem;
}

.gallery-albums-subheading {
  font-size: 0.95rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}

.gallery-album-header {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  background: var(--paper-raised);
  border: 1.5px solid var(--rule);
  border-radius: var(--radius);
  padding: 18px 24px;
  margin-top: 14px;
  box-shadow: 0 2px 8px rgba(17, 25, 29, 0.04);
}

.gallery-back-albums-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: #ffffff;
  color: var(--navy);
  border: 1.5px solid var(--rule);
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(17, 25, 29, 0.06);
  flex-shrink: 0;
}

.gallery-back-albums-btn:hover {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
  transform: translateX(-3px);
  box-shadow: 0 4px 12px rgba(17, 25, 29, 0.14);
}

.gallery-album-header-details {
  flex: 1 1 auto;
}

.gallery-album-crumb-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  margin-bottom: 6px;
}

.gallery-crumb-root {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.gallery-crumb-root:hover {
  color: var(--navy);
}

.gallery-crumb-sep {
  font-size: 0.68rem;
  color: var(--ink-muted);
}

.gallery-crumb-active {
  font-weight: 700;
  color: var(--navy);
}

.gallery-opened-album-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 6px;
  line-height: 1.25;
}

.gallery-opened-album-desc {
  font-size: 0.92rem;
  color: var(--ink-soft);
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .gallery-album-header {
    flex-direction: column;
    gap: 14px;
    padding: 16px;
  }
  .gallery-back-albums-btn {
    align-self: flex-start;
  }
  .gallery-opened-album-title {
    font-size: 1.3rem;
  }
}

/* --------------------------------------------------------------------------
   2C. PHOTO ALBUM CARDS (STACKED REALISTIC ALBUM DESIGN)
   -------------------------------------------------------------------------- */
.gallery-album-card {
  position: relative;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: visible;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.24s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
  box-shadow: 0 4px 14px rgba(17, 25, 29, 0.05), 0 1px 3px rgba(17, 25, 29, 0.04);
}

.gallery-album-card:hover,
.gallery-album-card:focus-visible {
  transform: translateY(-6px);
  border-color: var(--navy);
  box-shadow: 0 16px 32px -8px rgba(17, 25, 29, 0.16), 0 4px 12px rgba(17, 25, 29, 0.08);
  outline: none;
}

.gallery-album-cover-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 220px;
  overflow: hidden;
  background: var(--paper-sunk);
  border-radius: var(--radius) var(--radius) 0 0;
}

.gallery-album-stack-layer-2 {
  position: absolute;
  top: -6px;
  right: 6px;
  left: 6px;
  height: 100%;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0.6;
  transform: rotate(2deg);
  pointer-events: none;
  z-index: 1;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.gallery-album-stack-layer-1 {
  position: absolute;
  top: -3px;
  right: 3px;
  left: 3px;
  height: 100%;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0.85;
  transform: rotate(-1.2deg);
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.gallery-album-media {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  z-index: 3;
  background: #11191d;
}

.gallery-album-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.gallery-album-card:hover .gallery-album-media img {
  transform: scale(1.05);
}

.gallery-album-count-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(17, 25, 29, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  z-index: 4;
}

.gallery-album-count-badge i {
  color: #38bdf8;
  font-size: 0.8rem;
}

.gallery-album-content {
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  background: var(--paper-raised);
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 3;
}

.gallery-album-heading-row {
  margin-bottom: 4px;
}

.gallery-album-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
  line-height: 1.3;
  transition: color 0.18s ease;
}

.gallery-album-card:hover .gallery-album-name {
  color: var(--navy-strong, #0f172a);
}

.gallery-album-summary {
  display: none !important;
}

.gallery-album-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--rule);
  padding-top: 10px;
  margin-top: 10px;
}

.gallery-album-open-link {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s ease, color 0.2s ease;
}

.gallery-album-card:hover .gallery-album-open-link {
  gap: 12px;
}

/* --------------------------------------------------------------------------
   3. GALLERY GRID
   -------------------------------------------------------------------------- */
.gallery-main-section {
  padding: 36px 0 60px;
  min-height: 500px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 24px;
}

@media (max-width: 640px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

.gallery-card {
  position: relative;
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  cursor: pointer;
}

.gallery-card:hover,
.gallery-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--rule-strong);
  box-shadow: 0 12px 28px -6px rgba(20, 26, 36, 0.12);
  outline: none;
}

.gallery-card:focus-visible {
  box-shadow: 0 0 0 3px var(--navy);
}

.gallery-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  height: auto;
  max-height: 250px;
  overflow: hidden;
  background: var(--paper-raised, #f1f5f9);
  display: block;
}

.gallery-card-backdrop {
  display: none;
  position: absolute;
  inset: -20px;
  filter: blur(20px);
  pointer-events: none;
}

.gallery-card-media img {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  transition: transform 0.35s ease;
  display: block;
  box-shadow: none;
  border-radius: 0;
  pointer-events: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}

.gallery-card-shield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 3;
  background: rgba(0, 0, 0, 0.001);
  pointer-events: auto;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  touch-action: manipulation;
}

.gallery-card:hover .gallery-card-media img {
  transform: scale(1.04);
}

.gallery-card-category-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15, 35, 69, 0.88);
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
  z-index: 4;
  pointer-events: none;
}

.gallery-card-zoom-icon {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  opacity: 0;
  transform: scale(0.85);
  transition: all 0.2s ease;
  z-index: 4;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-card:hover .gallery-card-zoom-icon {
  opacity: 1;
  transform: scale(1);
}

.gallery-card-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
}

.gallery-card-title {
  font-family: var(--font-display);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-card-description {
  display: none !important;
}

.gallery-card-meta {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
  padding-top: 10px;
}

/* Empty / No Results State */
.gallery-empty-state {
  text-align: center;
  padding: 60px 20px;
  background: var(--paper-raised);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
  margin: 20px auto;
  max-width: 560px;
}

.gallery-empty-state i {
  font-size: 2.4rem;
  color: var(--ink-faint);
  margin-bottom: 16px;
}

.gallery-empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--ink);
  margin: 0 0 8px;
}

.gallery-empty-state p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0 0 20px;
}

/* --------------------------------------------------------------------------
   4. LIGHTBOX DIALOG (<dialog>)
   -------------------------------------------------------------------------- */
dialog.gallery-lightbox:not([open]) {
  display: none;
}

dialog.gallery-lightbox[open] {
  position: fixed;
  inset: 0;
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-width: 100dvw;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #bae6fd 0%, #dbeafe 35%, #ecfdf5 70%, #fef9c3 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  box-sizing: border-box;
  overflow: hidden;
}

/* Modern backdrop styling per modern-web-guidance */
dialog.gallery-lightbox::backdrop {
  background: linear-gradient(180deg, #93c5fd 0%, #bae6fd 40%, #e0f2fe 70%, #d1fae5 100%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* Child-friendly Playful Lightbox Backdrop */
.lightbox-playful-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

/* Ambient colorful radial glow orbs */
.lightbox-glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.35;
  pointer-events: none;
  animation: pulseOrb 8s ease-in-out infinite alternate;
}

.lightbox-glow-blue {
  width: 440px;
  height: 440px;
  background: radial-gradient(circle, #38bdf8, transparent 70%);
  top: -80px;
  left: -80px;
}

.lightbox-glow-green {
  width: 460px;
  height: 460px;
  background: radial-gradient(circle, #34d399, transparent 70%);
  bottom: -90px;
  right: -80px;
  animation-delay: -3s;
}

.lightbox-glow-red {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, #f87171, transparent 70%);
  top: 45%;
  right: 12%;
  opacity: 0.24;
  animation-delay: -5s;
}

@keyframes pulseOrb {
  0% { transform: scale(0.9) translate(0, 0); opacity: 0.22; }
  100% { transform: scale(1.15) translate(20px, -15px); opacity: 0.38; }
}

/* Grand Curved Rainbow Arch */
.lightbox-rainbow-arch {
  position: absolute;
  top: -30px;
  left: 3%;
  width: min(560px, 60vw);
  height: auto;
  pointer-events: none;
  z-index: 1;
  animation: floatRainbow 10s ease-in-out infinite alternate;
}

@keyframes floatRainbow {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-8px) rotate(-1deg); }
}

/* Magical Shooting Stars Arcing Across the Night Sky (Replaces Rainbow in Dark Mode) */
.lightbox-shooting-stars {
  display: none;
  position: absolute;
  top: -15px;
  left: 3%;
  width: min(560px, 60vw);
  height: auto;
  pointer-events: none;
  z-index: 1;
}

.shooting-star-group {
  transform-origin: 380px 50px;
}

.star-group-1 {
  animation: shootingStarGlide1 5s ease-in-out infinite;
}

.star-group-2 {
  animation: shootingStarGlide2 7s ease-in-out infinite 1.5s;
}

.star-group-3 {
  animation: shootingStarGlide3 4.5s ease-in-out infinite 0.8s;
}

@keyframes shootingStarGlide1 {
  0% { opacity: 0; transform: translate(-35px, 25px) scale(0.9); }
  25% { opacity: 1; }
  60% { opacity: 0.95; transform: translate(0, 0) scale(1); }
  85% { opacity: 0.2; transform: translate(20px, -15px) scale(1.03); }
  100% { opacity: 0; transform: translate(30px, -20px) scale(1.05); }
}

@keyframes shootingStarGlide2 {
  0% { opacity: 0; transform: translate(-30px, 20px) scale(0.85); }
  30% { opacity: 0.9; }
  65% { opacity: 0.85; transform: translate(0, 0) scale(1); }
  90% { opacity: 0.2; }
  100% { opacity: 0; transform: translate(25px, -12px) scale(1.02); }
}

@keyframes shootingStarGlide3 {
  0% { opacity: 0; transform: translate(-25px, 18px) scale(0.9); }
  25% { opacity: 0.95; }
  70% { opacity: 0.9; transform: translate(0, 0) scale(1); }
  95% { opacity: 0.15; }
  100% { opacity: 0; transform: translate(20px, -12px) scale(1.02); }
}

/* Smiling Cartoon Sun */
.lightbox-cartoon-sun {
  position: absolute;
  top: 25px;
  right: 4%;
  width: 110px;
  height: 110px;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 8px 18px rgba(245, 158, 11, 0.4));
  animation: floatSun 8s ease-in-out infinite alternate;
}

.sun-beams {
  transform-origin: 70px 70px;
  animation: spinBeams 24s linear infinite;
}

@keyframes spinBeams {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes floatSun {
  0% { transform: scale(1) translateY(0); }
  100% { transform: scale(1.05) translateY(-6px); }
}

/* Smiling Cartoon Moon with Night Glow (Dark Mode) */
.lightbox-cartoon-moon {
  display: none;
  position: absolute;
  top: 25px;
  right: 4%;
  width: 120px;
  height: 120px;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 0 25px rgba(253, 224, 71, 0.5));
  animation: floatMoon 8s ease-in-out infinite alternate;
}

@keyframes floatMoon {
  0% { transform: scale(1) translateY(0) rotate(-2deg); }
  100% { transform: scale(1.05) translateY(-6px) rotate(3deg); }
}

/* Twinkling Starry Night Layer (Dark Mode) */
.lightbox-night-stars {
  display: none;
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.night-star {
  position: absolute;
  width: 18px;
  height: 18px;
  animation: twinkleStar 3s ease-in-out infinite alternate;
}

.star-twinkle-1 { animation-delay: 0s; }
.star-twinkle-2 { animation-delay: -1s; }
.star-twinkle-3 { animation-delay: -2s; }

@keyframes twinkleStar {
  0% { opacity: 0.25; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1.15) rotate(15deg); }
  100% { opacity: 0.35; transform: scale(0.85); }
}

/* Fluffy Cartoon Clouds Floating Across the Sky */
.lightbox-cartoon-cloud {
  position: absolute;
  pointer-events: none;
  z-index: 1;
  opacity: 0.95;
}

.lightbox-cartoon-cloud.cloud-1 {
  top: 45px;
  left: 2%;
  width: 140px;
  animation: driftCloud1 24s ease-in-out infinite alternate;
}

.lightbox-cartoon-cloud.cloud-2 {
  top: 85px;
  right: 15%;
  width: 160px;
  animation: driftCloud2 28s ease-in-out infinite alternate;
}

.lightbox-cartoon-cloud.cloud-3 {
  top: 45%;
  left: 1%;
  width: 120px;
  animation: driftCloud1 20s ease-in-out infinite alternate;
}

@keyframes driftCloud1 {
  0% { transform: translateX(0); }
  100% { transform: translateX(25px); }
}

@keyframes driftCloud2 {
  0% { transform: translateX(0); }
  100% { transform: translateX(-25px); }
}

/* Floating Colorful Balloons Group */
.lightbox-balloons-group {
  position: absolute;
  top: 20%;
  right: 3%;
  width: 110px;
  height: 170px;
  pointer-events: none;
  z-index: 1;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.12));
  animation: swayBalloons 5s ease-in-out infinite alternate;
  transform-origin: bottom center;
}

@keyframes swayBalloons {
  0% { transform: translateY(0) rotate(-3deg); }
  100% { transform: translateY(-16px) rotate(4deg); }
}

/* Paper Airplane Gliding */
.lightbox-paper-plane {
  position: absolute;
  top: 14%;
  left: 32%;
  width: 150px;
  height: 110px;
  pointer-events: none;
  z-index: 1;
  animation: glidePlane 12s ease-in-out infinite alternate;
}

@keyframes glidePlane {
  0% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(20px, -10px) rotate(3deg); }
  100% { transform: translate(40px, -18px) rotate(-2deg); }
}

/* Playful Kids' Doodles Layer */
.lightbox-doodles-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.doodle-item {
  position: absolute;
  width: 32px;
  height: 32px;
  pointer-events: none;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,0.1));
  animation: pulseDoodle 4s ease-in-out infinite alternate;
}

@keyframes pulseDoodle {
  0% { transform: scale(0.9) rotate(0deg); opacity: 0.75; }
  100% { transform: scale(1.1) rotate(12deg); opacity: 1; }
}

/* Rolling Green & Cyan Landscape Hills along Bottom */
.lightbox-landscape-hills {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 110px;
  pointer-events: none;
  z-index: 1;
}

/* Floating educational sticker badges styled like cheerful scrapbook patches - retired per user request to eliminate distraction */
.floating-sticker-badge {
  display: none !important;
  position: absolute;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9999px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  user-select: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14), 0 2px 6px rgba(0, 0, 0, 0.06);
  animation: floatSticker 6s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 2;
}

.floating-sticker-badge .sticker-emoji {
  font-size: 1.18rem;
  line-height: 1;
}

/* Avecina Royal Blue theme */
.sticker-blue {
  border: 2px dashed #2563eb;
  color: #1e3a8a;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.22);
}

/* Avecina Red theme */
.sticker-red {
  border: 2px dashed #ef4444;
  color: #991b1b;
  box-shadow: 0 6px 18px rgba(239, 68, 68, 0.2);
}

/* Avecina Green theme */
.sticker-green {
  border: 2px dashed #10b981;
  color: #065f46;
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.2);
}

@keyframes floatSticker {
  0% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(2deg); }
  100% { transform: translateY(-20px) rotate(-2deg); }
}

.lightbox-container {
  position: relative;
  z-index: 5;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  box-sizing: border-box;
}

/* Lightbox Topbar */
.lightbox-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  color: #ffffff;
  z-index: 10;
  padding: 4px 10px;
}

.lightbox-counter {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #0f172a;
  background: rgba(255, 255, 255, 0.92);
  padding: 6px 14px;
  border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.lightbox-top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  color: #0f172a;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.lightbox-btn:hover {
  background: #ffffff;
  transform: scale(1.06);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.lightbox-btn.close-btn {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
}

.lightbox-btn.close-btn:hover {
  background: #dc2626;
  color: #ffffff;
}

.lightbox-btn.download-btn {
  width: auto;
  padding: 0 18px;
  border-radius: 999px;
  gap: 8px;
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
}

.lightbox-btn.download-btn:hover {
  background: #0d8a57;
  border-color: #0d8a57;
  transform: scale(1.04);
}

@media (max-width: 640px) {
  .lightbox-btn.download-btn span.download-btn-text {
    display: none;
  }
  .lightbox-btn.download-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
  }
}

/* Slideshow Button */
.lightbox-btn.slideshow-btn {
  width: auto;
  padding: 0 16px;
  border-radius: 999px;
  gap: 8px;
  font-weight: 700;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.94);
  color: var(--navy);
  border: 1px solid rgba(255, 255, 255, 0.9);
}

.lightbox-btn.slideshow-btn.playing {
  background: #3b82f6 !important;
  border-color: #3b82f6 !important;
  color: #ffffff !important;
  box-shadow: 0 0 16px rgba(59, 130, 246, 0.5) !important;
  animation: pulsePlayBtn 2s ease-in-out infinite;
}

@keyframes pulsePlayBtn {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@media (max-width: 640px) {
  .lightbox-btn.slideshow-btn span.slideshow-btn-text {
    display: none;
  }
  .lightbox-btn.slideshow-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
  }
}

/* Slideshow Progress Bar */
.lightbox-slideshow-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, #3b82f6, #10b981, #f59e0b);
  z-index: 200;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.6);
  pointer-events: none;
}

/* Lightbox Main Stage */
.lightbox-stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 10px;
}

.lightbox-image-wrap {
  position: relative;
  max-width: 90vw;
  max-height: calc(85vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-touch-callout: none !important;
}

.lightbox-image {
  max-width: 90vw;
  max-height: calc(85vh - 120px);
  object-fit: contain;
  border-radius: 12px;
  border: 4px solid #ffffff;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35), 0 4px 16px rgba(0, 0, 0, 0.15);
  user-select: none;
  pointer-events: none !important;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  -webkit-user-drag: none !important;
  position: relative;
  z-index: 5;
}

.lightbox-touch-shield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.001);
  z-index: 10;
  pointer-events: auto;
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
  touch-action: manipulation;
}

/* Nav Chevrons */
.lightbox-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.94);
  border: 2px solid #ffffff;
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.2);
}

.lightbox-nav-btn:hover {
  background: #ffffff;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.3);
}

.lightbox-nav-btn.prev {
  left: 20px;
}

.lightbox-nav-btn.next {
  right: 20px;
}

@media (max-width: 768px) {
  .lightbox-nav-btn {
    width: 40px;
    height: 40px;
    font-size: 1rem;
  }
  .lightbox-nav-btn.prev { left: 8px; }
  .lightbox-nav-btn.next { right: 8px; }
}

@media (max-width: 640px) {
  .gallery-search-input {
    font-size: 16px !important;
    min-height: 44px;
  }
  .lightbox-image-wrap,
  .lightbox-image {
    max-width: 95vw !important;
    max-height: calc(82dvh - 100px) !important;
    border-width: 3px !important;
    border-radius: 8px !important;
  }
  .lightbox-nav-btn {
    width: 36px;
    height: 36px;
    font-size: 0.92rem;
  }
  .lightbox-nav-btn.prev { left: 4px; }
  .lightbox-nav-btn.next { right: 4px; }
  .lightbox-topbar {
    padding: 10px 12px;
  }
  .lightbox-counter {
    font-size: 0.8rem;
    padding: 4px 10px;
  }
}

/* Lightbox Title Footer (Clean stand-alone title without holding modal box or extra wording) */
.lightbox-details {
  max-width: 860px;
  margin: 6px auto 0;
  text-align: center;
  color: var(--navy);
  padding: 4px 16px 8px;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  position: relative;
  z-index: 10;
}

.lightbox-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0;
  color: var(--navy);
  letter-spacing: -0.01em;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 2px 8px rgba(255, 255, 255, 0.9);
}

/* Reduced wording: captions and tag pills are removed/hidden per design direction */
.lightbox-caption,
.lightbox-tags,
.lightbox-tag {
  display: none !important;
}

/* Lightbox Auth-Gated Download Modal */
.lightbox-auth-modal {
  position: absolute;
  inset: 0;
  background: rgba(14, 20, 30, 0.88);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  box-sizing: border-box;
}

.lightbox-auth-card {
  background: var(--paper-raised);
  color: var(--ink);
  border-radius: var(--radius-lg, 12px);
  padding: 32px 28px;
  max-width: 460px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--rule);
  animation: lightboxAuthFadeIn 0.22s ease-out;
}

@keyframes lightboxAuthFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.lightbox-auth-icon {
  font-size: 2.5rem;
  color: var(--navy);
  margin-bottom: 16px;
}

.lightbox-auth-card h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 10px;
  color: var(--ink);
}

.lightbox-auth-card p {
  font-size: 0.92rem;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 22px;
}

.lightbox-auth-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.gallery-pill-count {
  font-size: 0.75rem;
  opacity: 0.8;
  margin-left: 3px;
}

/* --------------------------------------------------------------------------
   4C. LIGHTBOX NIGHT SKY & DARK MODE (Child-Friendly Kids Theme)
   -------------------------------------------------------------------------- */

@media (prefers-color-scheme: dark) {
  dialog.gallery-lightbox:not(.force-light) {
    background: linear-gradient(180deg, #030712 0%, #0c1527 35%, #172554 70%, #064e3b 100%) !important;
  }
  dialog.gallery-lightbox:not(.force-light)::backdrop {
    background: linear-gradient(180deg, #020617 0%, #0a0f1d 40%, #0f172a 70%, #042f2e 100%) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-cartoon-sun {
    display: none !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-cartoon-moon {
    display: block !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-shooting-stars {
    display: block !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-night-stars {
    display: block !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-rainbow-arch {
    display: none !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-cartoon-cloud svg path {
    fill: #1e293b !important;
    opacity: 0.8 !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-landscape-hills path:nth-child(1) {
    fill: #064e3b !important;
    opacity: 0.85 !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-landscape-hills path:nth-child(2) {
    fill: #043828 !important;
    opacity: 0.9 !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-landscape-hills path:nth-child(3) {
    fill: #022c1f !important;
    opacity: 0.95 !important;
  }
  dialog.gallery-lightbox:not(.force-light) .floating-sticker-badge {
    background: rgba(15, 23, 42, 0.88) !important;
    color: #f8fafc !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .floating-sticker-badge.sticker-blue {
    border-color: #3b82f6 !important;
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .floating-sticker-badge.sticker-red {
    border-color: #ef4444 !important;
    box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .floating-sticker-badge.sticker-green {
    border-color: #10b981 !important;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-counter {
    background: rgba(15, 23, 42, 0.88) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-btn:not(.close-btn):not(.download-btn):not(.playing) {
    background: rgba(15, 23, 42, 0.88) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-nav-btn {
    background: rgba(15, 23, 42, 0.9) !important;
    color: #f8fafc !important;
    border-color: rgba(255, 255, 255, 0.2) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-title {
    color: #f8fafc !important;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 20px rgba(56, 189, 248, 0.5) !important;
  }
  dialog.gallery-lightbox:not(.force-light) .lightbox-image {
    border-color: #334155 !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(59, 130, 246, 0.2) !important;
  }
}

/* Explicit class-based dark mode (body.dark-theme, :root.dark-theme, or dialog.gallery-lightbox.dark-mode) */
body.dark-theme dialog.gallery-lightbox,
:root.dark-theme dialog.gallery-lightbox,
.site-page.dark-theme dialog.gallery-lightbox,
dialog.gallery-lightbox.dark-mode {
  background: linear-gradient(180deg, #030712 0%, #0c1527 35%, #172554 70%, #064e3b 100%) !important;
}

body.dark-theme dialog.gallery-lightbox::backdrop,
:root.dark-theme dialog.gallery-lightbox::backdrop,
.site-page.dark-theme dialog.gallery-lightbox::backdrop,
dialog.gallery-lightbox.dark-mode::backdrop {
  background: linear-gradient(180deg, #020617 0%, #0a0f1d 40%, #0f172a 70%, #042f2e 100%) !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-cartoon-sun,
:root.dark-theme dialog.gallery-lightbox .lightbox-cartoon-sun,
.site-page.dark-theme dialog.gallery-lightbox .lightbox-cartoon-sun,
dialog.gallery-lightbox.dark-mode .lightbox-cartoon-sun {
  display: none !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-cartoon-moon,
:root.dark-theme dialog.gallery-lightbox .lightbox-cartoon-moon,
.site-page.dark-theme dialog.gallery-lightbox .lightbox-cartoon-moon,
dialog.gallery-lightbox.dark-mode .lightbox-cartoon-moon {
  display: block !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-shooting-stars,
:root.dark-theme dialog.gallery-lightbox .lightbox-shooting-stars,
.site-page.dark-theme dialog.gallery-lightbox .lightbox-shooting-stars,
dialog.gallery-lightbox.dark-mode .lightbox-shooting-stars {
  display: block !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-night-stars,
:root.dark-theme dialog.gallery-lightbox .lightbox-night-stars,
.site-page.dark-theme dialog.gallery-lightbox .lightbox-night-stars,
dialog.gallery-lightbox.dark-mode .lightbox-night-stars {
  display: block !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-glow-blue,
dialog.gallery-lightbox.dark-mode .lightbox-glow-blue {
  background: radial-gradient(circle, #1d4ed8, transparent 70%) !important;
  opacity: 0.25 !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-glow-green,
dialog.gallery-lightbox.dark-mode .lightbox-glow-green {
  background: radial-gradient(circle, #059669, transparent 70%) !important;
  opacity: 0.25 !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-glow-red,
dialog.gallery-lightbox.dark-mode .lightbox-glow-red {
  background: radial-gradient(circle, #991b1b, transparent 70%) !important;
  opacity: 0.18 !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-rainbow-arch,
:root.dark-theme dialog.gallery-lightbox .lightbox-rainbow-arch,
.site-page.dark-theme dialog.gallery-lightbox .lightbox-rainbow-arch,
dialog.gallery-lightbox.dark-mode .lightbox-rainbow-arch {
  display: none !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-cartoon-cloud svg path,
dialog.gallery-lightbox.dark-mode .lightbox-cartoon-cloud svg path {
  fill: #1e293b !important;
  opacity: 0.8 !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(1),
dialog.gallery-lightbox.dark-mode .lightbox-landscape-hills path:nth-child(1) {
  fill: #064e3b !important;
  opacity: 0.85 !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(2),
dialog.gallery-lightbox.dark-mode .lightbox-landscape-hills path:nth-child(2) {
  fill: #043828 !important;
  opacity: 0.9 !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(3),
dialog.gallery-lightbox.dark-mode .lightbox-landscape-hills path:nth-child(3) {
  fill: #022c1f !important;
  opacity: 0.95 !important;
}

body.dark-theme dialog.gallery-lightbox .floating-sticker-badge,
dialog.gallery-lightbox.dark-mode .floating-sticker-badge {
  background: rgba(15, 23, 42, 0.88) !important;
  color: #f8fafc !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5) !important;
}

body.dark-theme dialog.gallery-lightbox .floating-sticker-badge.sticker-blue,
dialog.gallery-lightbox.dark-mode .floating-sticker-badge.sticker-blue {
  border-color: #3b82f6 !important;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.35) !important;
}

body.dark-theme dialog.gallery-lightbox .floating-sticker-badge.sticker-red,
dialog.gallery-lightbox.dark-mode .floating-sticker-badge.sticker-red {
  border-color: #ef4444 !important;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.35) !important;
}

body.dark-theme dialog.gallery-lightbox .floating-sticker-badge.sticker-green,
dialog.gallery-lightbox.dark-mode .floating-sticker-badge.sticker-green {
  border-color: #10b981 !important;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35) !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-counter,
dialog.gallery-lightbox.dark-mode .lightbox-counter {
  background: rgba(15, 23, 42, 0.88) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-btn:not(.close-btn):not(.download-btn):not(.playing),
dialog.gallery-lightbox.dark-mode .lightbox-btn:not(.close-btn):not(.download-btn):not(.playing) {
  background: rgba(15, 23, 42, 0.88) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-nav-btn,
dialog.gallery-lightbox.dark-mode .lightbox-nav-btn {
  background: rgba(15, 23, 42, 0.9) !important;
  color: #f8fafc !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-title,
dialog.gallery-lightbox.dark-mode .lightbox-title {
  color: #f8fafc !important;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.9), 0 0 20px rgba(56, 189, 248, 0.5) !important;
}

body.dark-theme dialog.gallery-lightbox .lightbox-image,
dialog.gallery-lightbox.dark-mode .lightbox-image {
  border-color: #334155 !important;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 30px rgba(59, 130, 246, 0.2) !important;
}

/* --------------------------------------------------------------------------
   4D. LIGHTBOX DAYLIGHT SKY & LIGHT THEME (Strictly follows Drawer Light Mode)
   -------------------------------------------------------------------------- */
:root:not(.dark-theme) dialog.gallery-lightbox,
body:not(.dark-theme) dialog.gallery-lightbox,
:root.light-theme dialog.gallery-lightbox,
body.light-theme dialog.gallery-lightbox,
dialog.gallery-lightbox.force-light {
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 30%, #f0fdf4 75%, #dcfce7 100%) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox::backdrop,
body:not(.dark-theme) dialog.gallery-lightbox::backdrop,
:root.light-theme dialog.gallery-lightbox::backdrop,
body.light-theme dialog.gallery-lightbox::backdrop,
dialog.gallery-lightbox.force-light::backdrop {
  background: linear-gradient(180deg, rgba(224, 242, 254, 0.96) 0%, rgba(186, 230, 253, 0.94) 40%, rgba(220, 252, 231, 0.96) 100%) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-cartoon-sun,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-cartoon-sun,
:root.light-theme dialog.gallery-lightbox .lightbox-cartoon-sun,
body.light-theme dialog.gallery-lightbox .lightbox-cartoon-sun,
dialog.gallery-lightbox.force-light .lightbox-cartoon-sun {
  display: block !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-rainbow-arch,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-rainbow-arch,
:root.light-theme dialog.gallery-lightbox .lightbox-rainbow-arch,
body.light-theme dialog.gallery-lightbox .lightbox-rainbow-arch,
dialog.gallery-lightbox.force-light .lightbox-rainbow-arch {
  display: block !important;
  opacity: 0.92 !important;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.12)) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-cartoon-moon,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-cartoon-moon,
:root.light-theme dialog.gallery-lightbox .lightbox-cartoon-moon,
body.light-theme dialog.gallery-lightbox .lightbox-cartoon-moon,
dialog.gallery-lightbox.force-light .lightbox-cartoon-moon {
  display: none !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-shooting-stars,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-shooting-stars,
:root.light-theme dialog.gallery-lightbox .lightbox-shooting-stars,
body.light-theme dialog.gallery-lightbox .lightbox-shooting-stars,
dialog.gallery-lightbox.force-light .lightbox-shooting-stars {
  display: none !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-night-stars,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-night-stars,
:root.light-theme dialog.gallery-lightbox .lightbox-night-stars,
body.light-theme dialog.gallery-lightbox .lightbox-night-stars,
dialog.gallery-lightbox.force-light .lightbox-night-stars {
  display: none !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-cartoon-cloud svg path,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-cartoon-cloud svg path,
:root.light-theme dialog.gallery-lightbox .lightbox-cartoon-cloud svg path,
body.light-theme dialog.gallery-lightbox .lightbox-cartoon-cloud svg path,
dialog.gallery-lightbox.force-light .lightbox-cartoon-cloud svg path {
  fill: #ffffff !important;
  opacity: 0.94 !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(1),
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(1),
dialog.gallery-lightbox.force-light .lightbox-landscape-hills path:nth-child(1) {
  fill: #a7f3d0 !important;
  opacity: 0.75 !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(2),
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(2),
dialog.gallery-lightbox.force-light .lightbox-landscape-hills path:nth-child(2) {
  fill: #6ee7b7 !important;
  opacity: 0.85 !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(3),
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-landscape-hills path:nth-child(3),
dialog.gallery-lightbox.force-light .lightbox-landscape-hills path:nth-child(3) {
  fill: #10b981 !important;
  opacity: 0.9 !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .floating-sticker-badge,
body:not(.dark-theme) dialog.gallery-lightbox .floating-sticker-badge,
dialog.gallery-lightbox.force-light .floating-sticker-badge {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #1e293b !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-counter,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-counter,
dialog.gallery-lightbox.force-light .lightbox-counter {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-btn:not(.close-btn):not(.download-btn):not(.playing),
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-btn:not(.close-btn):not(.download-btn):not(.playing),
dialog.gallery-lightbox.force-light .lightbox-btn:not(.close-btn):not(.download-btn):not(.playing) {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-nav-btn,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-nav-btn,
dialog.gallery-lightbox.force-light .lightbox-nav-btn {
  background: rgba(255, 255, 255, 0.92) !important;
  color: #1e293b !important;
  border-color: rgba(0, 0, 0, 0.08) !important;
}

:root:not(.dark-theme) dialog.gallery-lightbox .lightbox-title,
body:not(.dark-theme) dialog.gallery-lightbox .lightbox-title,
dialog.gallery-lightbox.force-light .lightbox-title {
  color: #0f172a !important;
  text-shadow: 0 1px 3px rgba(255, 255, 255, 0.8) !important;
}

/* --------------------------------------------------------------------------
   5. CLOUDINARY MODALS (Setup & Direct Upload)
   -------------------------------------------------------------------------- */
dialog.gallery-modal {
  margin: auto;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  background: var(--paper-raised);
  color: var(--ink);
  width: 90vw;
  max-width: 580px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

dialog.gallery-modal::backdrop {
  background: rgba(14, 20, 30, 0.7);
  backdrop-filter: blur(4px);
}

.gallery-modal-content {
  padding: 28px 32px;
}

.gallery-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 16px;
}

.gallery-modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px;
}

.gallery-modal-header p {
  color: var(--ink-soft);
  font-size: 0.86rem;
  margin: 0;
}

.gallery-modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 4px;
  transition: color 0.15s ease;
}

.gallery-modal-close:hover {
  color: var(--ink);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-sizing: border-box;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--navy);
  outline: none;
  box-shadow: 0 0 0 3px rgba(22, 48, 95, 0.1);
}

.form-group .form-help {
  font-size: 0.78rem;
  color: var(--ink-faint);
  margin-top: 5px;
}

/* Upload Dropzone */
.upload-dropzone {
  border: 2px dashed var(--rule-strong);
  border-radius: var(--radius);
  padding: 30px 20px;
  text-align: center;
  background: var(--paper);
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
  border-color: var(--navy);
  background: var(--paper-sunk);
}

.upload-dropzone i {
  font-size: 2.2rem;
  color: var(--navy);
  margin-bottom: 10px;
}

.upload-dropzone p {
  margin: 0 0 4px;
  font-weight: 600;
  font-size: 0.95rem;
}

.upload-dropzone span {
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.upload-progress-container {
  display: none;
  margin-top: 14px;
}

.upload-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--rule);
  border-radius: 4px;
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--green);
  transition: width 0.2s ease;
}

.gallery-modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

/* --------------------------------------------------------------------------
   8. IMAGE PROTECTION & SAFEGUARDING
   -------------------------------------------------------------------------- */
img,
.gallery-card,
.gallery-card-media,
.gallery-card-media img,
.gallery-card-shield,
.lightbox-image-wrap,
.lightbox-image,
.lightbox-touch-shield,
dialog.gallery-lightbox {
  -webkit-touch-callout: none !important;
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-user-drag: none !important;
}

.gallery-card-media img,
.lightbox-image {
  pointer-events: none !important;
}

/* --------------------------------------------------------------------------
   9. AUTH NOTIFICATION BANNERS
   -------------------------------------------------------------------------- */
.gallery-auth-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  margin: 16px auto 0;
  max-width: 1200px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  animation: fadeInSlide 0.3s ease-out;
}

.gallery-auth-banner.authorized {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.gallery-auth-banner.unauthorized {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.gallery-auth-banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gallery-auth-banner-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.7;
  line-height: 1;
  padding: 0 4px;
}

.gallery-auth-banner-close:hover {
  opacity: 1;
}

@keyframes fadeInSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* --------------------------------------------------------------------------
   10. ACCESSIBILITY: REDUCED MOTION PREFERENCES
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .lightbox-rainbow-arch,
  .lightbox-shooting-stars,
  .shooting-star-group,
  .lightbox-cartoon-sun,
  .sun-beams,
  .lightbox-cartoon-moon,
  .night-star,
  .lightbox-cartoon-cloud,
  .lightbox-balloons-group,
  .lightbox-paper-plane,
  .doodle-item,
  .floating-sticker-badge,
  .lightbox-glow-orb {
    animation: none !important;
  }

  .gallery-pill,
  .lightbox-btn,
  .gallery-card {
    transition: none !important;
  }
}
