/* ═══════════════════════════════════════════════════════
   MEMORI SENI — Premium Gallery CSS
═══════════════════════════════════════════════════════ */

/* ── Overlay ── */
#memoriOverlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 12000;
  align-items: center;
  justify-content: center;
  background: rgba(3, 1, 0, 0.96);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  padding: 24px;
}
#memoriOverlay.active { display: flex; }

/* ── Shell ── */
#memoriShell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1180px, calc(100vw - 18px));
  height: min(calc(100dvh - 48px), 880px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(239, 222, 188, 0.10);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(255, 230, 160, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 0%, rgba(220, 170, 80, 0.05) 0%, transparent 40%),
    linear-gradient(180deg, rgba(12, 8, 4, 0.97) 0%, rgba(6, 3, 1, 0.99) 100%);
  box-shadow:
    0 0 0 1px rgba(255, 240, 200, 0.04),
    0 2px 0 rgba(255, 220, 120, 0.06),
    0 40px 100px rgba(0, 0, 0, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.035);
  animation: memoriShellIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes memoriShellIn {
  from { opacity: 0; transform: translateY(24px) scale(0.975); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* top amber glow */
#memoriShell::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(200, 148, 30, 0.35) 30%, rgba(240, 200, 80, 0.5) 50%, rgba(200, 148, 30, 0.35) 70%, transparent 95%);
  pointer-events: none;
  z-index: 3;
}

/* bottom vignette */
#memoriShell::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 80px;
  background: linear-gradient(180deg, transparent 0%, rgba(3, 1, 0, 0.45) 100%);
  pointer-events: none;
  border-radius: 0 0 20px 20px;
  z-index: 2;
}

/* ── Topbar ── */
#memoriTopbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  flex-shrink: 0;
}

#memoriKicker {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
#memoriKicker small {
  letter-spacing: 3.5px;
  text-transform: uppercase;
  color: rgba(200, 148, 30, 0.45);
  font-size: 0.5rem;
  font-family: 'Cormorant Garamond', serif;
}
#memoriKicker h2 {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  font-weight: 300;
  letter-spacing: 2px;
  color: rgba(247, 239, 218, 0.92);
  line-height: 1;
  text-transform: uppercase;
  margin: 0;
}

/* ── Controls pill ── */
#memoriControls {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  background: rgba(6, 3, 1, 0.65);
  border: 1px solid rgba(200, 148, 30, 0.11);
  border-radius: 10px;
  padding: 3px 4px;
  backdrop-filter: blur(18px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025);
}

.memori-icon-btn {
  width: 30px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(185, 140, 45, 0.5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.15s;
  font-size: 0.88rem;
}
.memori-icon-btn:hover {
  background: rgba(200, 148, 30, 0.12);
  color: rgba(245, 205, 80, 0.9);
  transform: scale(1.08);
}
.memori-icon-btn:active { transform: scale(0.94); }
.memori-icon-btn--active {
  background: rgba(160, 40, 40, 0.2) !important;
  color: rgba(255, 130, 130, 0.9) !important;
}

#memoriCloseBtn {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: rgba(185, 140, 45, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.15s;
  font-size: 0.88rem;
}
#memoriCloseBtn:hover {
  background: rgba(150, 40, 40, 0.22);
  color: rgba(255, 160, 160, 0.9);
  transform: scale(1.08);
}
#memoriCloseBtn:active { transform: scale(0.94); }

.memori-ctrl-sep {
  display: block;
  width: 1px;
  height: 13px;
  background: rgba(200, 148, 30, 0.15);
  margin: 0 3px;
}

/* ── Admin bar ── */
#memoriAdminBar {
  display: none;
  align-items: center;
  gap: 2px;
}
#memoriAdminBar.visible { display: contents; }

#memoriFileInput { display: none; }

#memoriUploadBtn:not(:disabled) { color: rgba(245, 205, 80, 0.92); }
#memoriUploadBtn:disabled { opacity: 0.22; cursor: not-allowed; }

