/* ── CHR Media Gallery ────────────────────────────────────────────────────── */
:is(body, header, main#content, footer) {

  .chr-gallery-wrap {
    width: 100%;
    font-family: inherit;
    color: var(--e-global-color-a83b1f1, white);
  }

  .chr-gallery-toolbar {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    gap: 1em;
    margin-block-end: 1em;
  }

  .chr-gallery-count {
    font-size: 0.82em;
    color: color-mix(in oklch, currentColor 60%, transparent);
    letter-spacing: 0.05em;
  }
  
  .chr-gallery-refresh i { transition: transform 0.4s ease; }
  .chr-gallery-refresh--spinning i { animation: chr-spin 0.7s linear infinite; }


  .chr-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.5em;
  }

  .chr-gallery-item {
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 0.25em;
    background: color-mix(in oklch, currentColor 10%, transparent);
  }

  .chr-gallery-btn {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
  }

  .chr-gallery-thumb {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  .chr-gallery-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
  }

  .chr-gallery-item:hover .chr-gallery-thumb img { transform: scale(1.04); }

  .chr-gallery-thumb--video .chr-gallery-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 2.5rem;
    transition: background 0.2s;
  }

  .chr-gallery-item:hover .chr-gallery-thumb--video .chr-gallery-play { background: rgba(0,0,0,0.5); }

  .chr-gallery-loading {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75em;
    padding: 3em 1em;
    font-size: 0.9em;
  }

  .chr-gallery-empty,
  .chr-gallery-error {
    padding: 2em 1em;
    text-align: center;
    font-size: 0.9em;
    opacity: 0.6;
  }

  .chr-gallery-error { color: #e74c3c; opacity: 1; }

  .hidden { display: none; }

  @media (prefers-reduced-motion: reduce) {
    .chr-gallery-refresh--spinning i { animation: none; }
    .chr-gallery-thumb img { transition: none; }
  }
  
  
/* ── CHR Lightbox ─────────────────────────────────────────────────────────── */

body.chr-lightbox-open { overflow: hidden; }

.chr-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
}

.chr-lightbox.hidden { display: none; }

.chr-lightbox :is(button, #idForSpecificity) {
    background-color: transparent;
    color: color-mix(in oklch, var( --e-global-color-a83b1f1, #fff ) 90%, transparent);
    border: none;
    padding: 0.25em;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25em;
    transition: color 0.4s;
    
    &:is(:hover, :focus-visible) {
        color: var( --e-global-color-a83b1f1, #fff );
    }
}

.chr-lb-overlay {
  position: absolute;
  inset: 0;
  background: var(--e-global-color-primary, #1a1a1a);
  opacity: 0.7;
}

/* Header */
.chr-lb-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625em 1em;
}

.chr-lb-counter {
  font-size: 0.85em;
  color: rgba(255,255,255,0.7);
  letter-spacing: 0.05em;
}

.chr-lb-controls {
  display: flex;
  align-items: center;
  gap: 0.325em;
}

.chr-lb-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
  padding: 0.5em;
  border-radius: 0.25em;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  line-height: 1;

}

.chr-lb-btn:hover,
.chr-lb-btn[aria-pressed="true"] {
  color: var(--e-global-color-accent, #d3aa56);
}


.chr-lb-close {
  color: rgba(255,255,255,0.9);
}

/* Stage */
.chr-lb-stage {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

/* Media */
.chr-lb-media {
  max-width: 90%;
  max-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chr-lb-image {
  max-width: 100%;
  max-height: calc(100vh - 80px);
  object-fit: contain;
  display: block;
  cursor: zoom-in;
  transition: transform 0.3s ease;
}

.chr-lb-media--zoomed .chr-lb-image {
  transform: scale(2);
  cursor: zoom-out;
}

.chr-lb-video {
  width: min(90vw, 1280px);
  height: min(70vh, 720px);
  border: none;
  display: block;
}

/* Arrows */
.chr-lb-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  background: rgba(0,0,0,0.45);
  border: none;
  color: rgba(255,255,255,0.85);
  font-size: 1.5rem;
  padding: 0.25em;
  width: 2.75em;
  height: 2.75em;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.chr-lb-arrow:hover {
  background: rgba(0,0,0,0.7);
  color: var(--e-global-color-accent, #d3aa56);
}

.chr-lb-arrow--prev { left: 1em; }
.chr-lb-arrow--next { right: 1em; }

/* Share menu */
.chr-lb-share-menu {
  position: absolute;
  top: 3.25em;
  right: 4.5em;
  z-index: 10;
  background: rgba(20,20,20,0.97);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 0.25em;
  padding: 0.4em 0;
  min-width: 130px;
}

.chr-lb-share-menu a {
  display: block;
  padding: 0.5em 1em;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 0.85em;
  transition: color 0.15s, background 0.15s;
}

.chr-lb-share-menu a:hover {
  color: var(--e-global-color-accent, #d3aa56);
  background: rgba(255,255,255,0.05);
}

/* Load more */
  .chr-gallery-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-block-start: 1.5em;
  }
    
    @media (max-width: 480px) {
      .chr-lb-arrow { width: 2.25em; height: 2.25em; font-size: 0.9rem; }
      .chr-lb-arrow--prev { left: 0.5em; }
      .chr-lb-arrow--next { right: 0.5em; }
      .chr-lb-media { max-width: 100%; }
      .chr-gallery-grid { grid-template-columns: repeat(2, 1fr); }

    }

}
