/* Gallery — albums, grid, upload, lightbox */

.gallery-page {
  --gallery-gap: 1.15rem;
}

.gallery-intro {
  margin: 0 0 1.75rem;
  color: var(--text-dim);
  font-size: 0.98rem;
  line-height: 1.6;
  max-width: 52rem;
}

/* ——— Album overview ——— */
.gallery-album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.35rem;
}

.gallery-album-card {
  display: flex;
  flex-direction: column;
  background: linear-gradient(165deg, rgba(34, 28, 21, 0.95), rgba(18, 14, 10, 0.98));
  border: 1px solid rgba(139, 115, 85, 0.35);
  border-radius: var(--radius-lg);
  overflow: hidden;
  color: var(--text);
  text-decoration: none;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.gallery-album-card:hover {
  border-color: rgba(232, 197, 71, 0.45);
  transform: translateY(-4px);
  box-shadow: var(--shadow-gold), 0 14px 36px rgba(0, 0, 0, 0.45);
  color: var(--text);
}

.gallery-album-cover {
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: #14100c;
}

.gallery-album-cover--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  opacity: 0.45;
  background: linear-gradient(180deg, #1c1610, #100d0a);
}

.gallery-album-body {
  padding: 1.1rem 1.2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.gallery-album-body h2 {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.02em;
}

.gallery-album-body p {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-dim);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.gallery-album-count {
  margin-top: 0.15rem;
  font-size: 0.72rem;
  color: var(--bronze);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ——— Media grid ——— */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: var(--gallery-gap);
}

.gallery-item {
  position: relative;
  margin: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #1e1812 0%, #14100c 100%);
  border: 1px solid rgba(92, 74, 50, 0.55);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.32);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.gallery-item:hover {
  border-color: rgba(201, 162, 39, 0.42);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(201, 162, 39, 0.08);
}

.gallery-item--pending {
  border-style: dashed;
  border-color: rgba(184, 134, 11, 0.55);
}

.gallery-pending-badge {
  position: absolute;
  top: 0.55rem;
  right: 0.55rem;
  z-index: 3;
  background: linear-gradient(135deg, #e8c547, #c9a227);
  color: #1a0f08;
  font-family: var(--font-heading);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.gallery-item-link {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
}

.gallery-item__thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #0a0806;
}

.gallery-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, transparent 35%, rgba(12, 9, 6, 0.72) 100%);
  opacity: 0;
  transition: opacity var(--transition);
}

.gallery-item__zoom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: rgba(12, 9, 6, 0.72);
  border: 1px solid rgba(232, 197, 71, 0.45);
  font-size: 1rem;
  transform: translateY(6px);
  transition: transform var(--transition);
}

.gallery-item-link:hover .gallery-item__thumb img,
.gallery-item-link:focus-visible .gallery-item__thumb img {
  transform: scale(1.06);
}

.gallery-item-link:hover .gallery-item__overlay,
.gallery-item-link:focus-visible .gallery-item__overlay {
  opacity: 1;
}

.gallery-item-link:hover .gallery-item__zoom,
.gallery-item-link:focus-visible .gallery-item__zoom {
  transform: translateY(0);
}

.gallery-item__caption {
  padding: 0.7rem 0.85rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 2.85rem;
  border-top: 1px solid rgba(92, 74, 50, 0.35);
  background: rgba(0, 0, 0, 0.15);
}

.gallery-item__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item__desc {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-item-media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #000;
}

.gallery-item-media--video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.gallery-media-badge {
  position: absolute;
  bottom: 0.5rem;
  left: 0.5rem;
  background: rgba(0, 0, 0, 0.72);
  color: var(--gold-light);
  font-size: 0.68rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(201, 162, 39, 0.25);
}

.gallery-empty {
  text-align: center;
  padding: 3rem 1.25rem;
  color: var(--text-dim);
  border: 1px dashed rgba(92, 74, 50, 0.5);
  border-radius: var(--radius-lg);
  background: rgba(26, 21, 16, 0.45);
}

.gallery-back {
  margin-top: 2.25rem;
}

.gallery-section-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.gallery-section-head__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--bronze);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.gallery-section-head::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(92, 74, 50, 0.55), transparent);
}

/* ——— Upload panel ——— */
.gallery-upload {
  position: relative;
  background: linear-gradient(165deg, rgba(34, 28, 21, 0.92), rgba(16, 12, 9, 0.96));
  border: 1px solid rgba(139, 115, 85, 0.4);
  border-radius: var(--radius-lg);
  padding: 1.35rem 1.45rem 1.45rem;
  margin-bottom: 2rem;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(232, 197, 71, 0.06);
}

.gallery-upload::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 39, 0.08);
}

.gallery-upload__head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.gallery-upload__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius);
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.28);
  font-size: 1.15rem;
}

