.qts-gallery-page{
  background:
    radial-gradient(520px 260px at 0% 0%, rgba(197,157,80,.26), transparent 72%),
    radial-gradient(420px 240px at 100% 18%, rgba(115,19,25,.10), transparent 72%),
    linear-gradient(180deg, #fbf8f2 0%, #ffffff 52%, #f6efe4 100%);
}

.qts-gallery-page ~ .footer{
  margin-top:0;
}

.qts-gallery-hero{
  display:grid;
  grid-template-columns:minmax(0, .92fr) minmax(0, 1.08fr);
  gap:34px;
  align-items:center;
  padding:18px 0 6px;
}

.qts-gallery-hero__title{
  font-size:clamp(2.6rem, 5vw, 4.5rem);
  line-height:.96;
  margin-bottom:14px;
}

.qts-gallery-hero__lead{
  max-width:38rem;
  font-size:1.05rem;
  margin:0;
}

.qts-gallery-hero__tags{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-top:24px;
}

.qts-gallery-hero__media{
  display:grid;
  grid-template-columns:1.08fr .92fr;
  grid-template-rows:230px 230px;
  gap:16px;
  min-height:476px;
}

.qts-gallery-hero-card{
  margin:0;
  overflow:hidden;
  border-radius:28px;
  border:1px solid #eadfcb;
  background:#fff;
  box-shadow:0 20px 44px rgba(15,26,42,.10);
}

.qts-gallery-hero-card img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}

.qts-gallery-hero-card--primary{
  grid-row:1 / span 2;
}

.qts-gallery-hero-card--secondary{
  transform:translateY(14px);
}

.qts-gallery-hero-card--accent{
  transform:translateX(-10px);
}

.qts-gallery-section-head{
  display:grid;
  grid-template-columns:minmax(0, .86fr) minmax(0, 1.14fr);
  gap:24px;
  align-items:end;
  margin-bottom:26px;
}

.qts-gallery-section-head .muted{
  margin:0;
}

.qts-gallery-summary{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  gap:18px;
}

.qts-gallery-summary__card{
  border-color:#eadfcb;
  box-shadow:0 16px 32px rgba(15,26,42,.07);
}

.qts-gallery-summary__card h3{
  margin:0 0 10px;
  font-size:1.4rem;
  line-height:1.2;
  color:var(--ink);
}

.qts-gallery-summary__card .muted{
  margin:0;
}

.qts-gallery-grid{
  display:grid;
  grid-template-columns:repeat(3, minmax(0, 1fr));
  grid-auto-rows:260px;
  grid-auto-flow:dense;
  gap:18px;
}

.qts-gallery-tile{
  position:relative;
  display:block;
  padding:0;
  border:0;
  border-radius:24px;
  overflow:hidden;
  background:#fff;
  text-align:left;
  cursor:pointer;
  box-shadow:0 18px 38px rgba(15,26,42,.09);
  min-height:260px;
}

.qts-gallery-tile.is-wide{
  grid-column:span 2;
}

.qts-gallery-tile.is-tall{
  grid-row:span 2;
}

.qts-gallery-tile__media,
.qts-gallery-tile__media img{
  display:block;
  width:100%;
  height:100%;
}

.qts-gallery-tile__media img{
  object-fit:cover;
  transition:transform .55s ease, filter .35s ease;
}

.qts-gallery-tile::after{
  content:"";
  position:absolute;
  inset:0;
  background:linear-gradient(180deg, rgba(15,26,42,.08) 12%, rgba(15,26,42,.82) 92%);
}

.qts-gallery-tile__overlay{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  z-index:1;
  display:grid;
  gap:10px;
  padding:18px;
  color:#fff;
}

.qts-gallery-chip{
  display:inline-flex;
  width:fit-content;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(255,255,255,.16);
  color:#fff;
  border:1px solid rgba(255,255,255,.22);
  font-size:.72rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  backdrop-filter:blur(6px);
}

.qts-gallery-tile__title{
  display:block;
  font-family:"Playfair Display", Georgia, serif;
  font-size:1.55rem;
  line-height:1.02;
}

.qts-gallery-tile__caption{
  display:block;
  max-width:34rem;
  font-size:.96rem;
  line-height:1.45;
  color:rgba(255,255,255,.88);
  opacity:0;
  transform:translateY(10px);
  transition:opacity .28s ease, transform .28s ease;
}

.qts-gallery-tile:hover .qts-gallery-tile__media img,
.qts-gallery-tile:focus-visible .qts-gallery-tile__media img{
  transform:scale(1.06);
  filter:saturate(1.05);
}

.qts-gallery-tile:hover .qts-gallery-tile__caption,
.qts-gallery-tile:focus-visible .qts-gallery-tile__caption{
  opacity:1;
  transform:translateY(0);
}

.qts-gallery-tile:focus-visible{
  outline:3px solid rgba(197,157,80,.95);
  outline-offset:3px;
}

.qts-gallery-reveal{
  opacity:0;
  transform:translateY(26px);
  transition:
    opacity .7s ease,
    transform .7s ease;
  transition-delay:var(--gallery-delay, 0ms);
}

.qts-gallery-reveal.is-visible{
  opacity:1;
  transform:translateY(0);
}

.qts-gallery-modal-open{
  overflow:hidden;
}

.qts-gallery-modal{
  position:fixed;
  inset:0;
  z-index:120;
}

.qts-gallery-modal[hidden]{
  display:none;
}

.qts-gallery-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(8,14,24,.74);
  backdrop-filter:blur(8px);
  opacity:0;
  transition:opacity .24s ease;
}

