/* ===== GALLERY PAGES (shared by all painting galleries + paper-collages) ===== */

.gallery-page .page-content {
  max-width: 1100px;
}

.gallery-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 12px 0 0;
}

.gallery-header .page-title {
  font-family: 'Cinzel', serif;
  margin-bottom: 4px;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0ece4;
  line-height: 1.2;
}

.gallery-page .page-title {
  text-align: center;
  margin-bottom: 4px;
  font-weight: 400;
  font-size: 32px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0ece4;
  line-height: 1.2;
}

.gallery-subtitle {
  font-family: 'DM Sans', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #c4a882;
  letter-spacing: 0.02em;
  font-style: italic;
  text-transform: none;
  text-align: center;
  margin-bottom: 8px;
}

.gallery-header .gallery-subtitle {
  margin-bottom: 4px;
}

.gallery-subtitle--painting {
  color: #c4a882;
}

.gallery-divider {
  display: block;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(196, 168, 130, 0.5), transparent);
  margin: 10px auto;
}

.gallery-description {
  color: #c4a882;
  font-size: 16px;
  font-style: italic;
  line-height: 1.55;
  text-transform: none;
  max-width: 560px;
  text-align: center;
  margin: 0 auto 10px;
}

/* Gallery Toolbar (search + filter dropdown) */
.gallery-toolbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 14px;
  margin-bottom: 16px;
}

.gallery-toolbar .portfolio-filter,
.gallery-toolbar .gallery-dropdown,
.gallery-toolbar .gallery-search {
  width: 220px;
  min-width: 220px;
  flex: 0 0 220px;
}

/* Gallery Search */
.gallery-search {
  position: relative;
  width: 220px;
}

.gallery-search__icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #777;
  pointer-events: none;
}

.gallery-search__input {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  padding: 8px 14px 8px 36px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.gallery-search__input::placeholder {
  color: #666;
}

.gallery-search__input:focus {
  border-color: rgba(196, 168, 130, 0.5);
  background: rgba(196, 168, 130, 0.06);
}

/* Gallery Filter Dropdown */
.gallery-dropdown {
  position: relative;
  width: 180px;
}

.gallery-dropdown__select {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  padding: 8px 36px 8px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: #fff;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.gallery-toolbar .portfolio-filter__toggle {
  width: 100%;
  min-width: 220px;
  height: 40px;
  box-sizing: border-box;
}

.gallery-dropdown__select:focus {
  border-color: rgba(196, 168, 130, 0.5);
  background: rgba(196, 168, 130, 0.06);
}

.gallery-dropdown__select option {
  background: #111;
  color: #fff;
}

.gallery-dropdown__arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #777;
  pointer-events: none;
}

.gallery-item.is-hidden {
  display: none;
}

/* Gallery Grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.gallery-item {
  text-align: center;
  position: relative;
}

.gallery-item a {
  display: block;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  cursor: default;
  transition: transform 0.4s ease, filter 0.25s ease;
}

.gallery-item a:hover img,
.gallery-item img:hover {
  transform: scale(1.03);
  filter: brightness(0.52);
}

/* Favorite Heart Button */
.fav-heart {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease, background 0.3s ease;
}

.fav-heart svg {
  width: 18px;
  height: 18px;
  fill: none;
}

.gallery-item:hover .fav-heart {
  opacity: 1;
  transform: scale(1);
}

.fav-heart:hover {
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
}

.fav-heart.is-favorited {
  opacity: 1;
  color: #e05b6f;
}

.fav-heart.is-favorited svg {
  fill: #e05b6f;
}

.fav-heart.is-favorited:hover {
  color: #c44a5c;
}

.fav-heart.is-favorited:hover svg {
  fill: #c44a5c;
}

.gallery-item .img-title {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 400;
  color: #ffffff;
  margin-top: 12px;
  letter-spacing: 0.04em;
}

.gallery-item .img-poem {
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-style: italic;
  color: #c4a882;
  line-height: 1.7;
  margin-top: 6px;
  letter-spacing: 0.02em;
  cursor: default;
}

.gallery-item .img-poem:hover {
  color: #d7bb94;
}

.gallery-item .img-enlarge-hint {
  display: none !important;
}

.gallery-item::after {
  content: "Enlarge";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(255, 255, 255, 0.95);
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 2;
}

.gallery-item:hover::after {
  opacity: 1;
}

