/* ── Gallery Module CSS ── */

/* ── Gallery Header (list page) ── */
.gallery-header {
  padding: 4rem 0 2.5rem;
  border-bottom: 1px solid var(--color-border, rgba(255,255,255,.08));
  margin-bottom: 2.5rem;
}
.gallery-header-inner { max-width: 640px; }
.gallery-header h1 {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(2rem, 5vw, 3rem);
  margin: .5rem 0;
}
.gallery-header p { opacity: .65; margin: 0; }

/* ── Albums Grid ── */
.albums-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 0 0 4rem;
}

/* ── Album Card ── */
.album-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-xl, 1rem);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border, rgba(255,255,255,.07));
  transition: var(--transition, 200ms ease);
}
.album-card:hover { transform: translateY(-4px); box-shadow: 0 24px 56px -8px rgba(0,0,0,.35); }

.album-card-cover {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--color-bg);
}
.album-card-img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .5s ease;
}
.album-card:hover .album-card-img { transform: scale(1.06); }
.album-card-placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; opacity: .2;
}
.album-card-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.7) 0%, transparent 50%);
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end;
  padding: 1rem 1.125rem; opacity: 0; transition: opacity .3s ease;
}
.album-card:hover .album-card-overlay { opacity: 1; }
.album-card-count { font-size: .8rem; color: rgba(255,255,255,.75); margin-bottom: .25rem; }
.album-card-btn   { font-size: .875rem; font-weight: 600; color: #fff; }
.album-card-info  { padding: 1.125rem; }
.album-card-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.125rem; font-weight: 700; margin: 0 0 .25rem; line-height: 1.3;
}
.album-card-desc { font-size: .875rem; opacity: .6; margin: 0; line-height: 1.5; }

/* ── Album Detail Header ── */
.gallery-album-header {
  position: relative; min-height: 40vh;
  display: flex; align-items: flex-end; overflow: hidden; margin-bottom: 2.5rem;
}
.gallery-album-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
}
.gallery-album-bg-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.75) 0%, rgba(0,0,0,.1) 60%);
}
.gallery-album-header .container { position: relative; z-index: 1; }
.gallery-album-header-content    { padding: 3rem 0 3.5rem; }
.gallery-album-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700;
  color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.4); margin: .5rem 0;
}
.gallery-album-desc { color: rgba(255,255,255,.8); margin: 0 0 .5rem; font-size: 1.0625rem; }

/* ── Photo Grid (CSS Grid — uniform cells) ── */
.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(var(--gallery-cols, 4), 1fr);
  gap: 8px;
  padding-bottom: 4rem;
}
.gallery-item {
  border-radius: var(--radius-md, .5rem);
  overflow: hidden;
}
.gallery-item-inner {
  position: relative;
  overflow: hidden;
  border-radius: inherit;
  background: var(--color-surface);
  aspect-ratio: 1;        /* square, uniform cells */
}
.gallery-item-img {
  display: block;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .5s ease;
}
.gallery-item:hover .gallery-item-img { transform: scale(1.06); }
.gallery-item-overlay {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: .5rem;
  opacity: 0; transition: opacity .3s ease;
}
.gallery-item:hover .gallery-item-overlay { opacity: 1; }
.gallery-item-zoom  { font-size: 2rem; }
.gallery-item-title {
  color: #fff; font-size: .875rem; font-weight: 500;
  text-align: center; padding: 0 .75rem;
  text-shadow: 0 1px 4px rgba(0,0,0,.5);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ── Lightbox ── */
.lightbox {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,.95);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.lightbox.lb-active { opacity: 1; pointer-events: all; }

.lb-stage {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%; flex: 1; padding: 3.5rem 5rem;
  box-sizing: border-box; overflow: hidden;
}
.lb-img {
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: .375rem;
  box-shadow: 0 32px 80px rgba(0,0,0,.6);
  transition: opacity .2s ease;
  display: block;
}
.lb-loader {
  position: absolute;
  width: 2.5rem; height: 2.5rem;
  border: 3px solid rgba(255,255,255,.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: lb-spin .7s linear infinite;
  display: none;
}
@keyframes lb-spin { to { transform: rotate(360deg); } }

.lb-close, .lb-prev, .lb-next {
  position: fixed;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff; cursor: pointer;
  font-size: 1.5rem; line-height: 1;
  transition: background .15s, transform .15s;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgba(255,255,255,.2);
  transform: scale(1.1);
}
.lb-close { top: 1.25rem; right: 1.5rem; width: 2.75rem; height: 2.75rem; font-size: 1.125rem; z-index: 1; }
.lb-prev  { left: 1rem;  top: 50%; transform: translateY(-50%); width: 3.5rem; height: 3.5rem; }
.lb-next  { right: 1rem; top: 50%; transform: translateY(-50%); width: 3.5rem; height: 3.5rem; }
.lb-prev:hover { transform: translateY(-50%) scale(1.1); }
.lb-next:hover { transform: translateY(-50%) scale(1.1); }

.lb-footer {
  width: 100%; padding: .75rem 5rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  box-sizing: border-box; gap: 1rem;
}
.lb-title  { color: rgba(255,255,255,.8); font-size: .9375rem; }
.lb-counter{ color: rgba(255,255,255,.4); font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── Responsive ── */
@media (max-width: 900px) {
  .gallery-masonry { grid-template-columns: repeat(var(--gallery-cols-md, 3), 1fr); }
  .lb-stage  { padding: 3rem 3.5rem; }
  .lb-footer { padding: .5rem 1rem 1rem; }
  .lb-prev { left: .25rem; } .lb-next { right: .25rem; }
  .albums-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.25rem; }
}
@media (max-width: 640px) {
  .gallery-masonry { grid-template-columns: repeat(var(--gallery-cols-sm, 2), 1fr); gap: 4px; }
  .lb-stage  { padding: 2.5rem 1rem; }
  .lb-img    { max-width: 96vw; max-height: 80vh; }
  .lb-prev, .lb-next { width: 2.75rem; height: 2.75rem; }
}
