:root{
  --galux-bg:#fbefe9;
  --galux-card:#ffffff;
  --galux-border:#eadfd8;
  --galux-text:#2b2b2b;
  --galux-muted:#6b6b6b;
  --galux-radius:18px;
}

/* =========================
   CONTAINER + HEADER
   ========================= */

.galux-front{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--galux-bg);
  padding: 18px;
  border-radius: 22px;

  /* FIX: non full screen (riduce stretching thumbs) */
  width: min(920px, 94vw);
  margin: 0 auto;
}

.galux-header{ margin-bottom: 14px; }

.galux-title{
  margin:0;
  font-size: 28px;
  letter-spacing:-.01em;
  color:var(--galux-text);
}

.galux-subtitle{
  margin: 6px 0 0;
  color: var(--galux-muted);
}

/* toolbar filtri */

.galux-toolbar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin: 14px 0 18px;
}

.galux-pill{
  border:1px solid var(--galux-border);
  background:#fff;
  padding: 8px 12px;
  border-radius: 999px;
  cursor:pointer;
  color: var(--galux-text);
  font-weight:600;
}

.galux-pill.is-active{ background: rgba(255,255,255,.65); }


/* =========================
   GRID: SEMPRE 1 COLONNA
   ========================= */

.galux-grid{
  display:grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

.galux-item{
  background: var(--galux-card);
  border: 1px solid var(--galux-border);
  border-radius: var(--galux-radius);
  overflow:hidden;
  cursor:pointer;
  box-shadow: 0 10px 25px rgba(0,0,0,.04);
  position:relative;
}

/* immagine grande e responsive */

.galux-thumb{
  /* FIX: meno stretching => meno sgranatura */
  height: clamp(220px, 38vw, 460px);

  background:#f6f0ec;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}

.galux-thumb img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
  user-select:none;
  -webkit-user-drag:none;
  transition: transform .25s ease;

  /* micro-fix resa */
  transform: translateZ(0);
  backface-visibility: hidden;
}

.galux-item:hover img{
  transform: scale(1.04) translateZ(0);
}

/* NASCONDE NOMI FILE SOTTO LE FOTO */
.galux-caption{ display:none !important; }

/* icona play video (se serve) */
.galux-play-icon{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  pointer-events:none;
}

.galux-play-icon span{
  width:54px; height:54px;
  border-radius:999px;
  background: rgba(0,0,0,.65);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-size:18px;
}


/* =========================
   LIGHTBOX (ZOOM)
   - via nome file
   - via play/pause
   - frecce overlay sulla foto
   - X elegante dentro la foto
   ========================= */

.galux-lightbox{ position:fixed; inset:0; display:none; z-index: 99999; }
.galux-lightbox.is-open{ display:block; }

.galux-lb-backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }

.galux-lb-panel{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: min(1100px, 94vw);
  max-height: 86vh;
  background: rgba(255,255,255,.96);
  border:1px solid rgba(255,255,255,.35);
  border-radius: 18px;
  overflow:hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}

/* TOPBAR: la rendiamo “trasparente” e la usiamo solo come holder dei bottoni */
.galux-lb-top{
  position: relative;
  background: transparent !important;
  border-bottom: 0 !important;
  padding: 0 !important;
  height: 0 !important;
  min-height: 0 !important;
}

/* via il nome file in zoom */
.galux-lb-name{ display:none !important; }

/* area media */
.galux-lb-body{
  padding: 12px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: #111;
  position: relative;
}

/* immagine/video in lightbox */
.galux-lb-body img,
.galux-lb-body video{
  max-width: 100%;
  max-height: 74vh;
  border-radius: 14px;
  background:#000;
}

/* contenitore bottoni */
.galux-lb-actions{
  position: absolute;
  inset: 0;
  pointer-events: none; /* cosi' non blocca il tap sull'immagine */
}

/* stile base bottoni overlay (frecce + X) */
.galux-btn{
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.28) !important;
  background: rgba(0,0,0,.30) !important;
  color: #fff !important;
  border-radius: 999px !important;
  padding: 10px 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 10px 25px rgba(0,0,0,.25);
  opacity: .28;
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
}

/* on hover: diventano nitidi */
.galux-btn:hover{
  opacity: .95;
  transform: scale(1.04);
  background: rgba(0,0,0,.45) !important;
}

/* -------------------------------------------------
   NASCONDI PLAY/PAUSE (2 strategie: data-action + fallback)
   ------------------------------------------------- */

/* Se il plugin usa data-action */
.galux-btn[data-action="play"],
.galux-btn[data-action="pause"],
.galux-btn[data-action="autoplay"],
.galux-btn[data-action="toggle-play"]{
  display:none !important;
}

/* Fallback: se l’ordine e' [prev][next][play][pause][chiudi]
   nascondiamo il 3° e 4° bottone dentro azioni */
.galux-lb-actions .galux-btn:nth-child(3),
.galux-lb-actions .galux-btn:nth-child(4){
  display:none !important;
}

/* -------------------------------------------------
   POSIZIONAMENTO FRECCE (overlay sulla foto)
   ------------------------------------------------- */

/* Se esistono prev/next come data-action */
.galux-btn[data-action="prev"],
.galux-btn[data-action="previous"]{
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.galux-btn[data-action="next"]{
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

/* Fallback: 1° = prev, 2° = next */
.galux-lb-actions .galux-btn:nth-child(1){
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}

.galux-lb-actions .galux-btn:nth-child(2){
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}

/* -------------------------------------------------
   CHIUDI = X in alto a destra dentro la foto
   ------------------------------------------------- */

/* Se esiste close come data-action */
.galux-btn[data-action="close"],
.galux-btn[data-action="chiudi"]{
  position: absolute;
  right: 18px;
  top: 18px;
  width: 44px;
  height: 44px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0; /* nasconde il testo “Chiudi” */
}

/* Fallback: ultimo bottone = chiudi */
.galux-lb-actions .galux-btn:last-child{
  position: absolute;
  right: 18px;
  top: 18px;
  width: 44px;
  height: 44px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0; /* nasconde il testo “Chiudi” */
}

/* Disegniamo la X via pseudo-elementi */
.galux-btn[data-action="close"]::before,
.galux-btn[data-action="close"]::after,
.galux-lb-actions .galux-btn:last-child::before,
.galux-lb-actions .galux-btn:last-child::after{
  content:"";
  position:absolute;
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,.92);
  border-radius: 2px;
}

.galux-btn[data-action="close"]::before,
.galux-lb-actions .galux-btn:last-child::before{
  transform: rotate(45deg);
}

.galux-btn[data-action="close"]::after,
.galux-lb-actions .galux-btn:last-child::after{
  transform: rotate(-45deg);
}

/* Mobile: bottoni un po’ piu’ comodi */
@media (max-width: 600px){
  .galux-btn{
    opacity: .40;
  }
  .galux-btn:hover{
    opacity: .98;
  }
  .galux-btn[data-action="prev"],
  .galux-lb-actions .galux-btn:nth-child(1){
    left: 12px;
  }
  .galux-btn[data-action="next"],
  .galux-lb-actions .galux-btn:nth-child(2){
    right: 12px;
  }
  .galux-btn[data-action="close"],
  .galux-lb-actions .galux-btn:last-child{
    right: 12px;
    top: 12px;
  }
}