/* ══════════════════════════════════════════════════════════════
   EVENT GALLERY — masonry grid + lightbox
   Phone: 2 columns. Tablet/desktop: 3 columns. CSS columns give the
   Pinterest-style masonry with no JS layout pass.
   ══════════════════════════════════════════════════════════════ */

.gal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.gal-admin-bar { display: flex; gap: 8px; }

/* year pills */
.gal-years { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.gal-years:empty { display: none; }
.gal-year {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 15px; border-radius: 20px;
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer; transition: all 0.16s;
}
.gal-year:hover { color: var(--text); border-color: var(--border2); }
.gal-year.active {
  background: linear-gradient(135deg, var(--gold), #ffb340);
  color: #14140c; border-color: var(--gold);
}
.gal-year span {
  font-size: 10px; font-weight: 800;
  background: rgba(0,0,0,0.18); border-radius: 10px; padding: 1px 6px;
}
.gal-year:not(.active) span { background: var(--surface3); color: var(--muted); }

/* prominent year heading */
.gal-year-title {
  font-family: 'Bebas Neue', sans-serif;
  font-size: 1.7em; letter-spacing: 3px; color: var(--gold);
  margin-bottom: 14px; display: flex; align-items: baseline; gap: 10px;
}
.gal-year-title span {
  font-family: 'Space Grotesk', sans-serif; font-size: 0.42em;
  letter-spacing: 1px; color: var(--muted); font-weight: 700;
}
.gal-year-title:empty { display: none; }

/* admin event label input */
.gal-event-input {
  width: 180px; max-width: 46vw;
  font-size: 13px; padding: 8px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); outline: none;
}
.gal-event-input:focus { border-color: var(--gold); }

/* one section per event */
.gal-grid { display: flex; flex-direction: column; gap: 22px; }
.gal-section-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.gal-section-name {
  font-size: 13px; font-weight: 800; letter-spacing: 1px; color: var(--text);
}
.gal-section-count {
  font-size: 11px; font-weight: 700; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  padding: 2px 9px; border-radius: 10px;
}
.gal-section-head::after {
  content: ''; flex: 1; height: 1px;
  background: linear-gradient(90deg, var(--border2), transparent);
}

/* masonry within a section */
.gal-masonry { column-count: 2; column-gap: 10px; }
@media (min-width: 700px)  { .gal-masonry { column-count: 3; column-gap: 12px; } }
@media (min-width: 1100px) { .gal-masonry { column-count: 4; column-gap: 12px; } }

.gal-item {
  position: relative;
  break-inside: avoid;
  margin: 0 0 10px;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface2);
  transition: transform 0.15s, box-shadow 0.2s;
}
.gal-item:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0,0,0,0.4); }
.gal-item:active { transform: scale(0.99); }
.gal-item img { width: 100%; display: block; }
.gal-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 20px 12px 9px;
  font-size: 11px; font-weight: 600; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  opacity: 0; transition: opacity 0.2s;
}
.gal-item:hover figcaption { opacity: 1; }
.gal-del {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(10,10,16,0.7); color: #fff;
  font-size: 14px; cursor: pointer; opacity: 0; transition: opacity 0.16s, background 0.16s;
  display: flex; align-items: center; justify-content: center;
}
.gal-item:hover .gal-del, .gal-item:focus-within .gal-del { opacity: 1; }
.gal-del:hover { background: var(--danger); }
@media (hover: none) { .gal-del { opacity: 0.85; } }

/* empty state */
.gal-empty {
  text-align: center; padding: 60px 20px; color: var(--muted);
  background: rgba(255,255,255,0.015); border: 1px dashed var(--border2);
  border-radius: 16px; font-size: 14px; line-height: 1.8;
}
.gal-empty-icon { font-size: 40px; display: block; margin-bottom: 10px; opacity: 0.5; }
.gal-empty-sub { font-size: 12px; color: var(--muted); }