#memoriPickCount {
  font-size: 0.62rem;
  font-family: 'Manrope', sans-serif;
  color: rgba(200, 148, 30, 0.65);
  text-align: center;
  white-space: nowrap;
}
#memoriPickCount:empty { display: none; }

/* ── Upload progress ── */
#memoriUploadProgress {
  display: none;
  height: 1px;
  background: rgba(200, 148, 30, 0.08);
  flex-shrink: 0;
}
#memoriUploadProgress.visible { display: block; }
#memoriUploadBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #a07818, #e8c040, #f8e070, #e8c040, #a07818);
  background-size: 200% 100%;
  animation: memoriBarShimmer 1.4s linear infinite;
  transition: width 0.3s ease;
}
@keyframes memoriBarShimmer {
  from { background-position: 100% center; }
  to   { background-position: -100% center; }
}

/* ── Divider ── */
#memoriDivider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200, 148, 30, 0.12) 15%, rgba(200, 148, 30, 0.12) 85%, transparent);
  flex-shrink: 0;
  margin: 0 20px;
}

/* ── Scrollable body ── */
#memoriBody {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 20px 48px;
  position: relative;
  z-index: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(200, 148, 30, 0.14) transparent;
}
#memoriBody::-webkit-scrollbar { width: 3px; }
#memoriBody::-webkit-scrollbar-thumb { background: rgba(200, 148, 30, 0.18); border-radius: 4px; }

/* ── Empty state ── */
#memoriEmpty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  gap: 16px;
}
#memoriEmpty svg {
  opacity: 0.14;
  width: 52px;
  height: 52px;
}
#memoriEmpty p {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  color: rgba(232, 207, 150, 0.28);
  font-size: 1rem;
  text-align: center;
  line-height: 1.8;
}

