.twis-gallery {
  display: grid;
  gap: 24px;
}
.twis-gallery-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 34px;
  color: #fff;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(14, 32, 53, .98), rgba(46, 111, 159, .9)),
    #183451;
}
.twis-gallery-head h2 {
  margin: 0 0 8px;
  color: #fff;
  font-family: var(--twis-serif, Georgia, serif);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1;
}
.twis-gallery-head p {
  margin: 0;
  max-width: 720px;
  color: rgba(255,255,255,.78);
}
.twis-gallery-count {
  flex: 0 0 auto;
  padding: 10px 14px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 999px;
  color: rgba(255,255,255,.82);
  font-weight: 800;
}
.twis-gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.twis-gallery-filters button,
.twis-gallery-close {
  border: 1px solid rgba(24,52,81,.14);
  border-radius: 999px;
  background: #fff;
  color: #183451;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 15px;
}
.twis-gallery-filters button.is-active {
  background: #ec7f2d;
  border-color: #ec7f2d;
  color: #fff;
}
.twis-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: dense;
  gap: 14px;
}
.twis-gallery-card {
  position: relative;
  min-height: 260px;
  margin: 0;
  overflow: hidden;
  border-radius: 8px;
  background: #eaf5fb;
  box-shadow: 0 18px 48px rgba(14,32,53,.1);
}
.twis-gallery-card.is-large {
  grid-column: span 2;
  grid-row: span 2;
  min-height: 536px;
}
.twis-gallery-card button {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.twis-gallery-card img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  object-fit: cover;
  transform: scale(1.01);
  transition: transform .35s ease;
}
.twis-gallery-card:hover img {
  transform: scale(1.06);
}
.twis-gallery-card button span {
  position: absolute;
  left: 14px;
  top: 14px;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.9);
  color: #183451;
  font-size: 12px;
  font-weight: 800;
}
.twis-gallery-card figcaption {
  position: absolute;
  inset: auto 0 0;
  padding: 44px 16px 16px;
  color: #fff;
  background: linear-gradient(to top, rgba(14,32,53,.9), rgba(14,32,53,0));
}
.twis-gallery-card strong,
.twis-gallery-card small {
  display: block;
}
.twis-gallery-card strong {
  font-family: var(--twis-serif, Georgia, serif);
  font-size: 23px;
  line-height: 1.05;
}
.twis-gallery-card small {
  margin-top: 5px;
  color: rgba(255,255,255,.8);
}
.twis-gallery-card.is-hidden {
  display: none;
}
.twis-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 16px;
  padding: 28px;
  background: rgba(8, 18, 31, .92);
}
.twis-gallery-lightbox[hidden] {
  display: none;
}
.twis-gallery-lightbox img {
  justify-self: center;
  align-self: center;
  max-width: min(1100px, 100%);
  max-height: 78vh;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.twis-gallery-lightbox div {
  justify-self: center;
  width: min(1100px, 100%);
  color: #fff;
}
.twis-gallery-lightbox h3,
.twis-gallery-lightbox p {
  margin: 0;
}
.twis-gallery-lightbox p {
  color: rgba(255,255,255,.7);
}
.twis-gallery-close {
  justify-self: end;
}
@media (max-width: 980px) {
  .twis-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  .twis-gallery-head {
    display: block;
    padding: 24px;
  }
  .twis-gallery-count {
    display: inline-flex;
    margin-top: 18px;
  }
  .twis-gallery-grid {
    grid-template-columns: 1fr;
  }
  .twis-gallery-card,
  .twis-gallery-card.is-large {
    grid-column: auto;
    grid-row: auto;
    min-height: 340px;
  }
}
