/* Galerie photos — mosaïque + visionneuse plein écran */
.p-gallery { --p-gal-gap: 0.35rem; --p-accent: var(--product-primary-mid, #A83226); --p-accent-dark: var(--product-primary-dark, #8B2A20); }
.p-gallery__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5.5rem, 1fr));
  gap: var(--p-gal-gap);
}
@media (min-width: 640px) {
  .p-gallery__grid { grid-template-columns: repeat(auto-fill, minmax(7rem, 1fr)); }
}
.p-gallery__cell {
  position: relative;
  aspect-ratio: 1;
}
.p-gallery__cell .p-gallery__thumb {
  width: 100%;
  height: 100%;
}
.p-gallery__thumb-del {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 1.35rem; height: 1.35rem; border: 0; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 0.75rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.p-gallery__thumb-del:hover { background: #dc2626; }
.p-gallery__grid--reorder .p-gallery__cell { cursor: grab; }
.p-gallery__grid--reorder .p-gallery__cell:active { cursor: grabbing; }
.p-gallery__thumb {
  position: relative;
  aspect-ratio: 1;
  border: 0;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #e5e7eb;
}
.p-gallery__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.p-gallery__thumb:focus-visible {
  outline: 2px solid var(--p-accent);
  outline-offset: 2px;
}
.p-gallery__empty {
  font-size: 0.875rem;
  color: #64748b;
  padding: 1rem 0;
  margin: 0;
  text-align: center;
}
.p-gallery__upload {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.p-gallery__upload-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}
.p-gallery__upload-label:hover { border-color: var(--p-accent); color: var(--p-accent-dark); }
.p-gallery__upload input[type="file"] { display: none; }
.p-gallery__upload-msg { font-size: 0.75rem; color: #64748b; margin: 0.35rem 0 0; min-height: 1rem; }
.p-gallery__drop-hint { font-size: 0.6875rem; color: #94a3b8; margin: 0.35rem 0 0; }
.p-gallery.p-gallery__drop--over,
.p-gallery__grid-host.p-gallery__drop--over,
.p-gallery__upload.p-gallery__drop--over {
  outline: 2px dashed color-mix(in srgb, var(--p-accent) 45%, transparent);
  outline-offset: 3px;
  background: color-mix(in srgb, var(--p-accent) 4%, transparent);
}
.p-gallery__cell--dragging { opacity: 0.45; }
.p-gallery__thumb--dragging { opacity: 0.45; }
.p-gallery__grid--reorder .p-gallery__thumb { cursor: inherit; }
.p-gallery__thumb-drag {
  position: absolute; left: 4px; top: 4px; z-index: 1;
  width: 1.25rem; height: 1.25rem; border-radius: 4px;
  background: rgba(0,0,0,.45); color: #fff; font-size: 0.65rem;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; line-height: 1;
}
.p-gallery__admin-item--dragging { opacity: 0.45; }
.p-gallery__admin-item[draggable="true"] { cursor: grab; }
.p-gallery__admin-grid--reorder .p-gallery__admin-item:active { cursor: grabbing; }
.p-gallery__admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.35rem;
}
.p-gallery__admin-item { position: relative; aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: #f1f5f9; }
.p-gallery__admin-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-gallery__admin-del {
  position: absolute; top: 2px; right: 2px;
  width: 1.35rem; height: 1.35rem; border: 0; border-radius: 999px;
  background: rgba(0,0,0,.55); color: #fff; font-size: 0.75rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.p-gallery__admin-del:hover { background: #dc2626; }

/* Lightbox */
.p-gallery-lb {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
}
.p-gallery-lb.hidden { display: none; }
.p-gallery-lb__img {
  max-width: min(96vw, 1400px);
  max-height: 92vh;
  object-fit: contain;
  user-select: none;
}
.p-gallery-lb__close {
  position: absolute; top: 0.75rem; right: 0.75rem;
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.15); color: #fff; font-size: 1.25rem;
  cursor: pointer;
}
.p-gallery-lb__nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 2.75rem; height: 2.75rem; border: 0; border-radius: 999px;
  background: rgba(255,255,255,.12); color: #fff; font-size: 1.5rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.p-gallery-lb__nav:hover { background: rgba(255,255,255,.22); }
.p-gallery-lb__nav--prev { left: 0.5rem; }
.p-gallery-lb__nav--next { right: 0.5rem; }
.p-gallery-lb__meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 0.75rem 1rem 1.25rem;
  text-align: center; color: rgba(255,255,255,.85); font-size: 0.8125rem;
  background: linear-gradient(transparent, rgba(0,0,0,.5));
}