/* ── Gallery wall — masonry via CSS columns ── */
.memori-wall {
  columns: 5 160px;
  column-gap: 5px;
  animation: memoriWallIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes memoriWallIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.memori-photo-thumb {
  position: relative;
  break-inside: avoid;
  margin-bottom: 5px;
  border-radius: 7px;
  overflow: hidden;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(180, 130, 20, 0.06);
  transition:
    border-color 0.3s,
    box-shadow 0.3s,
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  /* staggered fade-in */
  opacity: 0;
  animation: memoriThumbIn 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes memoriThumbIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* stagger first 24 photos */
.memori-photo-thumb:nth-child(1)  { animation-delay: 0.04s; }
.memori-photo-thumb:nth-child(2)  { animation-delay: 0.07s; }
.memori-photo-thumb:nth-child(3)  { animation-delay: 0.10s; }
.memori-photo-thumb:nth-child(4)  { animation-delay: 0.13s; }
.memori-photo-thumb:nth-child(5)  { animation-delay: 0.16s; }
.memori-photo-thumb:nth-child(6)  { animation-delay: 0.19s; }
.memori-photo-thumb:nth-child(7)  { animation-delay: 0.22s; }
.memori-photo-thumb:nth-child(8)  { animation-delay: 0.25s; }
.memori-photo-thumb:nth-child(9)  { animation-delay: 0.28s; }
.memori-photo-thumb:nth-child(10) { animation-delay: 0.30s; }
.memori-photo-thumb:nth-child(11) { animation-delay: 0.32s; }
.memori-photo-thumb:nth-child(12) { animation-delay: 0.34s; }
.memori-photo-thumb:nth-child(n+13) { animation-delay: 0.35s; }

.memori-photo-thumb:hover {
  border-color: rgba(200, 148, 30, 0.30);
  box-shadow:
    0 8px 28px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(200, 148, 30, 0.14),
    inset 0 0 0 1px rgba(255, 220, 120, 0.04);
  transform: scale(1.025);
  z-index: 2;
}

.memori-photo-thumb img {
  width: 100%;
  height: auto;
  display: block;
  transition: filter 0.4s, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
.memori-photo-thumb:hover img {
  filter: brightness(1.06) saturate(1.14) contrast(1.02);
  transform: scale(1.03);
}

/* golden shimmer overlay on hover */
.memori-photo-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,220,100,0.07) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
  border-radius: inherit;
}
.memori-photo-thumb:hover::after { opacity: 1; }

/* ── Skeleton loading ── */
.memori-skel-wall {
  columns: 5 160px;
  column-gap: 5px;
}

.memori-skel-thumb {
  break-inside: avoid;
  margin-bottom: 5px;
  border-radius: 7px;
  background: linear-gradient(110deg,
    rgba(180, 130, 20, 0.04) 25%,
    rgba(200, 148, 30, 0.09) 50%,
    rgba(180, 130, 20, 0.04) 75%);
  background-size: 200% 100%;
  animation: memoriSkel 1.6s ease-in-out infinite;
}

/* varied heights for masonry skeleton feel */
.memori-skel-thumb:nth-child(1)  { height: 180px; }
.memori-skel-thumb:nth-child(2)  { height: 120px; }
.memori-skel-thumb:nth-child(3)  { height: 200px; }
.memori-skel-thumb:nth-child(4)  { height: 145px; }
.memori-skel-thumb:nth-child(5)  { height: 165px; }
.memori-skel-thumb:nth-child(6)  { height: 130px; }
.memori-skel-thumb:nth-child(7)  { height: 190px; }
.memori-skel-thumb:nth-child(8)  { height: 150px; }
.memori-skel-thumb:nth-child(9)  { height: 175px; }
.memori-skel-thumb:nth-child(10) { height: 125px; }
.memori-skel-thumb:nth-child(11) { height: 160px; }
.memori-skel-thumb:nth-child(12) { height: 195px; }
.memori-skel-thumb:nth-child(n+13) { height: 150px; }

.memori-skel-thumb:nth-child(2) { animation-delay: 0.15s; }
.memori-skel-thumb:nth-child(3) { animation-delay: 0.30s; }
.memori-skel-thumb:nth-child(4) { animation-delay: 0.45s; }
.memori-skel-thumb:nth-child(5) { animation-delay: 0.10s; }
.memori-skel-thumb:nth-child(6) { animation-delay: 0.25s; }

@keyframes memoriSkel {
  from { background-position: 200% center; }
  to   { background-position: -200% center; }
}

/* ── Lightbox ── */
#memoriLightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 13000;
  background: rgba(1, 0, 0, 0.97);
  backdrop-filter: blur(28px) saturate(0.7);
  -webkit-backdrop-filter: blur(28px) saturate(0.7);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 18px;
}
#memoriLightbox.active { display: flex; }

/* radial vignette */
#memoriLightbox::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
  z-index: 0;
}

/* ── Lightbox image ── */
#memoriLightboxImg {
  position: relative;
  z-index: 1;
  max-width: min(90vw, 920px);
  max-height: 80dvh;
  object-fit: contain;
  border-radius: 5px;
  border: 1px solid rgba(220, 180, 80, 0.07);
  box-shadow:
    0 0 0 1px rgba(255, 220, 100, 0.03),
    0 40px 120px rgba(0, 0, 0, 0.9),
    0 0 80px rgba(0, 0, 0, 0.5);
}