.gallery-upload__title {
  margin: 0 0 0.25rem;
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--gold-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gallery-upload__hint,
.gallery-upload__note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-dim);
  line-height: 1.45;
}

.gallery-upload__note {
  flex: 1 1 100%;
  padding-top: 0.15rem;
}

/* Dropzone */
.gallery-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 9.5rem;
  padding: 1.5rem 1.25rem;
  margin-bottom: 1rem;
  border: 2px dashed rgba(139, 115, 85, 0.55);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 162, 39, 0.07), transparent 70%),
    rgba(12, 9, 6, 0.45);
  cursor: pointer;
  text-align: center;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.gallery-dropzone:hover,
.gallery-dropzone:focus-within,
.gallery-dropzone.is-dragover {
  border-color: rgba(232, 197, 71, 0.65);
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(201, 162, 39, 0.14), transparent 70%),
    rgba(18, 14, 10, 0.65);
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.08);
}

.gallery-dropzone__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.gallery-dropzone__ring {
  position: absolute;
  inset: 0.65rem;
  border-radius: calc(var(--radius-lg) - 2px);
  border: 1px solid rgba(201, 162, 39, 0.08);
  pointer-events: none;
}

.gallery-dropzone__glyph {
  font-size: 1.75rem;
  line-height: 1;
  opacity: 0.75;
  margin-bottom: 0.15rem;
}

.gallery-dropzone__lead {
  font-size: 0.92rem;
  color: var(--text);
}

.gallery-dropzone__lead strong {
  color: var(--gold-light);
  font-weight: 600;
}

.gallery-dropzone__sub {
  font-size: 0.78rem;
  color: var(--text-dim);
  max-width: 28rem;
  word-break: break-word;
}

.gallery-dropzone__sub.has-files {
  color: var(--gold-light);
}

/* Per-file meta rows */
.gallery-upload__meta {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.gallery-upload__row {
  padding: 0.85rem 0.95rem;
  background: rgba(12, 9, 6, 0.55);
  border: 1px solid rgba(92, 74, 50, 0.45);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.55rem;
}

.gallery-upload__filename {
  margin: 0;
  font-size: 0.78rem;
  font-family: var(--font-heading);
  color: var(--gold-light);
  word-break: break-all;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid rgba(92, 74, 50, 0.35);
}

.gallery-upload__row label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gallery-upload__row input[type="text"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.65rem;
  font-size: 0.86rem;
  font-family: var(--font);
  text-transform: none;
  letter-spacing: normal;
}

.gallery-upload__row input[type="text"]:focus {
  outline: none;
  border-color: rgba(201, 162, 39, 0.55);
  box-shadow: 0 0 0 2px rgba(201, 162, 39, 0.12);
}

.gallery-upload__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem 1rem;
}

.gallery-upload__actions--split {
  justify-content: space-between;
}

.gallery-upload__sort {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.gallery-upload__sort label {
  font-size: 0.72rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.gallery-upload__sort input[type="number"] {
  width: 5.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.55rem;
  font-size: 0.88rem;
}

.gallery-upload__submit {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.35rem !important;
}

.gallery-upload__submit-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: rgba(26, 15, 8, 0.25);
  font-size: 0.85rem;
  line-height: 1;
}

/* ——— Lightbox ——— */
.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(6, 4, 3, 0.94);
  backdrop-filter: blur(6px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.25rem;
  animation: gallery-fade-in 0.2s ease;
}

@keyframes gallery-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gallery-lightbox[hidden] {
  display: none !important;
}

.gallery-lightbox__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(139, 115, 85, 0.5);
  border-radius: 50%;
  background: rgba(12, 9, 6, 0.75);
  color: var(--gold-light);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.gallery-lightbox__close:hover {
  border-color: var(--gold-light);
  background: rgba(34, 28, 21, 0.9);
}

.gallery-lightbox__img {
  max-width: min(96vw, 1140px);
  max-height: 78vh;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
}

.gallery-lightbox__caption {
  margin: 1.1rem 0 0;
  max-width: 640px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.9rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .gallery-album-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }

  .gallery-upload {
    padding: 1.1rem 1rem 1.2rem;
  }

  .gallery-upload__head {
    flex-direction: column;
    gap: 0.55rem;
  }

  .gallery-dropzone {
    min-height: 8.5rem;
    padding: 1.15rem 0.85rem;
  }

  .gallery-upload__actions--split {
    flex-direction: column;
    align-items: stretch;
  }

  .gallery-upload__submit {
    width: 100%;
    justify-content: center;
  }

  .gallery-item__caption {
    padding: 0.55rem 0.6rem 0.65rem;
    min-height: 2.4rem;
  }

  .gallery-item__title {
    font-size: 0.72rem;
  }
}
