/* ==========================================================
   IHCA — фотогалерея записи (попапы на magnific popup из темы)
   ========================================================== */

.ih2hca-gallery {
  margin: 28px 0 12px;
}

.ih2hca-gallery__caption {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: 'Exo 2', sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #1d2532;
}

.ih2hca-gallery__caption::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(29, 37, 50, .22), rgba(29, 37, 50, 0));
}

.ih2hca-gallery__count {
  padding: 3px 9px;
  border-radius: 999px;
  background: #eceff4;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  text-transform: none;
  color: #5a6472;
}

.ih2hca-gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  grid-auto-flow: dense;
}

@media (min-width: 600px) {
  .ih2hca-gallery__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 992px) {
  .ih2hca-gallery__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

.ih2hca-gallery__item {
  position: relative;
  display: block;
  margin: 0;
  line-height: 0;
  overflow: hidden;
  border-radius: 10px;
  background: #10151f;
  box-shadow: 0 1px 2px rgba(16, 21, 31, .12);
  transition: transform .25s ease, box-shadow .25s ease;
}

/* портретные фото занимают 2 ряда mosaic-сетки (на мобильных — обычная плитка) */
@media (min-width: 600px) {
  .ih2hca-gallery__item.is-portrait { grid-row: span 2; }
}

.ih2hca-gallery__item img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  display: block;
  transition: transform .5s ease, filter .5s ease;
}

@media (min-width: 600px) {
  .ih2hca-gallery__item.is-portrait img { aspect-ratio: auto; }
}

.ih2hca-gallery__item::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(16, 21, 31, .62) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-4.3-4.3M11 8.2v5.6M8.2 11h5.6'/%3E%3C/svg%3E") no-repeat center / 16px 16px;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .25s ease, transform .25s ease;
}

.ih2hca-gallery__item:hover,
.ih2hca-gallery__item:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px rgba(16, 21, 31, .22);
  z-index: 1;
}

.ih2hca-gallery__item:hover img,
.ih2hca-gallery__item:focus-visible img {
  transform: scale(1.05);
  filter: saturate(1.06);
}

.ih2hca-gallery__item:hover::after,
.ih2hca-gallery__item:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.ih2hca-gallery__item:focus-visible {
  outline: 3px solid #c8102e;
  outline-offset: 3px;
}

/* ---------- оформление самого попапа ---------- */

.mfp-bg { background: #080b11; }

.mfp-image-holder .mfp-img {
  border-radius: 4px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}

.mfp-counter {
  top: 10px;
  right: 14px;
  font-family: 'Exo 2', sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

.mfp-title {
  font-family: 'Exo 2', sans-serif;
  font-size: 13px;
  letter-spacing: .02em;
  color: rgba(255, 255, 255, .78);
}

.mfp-arrow::before,
.mfp-arrow::after { border-color: #fff; }

.mfp-close {
  font-size: 34px;
  opacity: .8;
}

/* ---------- уважение к настройкам движения ---------- */

@media (prefers-reduced-motion: reduce) {
  .ih2hca-gallery__item,
  .ih2hca-gallery__item img,
  .ih2hca-gallery__item::after {
    transition: none;
  }
  .ih2hca-gallery__item:hover { transform: none; }
  .ih2hca-gallery__item:hover img { transform: none; }
}