/* initial open */
@keyframes lbIn {
  from { opacity: 0; transform: scale(0.91) translateY(8px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
/* directional slide */
@keyframes lbSlideFromRight {
  from { opacity: 0; transform: translateX(48px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0)    scale(1); }
}
@keyframes lbSlideFromLeft {
  from { opacity: 0; transform: translateX(-48px) scale(0.96); }
  to   { opacity: 1; transform: translateX(0)     scale(1); }
}

#memoriLightboxImg:not(.memori-lb-slide-next):not(.memori-lb-slide-prev) {
  animation: lbIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.memori-lb-slide-next { animation: lbSlideFromRight 0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }
.memori-lb-slide-prev { animation: lbSlideFromLeft  0.28s cubic-bezier(0.22, 1, 0.36, 1) both; }

/* ── Counter pill ── */
#memoriLightboxCaption {
  position: relative;
  z-index: 1;
  font-family: 'Cormorant Garamond', serif;
  font-size: 0.8rem;
  font-style: italic;
  letter-spacing: 0.18em;
  color: rgba(200, 148, 30, 0.45);
  background: rgba(6, 3, 1, 0.5);
  border: 1px solid rgba(200, 148, 30, 0.1);
  border-radius: 20px;
  padding: 4px 16px;
  backdrop-filter: blur(12px);
  transition: opacity 0.35s;
}

/* ── Auto-hide UI (close + nav) ── */
#memoriLightboxClose,
.memori-lb-nav {
  opacity: 0;
  transition: opacity 0.35s, background 0.2s, color 0.2s, transform 0.2s, border-color 0.2s;
  pointer-events: none;
}
#memoriLightbox.memori-lb-ui #memoriLightboxClose,
#memoriLightbox.memori-lb-ui .memori-lb-nav {
  opacity: 1;
  pointer-events: auto;
}

#memoriLightboxClose {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 2;
  background: rgba(6, 3, 1, 0.6);
  border: 1px solid rgba(200, 148, 30, 0.14);
  border-radius: 9px;
  color: rgba(180, 135, 40, 0.55);
  font-size: 0.85rem;
  width: 36px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(14px);
}
#memoriLightboxClose:hover {
  background: rgba(130, 30, 30, 0.3);
  color: rgba(255, 160, 160, 0.9);
  transform: scale(1.08);
}

.memori-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  background: rgba(6, 3, 1, 0.45);
  border: 1px solid rgba(200, 148, 30, 0.1);
  border-radius: 50%;
  color: rgba(180, 135, 40, 0.5);
  font-size: 1.3rem;
  width: 46px;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(14px);
}
.memori-lb-nav:hover {
  background: rgba(200, 148, 30, 0.14);
  border-color: rgba(200, 148, 30, 0.3);
  color: rgba(245, 205, 80, 0.95);
  transform: translateY(-50%) scale(1.1);
}
#memoriLbPrev { left: 18px; }
#memoriLbNext { right: 18px; }

/* ── Edit mode ── */
.memori-photo-del {
  display: none;
  position: absolute;
  top: 5px;
  right: 5px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(255, 90, 90, 0.45);
  background: rgba(15, 3, 3, 0.8);
  color: rgba(255, 130, 130, 0.88);
  font-size: 0.58rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
  z-index: 3;
}
.memori-photo-del:hover {
  background: rgba(150, 25, 25, 0.88);
  border-color: rgba(255, 110, 110, 0.8);
  transform: scale(1.15);
}
.memori-edit-mode .memori-photo-del { display: flex; }
.memori-edit-mode .memori-photo-thumb { cursor: default; }
.memori-edit-mode .memori-photo-thumb:hover { transform: none; }
.memori-edit-mode .memori-photo-thumb:hover::after { opacity: 0; }

.memori-album-del {
  display: none;
  background: none;
  border: none;
  color: rgba(200, 80, 80, 0.5);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  margin-left: 4px;
}
.memori-album-del:hover { color: rgba(255, 120, 120, 0.9); background: rgba(150, 25, 25, 0.15); }
.memori-edit-mode .memori-album-del { display: inline-flex; align-items: center; }

/* ── Responsive ── */
@media (max-width: 600px) {
  #memoriOverlay { padding: 0; }
  #memoriShell {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .memori-wall, .memori-skel-wall { columns: 2 120px; column-gap: 4px; }
  .memori-photo-thumb { margin-bottom: 4px; }
  .memori-skel-thumb  { margin-bottom: 4px; }
  .memori-lb-nav { display: none; }
  #memoriBody { padding: 14px 14px 32px; }
}
