/* ==========================================================================
   AliveWater Gallery CSS
   Drupal Views gallery grid + PhotoSwipe popup polish
   Works with current HTML:
   .aw-gallery-view .photoswipe-gallery .item-list > ul > li > a.photoswipe
   ========================================================================== */

/* --------------------------------------------------------------------------
   Gallery page design tokens
   -------------------------------------------------------------------------- */

.aw-gallery-view {
  --aw-gallery-primary: var(--primary, #0084cb);
  --aw-gallery-primary-dark: var(--primary-dark, #0054a9);
  --aw-gallery-ink: #114b5f;
  --aw-gallery-muted: #5f7484;
  --aw-gallery-border: var(--border, #dbe7f3);
  --aw-gallery-soft: #f7fbff;
  --aw-gallery-card: #ffffff;
  --aw-gallery-radius: 18px;
  --aw-gallery-shadow: 0 10px 28px rgba(14, 50, 67, 0.12);
  --aw-gallery-shadow-hover: 0 18px 42px rgba(14, 50, 67, 0.18);

  margin: 2rem 0 3.25rem;
  color: var(--text, #231f20);
}

/* --------------------------------------------------------------------------
   Exposed filter box
   -------------------------------------------------------------------------- */

.aw-gallery-view .view-filters {
  margin: 0 0 2.25rem;
  padding: 1.15rem 1.25rem;
  background: linear-gradient(135deg, #f7fbff 0%, #ffffff 100%);
  border: 1px solid rgba(0, 132, 203, 0.1);
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(14, 50, 67, 0.06);
}

.aw-gallery-view .views-exposed-form .form--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1rem;
  align-items: flex-end;
}

.aw-gallery-view .views-exposed-form .form-item {
  margin: 0;
  min-width: min(260px, 100%);
}

.aw-gallery-view .views-exposed-form label {
  display: block;
  margin: 0 0 0.45rem;
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--aw-gallery-ink);
}

.aw-gallery-view .views-exposed-form .form-select,
.aw-gallery-view .views-exposed-form select {
  min-height: 46px;
  border-radius: 12px;
  border: 1px solid rgba(0, 132, 203, 0.18);
  background-color: #fff;
  color: var(--text, #231f20);
}

.aw-gallery-view .form-actions {
  margin: 0;
}

.aw-gallery-view .form-actions .btn,
.aw-gallery-view .form-actions input[type="submit"] {
  min-height: 46px;
  padding: 0.72rem 1.25rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--aw-gallery-primary), #23b4d8);
  color: #fff;
  font-weight: 800;
  box-shadow: 0 10px 22px rgba(0, 132, 203, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.aw-gallery-view .form-actions .btn:hover,
.aw-gallery-view .form-actions input[type="submit"]:hover {
  background: linear-gradient(135deg, var(--aw-gallery-primary-dark), var(--aw-gallery-primary));
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   View structure and category headings
   -------------------------------------------------------------------------- */

.aw-gallery-view .view-content {
  display: block;
}

.aw-gallery-view .view-content > h3 {
  position: relative;
  margin: 2.6rem 0 1.15rem;
  padding: 0 0 0.78rem;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
  line-height: 1.25;
  font-weight: 850;
  color: var(--aw-gallery-ink);
  border-bottom: 1px solid rgba(0, 132, 203, 0.16);
}

.aw-gallery-view .view-content > h3:first-child {
  margin-top: 0;
}

.aw-gallery-view .view-content > h3::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 86px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--aw-gallery-primary), #23b4d8);
}

.aw-gallery-view .views-row {
  margin: 0 0 2.65rem;
}

.aw-gallery-view .views-field-title,
.aw-gallery-view .views-field-field-gallery-category,
.aw-gallery-view .views-field-body {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Gallery grid
   IMPORTANT: Your current View removed the normal views-field wrapper and now
   outputs: <div><div class="photoswipe-gallery"><div class="item-list"><ul>...
   So we target .photoswipe-gallery, not only .views-field-field-gallery-images.
   -------------------------------------------------------------------------- */

.aw-gallery-view .photoswipe-gallery,
.aw-gallery-view .views-field-field-gallery-images,
.aw-gallery-view .views-field-field-gallery-images .field-content,
.aw-gallery-view .views-field-field-gallery-images .item-list {
  width: 100%;
  min-width: 0;
}

.aw-gallery-view .photoswipe-gallery .item-list > ul,
.aw-gallery-view .views-field-field-gallery-images .item-list > ul,
.aw-gallery-view .views-field-field-gallery-images .field-content > ul,
.aw-gallery-view .views-field-field-gallery-images ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 22px !important;
  align-items: stretch !important;
}

.aw-gallery-view .photoswipe-gallery .item-list > ul > li,
.aw-gallery-view .views-field-field-gallery-images .item-list > ul > li,
.aw-gallery-view .views-field-field-gallery-images .field-content > ul > li,
.aw-gallery-view .views-field-field-gallery-images ul > li {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-width: 0 !important;
}

.aw-gallery-view .photoswipe-gallery li::marker,
.aw-gallery-view .views-field-field-gallery-images li::marker {
  content: "" !important;
  font-size: 0 !important;
}

.aw-gallery-view .photoswipe-gallery a.photoswipe,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe {
  position: relative;
  display: block !important;
  width: 100% !important;
  height: 260px !important;
  overflow: hidden !important;
  border-radius: var(--aw-gallery-radius) !important;
  background: linear-gradient(135deg, #eef8fd 0%, #ffffff 100%) !important;
  box-shadow: var(--aw-gallery-shadow) !important;
  text-decoration: none !important;
  transform: translateZ(0);
  transition: transform 0.28s ease, box-shadow 0.28s ease, filter 0.28s ease !important;
}

.aw-gallery-view .photoswipe-gallery a.photoswipe::before,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 52%, rgba(0, 84, 169, 0.28) 100%);
  opacity: 0;
  transition: opacity 0.28s ease;
  pointer-events: none;
}

.aw-gallery-view .photoswipe-gallery a.photoswipe::after,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe::after {
  content: "\f00e";
  position: absolute;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0, 132, 203, 0.88);
  color: #fff;
  font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 0.95rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
  pointer-events: none;
}

.aw-gallery-view .photoswipe-gallery a.photoswipe:hover,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe:hover {
  transform: translateY(-5px);
  box-shadow: var(--aw-gallery-shadow-hover) !important;
  filter: saturate(1.05);
}

.aw-gallery-view .photoswipe-gallery a.photoswipe:hover::before,
.aw-gallery-view .photoswipe-gallery a.photoswipe:hover::after,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe:hover::before,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.aw-gallery-view .photoswipe-gallery a.photoswipe img,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover !important;
  display: block !important;
  border-radius: var(--aw-gallery-radius) !important;
  transition: transform 0.35s ease !important;
}

.aw-gallery-view .photoswipe-gallery a.photoswipe:hover img,
.aw-gallery-view .views-field-field-gallery-images a.photoswipe:hover img {
  transform: scale(1.05);
}

@media (min-width: 1400px) {
  .aw-gallery-view .photoswipe-gallery .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images ul {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 1199.98px) {
  .aw-gallery-view .photoswipe-gallery .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images ul {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 20px !important;
  }

  .aw-gallery-view .photoswipe-gallery a.photoswipe,
  .aw-gallery-view .views-field-field-gallery-images a.photoswipe {
    height: 240px !important;
  }
}

@media (max-width: 767.98px) {
  .aw-gallery-view .photoswipe-gallery .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images ul {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px !important;
  }

  .aw-gallery-view .photoswipe-gallery a.photoswipe,
  .aw-gallery-view .views-field-field-gallery-images a.photoswipe {
    height: 190px !important;
    border-radius: 14px !important;
  }

  .aw-gallery-view .photoswipe-gallery a.photoswipe img,
  .aw-gallery-view .views-field-field-gallery-images a.photoswipe img {
    border-radius: 14px !important;
  }
}

@media (max-width: 480px) {
  .aw-gallery-view .photoswipe-gallery .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images .item-list > ul,
  .aw-gallery-view .views-field-field-gallery-images ul {
    grid-template-columns: 1fr !important;
  }

  .aw-gallery-view .photoswipe-gallery a.photoswipe,
  .aw-gallery-view .views-field-field-gallery-images a.photoswipe {
    height: auto !important;
  }

  .aw-gallery-view .photoswipe-gallery a.photoswipe img,
  .aw-gallery-view .views-field-field-gallery-images a.photoswipe img {
    height: auto !important;
  }
}

/* --------------------------------------------------------------------------
   PhotoSwipe popup enhancement
   -------------------------------------------------------------------------- */

.pswp__bg {
  background: rgba(6, 18, 28, 0.88) !important;
  backdrop-filter: blur(8px);
}

.pswp__button--arrow--prev,
.pswp__button--arrow--next {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: fixed !important;
  top: 50% !important;
  z-index: 999999 !important;
  width: 64px !important;
  height: 64px !important;
  margin-top: -32px !important;
  border-radius: 999px !important;
  background: rgba(0, 92, 125, 0.9) !important;
  opacity: 1 !important;
  visibility: visible !important;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.pswp__button--arrow--prev {
  left: 28px !important;
}

.pswp__button--arrow--next {
  right: 28px !important;
}

.pswp__button--close,
.pswp__button--zoom,
.aw-pswp-rotate {
  display: flex !important;
  align-items: center;
  justify-content: center;
  position: fixed !important;
  top: 18px !important;
  z-index: 999999 !important;
  width: 58px !important;
  height: 58px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: rgba(0, 92, 125, 0.9) !important;
  color: #fff !important;
  opacity: 1 !important;
  visibility: visible !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  transition: transform 0.25s ease, background-color 0.25s ease;
}

.pswp__button--close {
  right: 22px !important;
}

.pswp__button--zoom {
  right: 92px !important;
}

.aw-pswp-rotate {
  right: 162px !important;
}

.pswp__button--arrow--prev:hover,
.pswp__button--arrow--next:hover,
.pswp__button--close:hover,
.pswp__button--zoom:hover,
.aw-pswp-rotate:hover {
  background: #0084cb !important;
  transform: scale(1.08);
}

.pswp__button svg,
.pswp__button .pswp__icn {
  fill: #fff !important;
  color: #fff !important;
  opacity: 1 !important;
}

.pswp__button--zoom svg,
.pswp__button--zoom .pswp__icn {
  display: none !important;
}

.pswp__button--zoom::after {
  content: "+";
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}

.pswp--zoomed-in .pswp__button--zoom::after {
  content: "−";
}

.aw-pswp-caption {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 999999;
  transform: translateX(-50%);
  max-width: min(760px, 86vw);
  padding: 13px 24px;
  background: rgba(0, 92, 125, 0.92);
  color: #fff;
  border-radius: 14px;
  font-size: 16px;
  line-height: 1.45;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

@media (max-width: 767.98px) {
  .pswp__button--arrow--prev,
  .pswp__button--arrow--next {
    width: 48px !important;
    height: 48px !important;
    margin-top: -24px !important;
  }

  .pswp__button--arrow--prev {
    left: 12px !important;
  }

  .pswp__button--arrow--next {
    right: 12px !important;
  }

  .pswp__button--close,
  .pswp__button--zoom,
  .aw-pswp-rotate {
    width: 46px !important;
    height: 46px !important;
    top: 12px !important;
    font-size: 21px !important;
  }

  .pswp__button--close {
    right: 10px !important;
  }

  .pswp__button--zoom {
    right: 64px !important;
  }

  .aw-pswp-rotate {
    right: 118px !important;
  }

  .aw-pswp-caption {
    bottom: 14px;
    max-width: 90vw;
    padding: 10px 16px;
    font-size: 14px;
  }
}