/* Lightbox Popup */
body.lightbox-open {
  overflow: hidden;
}

.gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 8, 10, 0.88);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.gallery-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease;
}

.gallery-lightbox__content {
  position: relative;
  max-width: min(94vw, 1140px);
  max-height: 90vh;
  transform: translateY(8px) scale(0.985);
  transition: transform 0.3s ease;
}

.gallery-lightbox.is-open .gallery-lightbox__content {
  transform: translateY(0) scale(1);
}

.gallery-lightbox__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}

.gallery-lightbox__image {
  display: block;
  max-width: 100%;
  max-height: 56vh;
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.45);
}

.gallery-lightbox__meta {
  max-height: 30vh;
  overflow-y: auto;
  background: rgba(12, 12, 16, 0.86);
  border: 1px solid rgba(196, 168, 130, 0.34);
  border-radius: 10px;
  padding: 16px 16px 14px;
}

.gallery-lightbox__caption {
  margin: 0 0 10px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 18px;
  letter-spacing: 0.04em;
  color: #f1f1f1;
}

.gallery-lightbox__poem {
  margin: 0;
  text-align: center;
  font-family: 'DM Sans', sans-serif;
  font-size: 20px;
  font-style: italic;
  line-height: 1.8;
  color: #c4a882;
  letter-spacing: 0.02em;
}

.gallery-lightbox__topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.gallery-lightbox__heart {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease;
}

.gallery-lightbox__heart svg {
  width: 20px;
  height: 20px;
  fill: none;
}

.gallery-lightbox__heart:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: scale(1.08);
}

.gallery-lightbox__heart.is-favorited {
  color: #e05b6f;
}

.gallery-lightbox__heart.is-favorited svg {
  fill: #e05b6f;
}

.gallery-lightbox__heart.is-favorited:hover {
  color: #c44a5c;
}

.gallery-lightbox__heart.is-favorited:hover svg {
  fill: #c44a5c;
}

.gallery-lightbox__close {
  position: absolute;
  top: 0;
  right: 10px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease;
}

.gallery-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: scale(1.05);
}

.gallery-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
  font-size: 34px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.25s ease, transform 0.25s ease;
}

.gallery-lightbox__nav--prev {
  left: -74px;
}

.gallery-lightbox__nav--next {
  right: -74px;
}

.gallery-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-50%) scale(1.05);
}

/* Responsive */
@media (max-width: 900px) {
  .gallery-header .page-title {
    font-size: 28px;
    letter-spacing: 0.06em;
  }

  .gallery-page .page-title {
    font-size: 28px;
    letter-spacing: 0.06em;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .gallery-item .img-poem {
    font-size: 12px;
  }

  .gallery-lightbox__body {
    grid-template-columns: 1fr;
  }

  .gallery-lightbox__image {
    max-height: 56vh;
  }

  .gallery-lightbox__meta {
    max-height: 30vh;
  }

  .gallery-lightbox__caption {
    font-size: 16px;
  }

  .gallery-lightbox__poem {
    font-size: 17px;
  }
}

@media (max-width: 540px) {
  .gallery-header .page-title {
    font-size: 24px;
    letter-spacing: 0.05em;
  }

  .gallery-page .page-title {
    font-size: 24px;
    letter-spacing: 0.05em;
  }

  .gallery-subtitle {
    font-size: 14px;
    letter-spacing: 0.01em;
  }

  .gallery-subtitle--painting {
    font-size: 14px;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .gallery-lightbox {
    padding: 16px;
  }

  .gallery-lightbox__close {
    width: 36px;
    height: 36px;
  }

  .gallery-item::after {
    font-size: 11px;
  }

  .gallery-lightbox__nav {
    width: 40px;
    height: 40px;
    font-size: 26px;
  }

  .gallery-lightbox__nav--prev {
    left: 6px;
  }

  .gallery-lightbox__nav--next {
    right: 6px;
  }
}

@media (max-width: 400px) {
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
}

/* Touch devices: avoid sticky hover-only UI and keep actions usable */
@media (hover: none) and (pointer: coarse) {
  .gallery-item a:hover img,
  .gallery-item img:hover {
    transform: none;
    filter: none;
  }

  .gallery-item:hover::after {
    opacity: 0;
  }

  .gallery-item .fav-heart {
    opacity: 1;
    transform: scale(1);
  }
}
