/* =========================
   EDITIONS (grid page)
   ========================= */

.ag-editions-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  margin-top: 40px;
}

/* карточка */
.ag-edition-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  padding: 26px 26px 20px;
  transition: box-shadow .2s ease, transform .2s ease;
}

.ag-edition-card:hover {
  box-shadow: 0 12px 35px rgba(0,0,0,.08);
  transform: translateY(-1px);
}

/* контейнер изображения — фиксируем “рамку” как в дизайне */
.ag-edition-card__img {
  
  height: 230px;              /* одинаковая высота для всех */
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  overflow: hidden;
}

/*
  ✅ ВАЖНО:
  После "VIEW MORE" у тебя картинки могли растягиваться из-за глобального CSS:
  img { width:100%; height:auto; } или инлайнов.
  Поэтому тут ставим !important и жестко фиксируем поведение внутри рамки.
*/
.ag-edition-card__img img {
  width: auto !important;
  height: auto !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  display: block;
}

/* подпись */
.ag-edition-card__title {
  margin-top: 18px;
  font-family: "Inria Serif", serif;
  font-size: 14px;
  letter-spacing: .02em;
  text-transform: uppercase;
  line-height: 1.25;
  color: #111;
}

/* =========================
   VIEW MORE button (как на твоём скрине 3)
   ========================= */
.ag-loadmore {
  display: flex;
  justify-content: center;
  margin: 38px 0 10px;
}

.ag-loadmore__btn {
  appearance: none;
  border: 0;
  background: #2f2f2f;
  color: #fff;
  font-family: "Inter Tight", sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 14px 26px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: opacity .2s ease, transform .2s ease;
}

.ag-loadmore__btn:hover { opacity: .9; transform: translateY(-1px); }
.ag-loadmore__btn:active { transform: translateY(0); }
.ag-loadmore__btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; }

.ag-loadmore__icon {
  font-size: 16px;
  line-height: 1;
  display: inline-block;
}

.ag-edition-card__link{
      display: flex;
    justify-content: center;
}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 1200px) {
  .ag-editions-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .ag-editions-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ag-edition-card__img { height: 220px; }
}

@media (max-width: 560px) {
  .ag-editions-grid { grid-template-columns: 1fr; gap: 16px; }
  .ag-edition-card { padding: 18px 18px 16px; }
  .ag-edition-card__img { height: 240px; }
  .ag-loadmore__btn { width: 100%; justify-content: center; }
}

/* =========================
   MODAL (fixed + поверх всего)
   ========================= */

html.ag-modal-open,
html.ag-modal-open body {
  overflow: hidden;
}

.ag-edition-modal[hidden] { display: none; }

.ag-edition-modal {
  position: fixed;
  flex-direction: column;
  display: flex;
  align-items: center;
  justify-content: center;
  inset: 0;
  gap: 10px;
  z-index: 99999;
}

.ag-edition-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
}

.ag-edition-modal__box {
  position: relative;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
}

.ag-edition-modal__content {
  position: relative;
  max-width: 92vw;
  max-height: 86vh;
  background: transparent;
}

.ag-edition-modal__content img {
  max-width: 92vw;
  max-height: 86vh;
  width: auto;
  height: auto;
  display: block;
  transform-origin: center center;
}

.ag-edition-modal__close {
  position: absolute;
  top: 18px;
  right: -35px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 28px;
  line-height: 44px;
  cursor: pointer;
  z-index: 100000;
}

.ag-edition-modal__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ag-edition-modal__nav:hover, .ag-edition-modal__zoom:hover, .ag-edition-modal__close:hover{
  background-color: white;
  color: black;
}
.ag-edition-modal__nav:hover svg path{
  fill: black;
}
.ag-edition-modal__nav--prev { left: -35px; }
.ag-edition-modal__nav--next { right: -35px; }

.ag-edition-modal__caption {
  max-width: 460px;
  width: 100%;
  background: rgba(0,0,0,.55);
  color: #fff;
  padding: 10px 14px;
  font-size: 14px;
  letter-spacing: .02em;
  z-index: 100000;
  text-align: center;
  backdrop-filter: blur(19px);
}

.ag-edition-modal__zoom {
  position: absolute;
  right: -35px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 0;
  background: rgba(255,255,255,.2);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  z-index: 100000;
}

.ag-edition-modal__zoom--in { top: 70px; }
.ag-edition-modal__zoom--out { top: 122px; }

@media (max-width: 560px) {
  .ag-edition-modal__box { padding: 12px; }
  .ag-edition-modal__caption { bottom: 14px; font-size: 13px; }
}