/* ── Lightbox ── */
.gal-lightbox {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: #0b0d13;
  align-items: center; justify-content: center;
}
.gal-lightbox.open { display: flex; animation: fadeUp 0.2s ease both; }
.gal-lb-stage {
  max-width: 92vw; max-height: 82vh;
  display: flex; align-items: center; justify-content: center;
}
.gal-lb-stage img {
  max-width: 92vw; max-height: 82vh;
  width: auto; height: auto;
  object-fit: contain; border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.gal-lb-close {
  position: fixed; top: 20px; right: 22px;
  width: 42px; height: 42px; border-radius: 50%;
  background: transparent; border: none; color: #fff;
  font-size: 24px; cursor: pointer; opacity: 0.8; transition: opacity 0.15s, transform 0.15s;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.gal-lb-close:hover { opacity: 1; transform: scale(1.1); }
.gal-lb-arrow {
  position: fixed; bottom: 22px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14);
  color: #fff; font-size: 20px; cursor: pointer; opacity: 0.85;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, opacity 0.15s;
}
.gal-lb-arrow:hover { background: rgba(255,255,255,0.14); opacity: 1; }
.gal-lb-prev { right: 76px; }
.gal-lb-next { right: 24px; }
/* on wider screens float the arrows to the sides, mid-height */
@media (min-width: 760px) {
  .gal-lb-arrow { top: 50%; transform: translateY(-50%); bottom: auto; }
  .gal-lb-prev { left: 24px; right: auto; }
  .gal-lb-next { right: 24px; }
}
.gal-lb-bar {
  position: fixed; left: 0; right: 0; bottom: 22px;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  flex-wrap: wrap; padding: 0 90px; pointer-events: none;
}
.gal-lb-bar > * { pointer-events: auto; }
.gal-lb-counter { font-size: 13px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.gal-lb-caption { font-size: 12px; color: rgba(255,255,255,0.6); max-width: 60vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-lb-del {
  font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(255,69,96,0.15); border: 1px solid rgba(255,69,96,0.4);
  border-radius: 20px; padding: 5px 12px; cursor: pointer;
}
.gal-lb-del:hover { background: rgba(255,69,96,0.3); }
@media (max-width: 640px) {
  .gal-lb-bar { padding: 0 16px; bottom: 74px; }
  .gal-lb-caption { max-width: 90vw; }
  .gal-lb-stage, .gal-lb-stage img { max-height: 74vh; }
}

/* ══ Multi-select + move-to-album ══════════════════════════════ */
.gal-grid.sel-mode .gal-item { cursor: pointer; }
.gal-item { position: relative; }
.gal-item.selected { outline: 3px solid var(--gold); outline-offset: -3px; }
.gal-item.selected img { opacity: 0.8; }
.gal-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.5); border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.gal-item.selected .gal-check { background: var(--gold); border-color: var(--gold); }
.gal-item.selected .gal-check::after { content: '✓'; color: #14140c; font-size: 15px; font-weight: 900; }
/* drop target while dragging a photo onto an album header */
.gal-section-head.drop-hot {
  outline: 2px dashed var(--gold); outline-offset: 2px;
  background: rgba(245,200,66,0.1); border-radius: 8px;
}

/* floating selection action bar */
.gal-selbar {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 250;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center;
  max-width: calc(100vw - 24px);
  padding: 10px 16px; border-radius: 16px;
  background: rgba(15,15,26,0.96); backdrop-filter: blur(12px);
  border: 1px solid var(--border2); box-shadow: 0 20px 50px -14px rgba(0,0,0,0.8);
}
.gal-sel-count { font-size: 13px; font-weight: 700; color: var(--text2); }
.gal-sel-count b { color: var(--gold); font-size: 15px; }
.gal-sel-hint { font-size: 11px; color: var(--muted); }
@media (max-width: 640px) { .gal-selbar { bottom: 78px; } .gal-sel-hint { display: none; } }

/* move-to-album picker */
.gal-move-targets { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; max-height: 46vh; overflow-y: auto; }
.gal-move-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 11px 13px; border-radius: 10px; cursor: pointer; text-align: left;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  font-family: 'Noto Sans Thai', sans-serif; transition: border-color 0.15s, background 0.15s;
}
.gal-move-btn:hover { border-color: var(--gold); background: rgba(245,200,66,0.08); }
.gal-move-btn b { font-size: 14px; font-weight: 700; }
.gal-move-btn span { font-size: 11px; color: var(--muted); }
.gal-move-empty { grid-column: 1/-1; font-size: 13px; color: var(--muted); text-align: center; padding: 16px; }
.gal-move-new { display: flex; gap: 8px; align-items: center; }
.gal-move-new .gal-event-input { flex: 1; }
