/* === PAGE === */
.ag-gallery-page{
  padding: 32px 0 70px;
}

/* если у тебя уже есть .wrapper в теме — будет идеально */
.ag-gallery-page .ag-gallery-wrap{
  width: min(1320px, calc(100% - 80px));
  margin: 0 auto;
}

@media (max-width: 768px){
  .ag-gallery-page .ag-gallery-wrap{
    width: calc(100% - 40px);
  }
}

/* === TOP BAR === */
.ag-gallery-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom: 22px;
}

.ag-gallery-title{
  margin:0;
  font-size: 38px;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
  color:#2a2a2a;
}

.ag-gallery-sort{
  display:flex;
  align-items:center;
  gap:10px;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:#6f6f6f;
  margin-top: 6px;
}

.ag-gallery-sort__label{
  white-space: nowrap;
}

.ag-gallery-sort__select{
  border:0;
  background: transparent;
  outline:none;
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor:pointer;
  color:#2a2a2a;
}

/* === GRID === */
.ag-gallery-grid{
  display:grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px 26px; /* как на макете: больше воздуха */
}

@media (max-width: 1200px){
  .ag-gallery-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 820px){
  .ag-gallery-grid{ grid-template-columns: repeat(2, 1fr); }
  .ag-gallery-top{ flex-direction:column; }
}
@media (max-width: 520px){
  .ag-gallery-grid{ grid-template-columns: 1fr; }
}

/* === CARD === */
.ag-gallery-card{
  background:#fff;
  border:1px solid #ededed;
}

.ag-gallery-card__head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding: 14px 16px 10px;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:#8a8a8a;
}

.ag-gallery-card__img{
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 10px 16px 16px;
  min-height: 310px; /* ключевое: одинаковая высота блока как у вас */
}

.ag-gallery-card__img img{
  max-width: 100%;
  max-height: 320px; /* чтобы не прыгало */
  object-fit: contain;
}

.ag-gallery-card__artist{
  padding: 14px 16px 18px;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color:#2a2a2a;
}

.ag-gallery-card__artist-link{
  text-decoration: none;
  color:#2a2a2a;
}

/* === VIEW MORE === */
.ag-gallery-more{
  display:flex;
  justify-content:center;
  margin-top: 36px;
}

.ag-gallery-more__btn{
  border:0;
  background:#2b2b2b;
  color:#fff;
  padding: 12px 26px;
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor:pointer;
  transition: opacity .15s ease;
}

.ag-gallery-more__btn:hover{ opacity:.9; }
.ag-gallery-more__btn:disabled{ opacity:.5; cursor:not-allowed; }

.ag-gallery-more__arrow{
  margin-left: 8px;
  display:inline-block;
  transform: translateY(1px);
}