.qts-gallery-modal__dialog{
  position:relative;
  z-index:1;
  width:min(1120px, calc(100% - 28px));
  margin:24px auto;
  padding:18px;
  border-radius:28px;
  border:1px solid rgba(234,223,203,.42);
  background:linear-gradient(180deg, rgba(255,255,255,.98), rgba(245,241,234,.98));
  box-shadow:0 30px 80px rgba(0,0,0,.28);
  transform:translateY(18px) scale(.98);
  opacity:0;
  transition:opacity .24s ease, transform .24s ease;
}

.qts-gallery-modal.is-open .qts-gallery-modal__backdrop{
  opacity:1;
}

.qts-gallery-modal.is-open .qts-gallery-modal__dialog{
  opacity:1;
  transform:translateY(0) scale(1);
}

.qts-gallery-modal__topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:14px;
}

.qts-gallery-modal__counter{
  margin:0;
  font-size:.84rem;
  font-weight:800;
  letter-spacing:.12em;
  text-transform:uppercase;
  color:var(--burgundy);
}

.qts-gallery-modal__close,
.qts-gallery-modal__nav{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:1px solid #eadfcb;
  background:#fff;
  color:var(--burgundy);
  cursor:pointer;
  transition:transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}

.qts-gallery-modal__close{
  width:46px;
  height:46px;
  border-radius:14px;
  font-size:1.8rem;
  line-height:1;
}

.qts-gallery-modal__nav{
  width:52px;
  min-width:52px;
  height:52px;
  border-radius:999px;
  font-size:1.25rem;
  box-shadow:0 12px 22px rgba(15,26,42,.10);
}

.qts-gallery-modal__close:hover,
.qts-gallery-modal__close:focus-visible,
.qts-gallery-modal__nav:hover,
.qts-gallery-modal__nav:focus-visible{
  border-color:var(--gold);
  box-shadow:0 14px 24px rgba(15,26,42,.12);
  transform:translateY(-1px);
  outline:none;
}

.qts-gallery-modal__layout{
  display:grid;
  grid-template-columns:auto minmax(0, 1fr) auto;
  gap:16px;
  align-items:center;
}

.qts-gallery-modal__figure{
  margin:0;
  overflow:hidden;
  border-radius:22px;
  background:#f2ede6;
  border:1px solid #eadfcb;
  aspect-ratio:16 / 10;
}

.qts-gallery-modal__figure img{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
}

.qts-gallery-modal__content{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  margin-top:18px;
}

.qts-gallery-modal__title{
  margin:12px 0 8px;
  color:var(--ink);
  font-size:clamp(1.7rem, 3vw, 2.4rem);
}

.qts-gallery-modal__caption{
  margin:0;
  max-width:52rem;
}

.qts-gallery-modal__hint{
  margin:4px 0 0;
  font-size:.9rem;
  color:#6b7280;
  white-space:nowrap;
}

.qts-gallery-sr-only{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0, 0, 0, 0);
  white-space:nowrap;
  border:0;
}

@media (max-width: 1080px){
  .qts-gallery-grid{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .qts-gallery-summary{
    grid-template-columns:1fr;
  }

  .qts-gallery-modal__content{
    flex-direction:column;
  }

  .qts-gallery-modal__hint{
    white-space:normal;
  }
}

@media (max-width: 980px){
  .qts-gallery-hero,
  .qts-gallery-section-head{
    grid-template-columns:1fr;
  }

  .qts-gallery-hero__media{
    min-height:0;
  }
}

@media (max-width: 760px){
  .qts-gallery-hero__media{
    grid-template-columns:1fr;
    grid-template-rows:260px 220px 220px;
  }

  .qts-gallery-hero-card--primary,
  .qts-gallery-hero-card--secondary,
  .qts-gallery-hero-card--accent{
    grid-row:auto;
    transform:none;
  }

  .qts-gallery-grid{
    grid-template-columns:1fr;
    grid-auto-rows:240px;
  }

  .qts-gallery-tile.is-wide,
  .qts-gallery-tile.is-tall{
    grid-column:span 1;
    grid-row:span 1;
  }

  .qts-gallery-modal__dialog{
    width:min(100% - 20px, 1120px);
    margin:12px auto;
    padding:14px;
    border-radius:22px;
  }

  .qts-gallery-modal__layout{
    grid-template-columns:repeat(2, minmax(0, 1fr));
  }

  .qts-gallery-modal__nav{
    width:48px;
    height:48px;
  }

  .qts-gallery-modal__nav--prev{
    order:2;
    justify-self:start;
  }

  .qts-gallery-modal__figure{
    order:1;
    grid-column:1 / -1;
  }

  .qts-gallery-modal__nav--next{
    order:3;
    justify-self:end;
  }
}

@media (max-width: 560px){
  .qts-gallery-hero{
    gap:24px;
  }

  .qts-gallery-hero__title{
    font-size:2.45rem;
  }

  .qts-gallery-hero__lead{
    font-size:1rem;
  }

  .qts-gallery-grid{
    gap:14px;
    grid-auto-rows:220px;
  }

  .qts-gallery-tile{
    min-height:220px;
  }

  .qts-gallery-tile__overlay{
    padding:16px;
  }

  .qts-gallery-tile__title{
    font-size:1.32rem;
  }

  .qts-gallery-modal__topbar{
    margin-bottom:10px;
  }

  .qts-gallery-modal__close{
    width:42px;
    height:42px;
  }
}

@media (prefers-reduced-motion: reduce){
  .qts-gallery-reveal,
  .qts-gallery-modal__backdrop,
  .qts-gallery-modal__dialog,
  .qts-gallery-tile__media img,
  .qts-gallery-tile__caption,
  .qts-gallery-modal__close,
  .qts-gallery-modal__nav{
    transition:none;
  }

  .qts-gallery-reveal{
    opacity:1;
    transform:none;
  }
}
