body.gallery-page{
  margin: 0;
}

body.gallery-page *,
body.gallery-page *::before,
body.gallery-page *::after{
  box-sizing: border-box;
}

body.gallery-page figure{
  margin: 0;
}

:root{
  --frame: 12px;
  --radius: 18px;
  --shadow: 0 18px 40px rgba(0,0,0,.12);
}

/* ===== Portfolio page: hero spacing overrides ===== */
body.gallery-page .hero h1{
  margin-top: 32px;
  margin-bottom: 20px;
}

body.gallery-page .hero .tags,
body.gallery-page .hero .hero-tags{
  margin-top: 32px;
}

/* ================= FILTERS ================= */
body.gallery-page .gallery-filters .container{
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 60px auto 56px;
  padding: 0 20px;
  flex-wrap: wrap;
}

body.gallery-page .filter-btn{
  background: none;
  border: none;
  font-size: 13px;
  letter-spacing: .14em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: .55;
  transition: opacity .3s ease;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
  padding: 0;
}

body.gallery-page .filter-btn:hover,
body.gallery-page .filter-btn.active{
  opacity: 1;
}

/* ================= GALLERY ================= */
body.gallery-page .gallery-wrapper{
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 120px;
}

body.gallery-page .gallery-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
}

/* ================= CARDS ================= */
body.gallery-page .gallery-item{
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: #eee;
  will-change: transform;
}

/* media */
body.gallery-page .gallery-item img{
  width: 100%;
  height: auto;
  display: block;
}

body.gallery-page .gallery-item.video video{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* large */
body.gallery-page .gallery-item.large{
  grid-column: 1 / -1;
  justify-self: center;
  aspect-ratio: 16 / 9;
}

body.gallery-page .gallery-item.video.large{
  grid-column: 1 / -1;
  width: 80%;
  justify-self: center;
  aspect-ratio: 16 / 9;
}

body.gallery-page .gallery-item.large.poza{
  grid-column: 1 / -1;
  width: 80%;
  justify-self: center;
  aspect-ratio: 16 / 9;
}

body.gallery-page .gallery-item.large img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* small */
body.gallery-page .gallery-item.small{
  aspect-ratio: 3 / 1.6;
  align-self: center;
  justify-self: center;
}

body.gallery-page .gallery-item.small img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

body.gallery-page .gallery-item.small.focus-top img{
  object-position: center top;
}

/* rows */
body.gallery-page .gallery-row{
  grid-column: 1 / -1;
}

body.gallery-page .gallery-row--three{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}

body.gallery-page .gallery-row--four{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

body.gallery-page .gallery-item.panorama,
body.gallery-page .gallery-item.quad{
  aspect-ratio: 4 / 5;
}

/* hover */
body.gallery-page .gallery-item::after{
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}

body.gallery-page .gallery-item:hover::after{
  opacity: 1;
}

/* note */
body.gallery-page .gallery-note{
  text-align: center;
  max-width: 720px;
  margin: 80px auto 1px;
  font-size: 0.95rem;
  line-height: 1.7;
  opacity: 0.8;
}

/* filter hide */
body.gallery-page .is-hidden{
  display: none !important;
}

/* ================= RESPONSIVE ================= */
@media (max-width: 1024px){
  body.gallery-page .gallery-row--four{
    grid-template-columns: repeat(2, 1fr);
  }

  body.gallery-page .gallery-item.video.large,
  body.gallery-page .gallery-item.large.poza{
    width: 100%;
  }
}

@media (max-width: 768px){

  html,
  body{
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  /* hero */
  body.gallery-page .hero h1{
    margin-top: 24px;
    margin-bottom: 16px;
  }

  body.gallery-page .hero .tags,
  body.gallery-page .hero .hero-tags{
    margin-top: 20px;
  }

  /* filters */
  body.gallery-page .gallery-filters .container{
    display: flex;
    justify-content: center;
    gap: 14px;
    margin: 34px auto 38px;
    padding: 0 22px;
    flex-wrap: wrap;
  }

  body.gallery-page .filter-btn{
    font-size: 12px;
    letter-spacing: .12em;
    color: #111;
  }

  /* wrapper */
  body.gallery-page .gallery-wrapper{
    max-width: 100%;
    margin: 0 auto;
    padding: 0 22px 90px;
    overflow: hidden;
  }

  /* main grid */
  body.gallery-page .gallery-grid{
    grid-template-columns: 1fr;
    gap: 30px;
  }

  /* rows become single column */
  body.gallery-page .gallery-row{
    width: 100%;
  }

  body.gallery-page .gallery-row--three,
  body.gallery-page .gallery-row--four{
    grid-template-columns: 1fr;
    gap: 30px;
    width: 100%;
  }

  /* all items full width, but NO forced ratio on mobile */
  body.gallery-page .gallery-item,
  body.gallery-page .gallery-item.large,
  body.gallery-page .gallery-item.video.large,
  body.gallery-page .gallery-item.large.poza,
  body.gallery-page .gallery-item.small,
  body.gallery-page .gallery-item.panorama,
  body.gallery-page .gallery-item.quad{
    width: 100%;
    max-width: 100%;
    justify-self: stretch;
    align-self: stretch;
    aspect-ratio: auto !important;
    border-radius: 18px;
    overflow: hidden;
    background: transparent;
  }

  /* media keeps natural proportions on mobile */
  body.gallery-page .gallery-item img,
  body.gallery-page .gallery-item video,
  body.gallery-page .gallery-item.large img,
  body.gallery-page .gallery-item.large video,
  body.gallery-page .gallery-item.small img,
  body.gallery-page .gallery-item.panorama img,
  body.gallery-page .gallery-item.quad img{
    width: 100%;
    height: auto !important;
    display: block;
    object-fit: contain !important;
    object-position: center;
    background: transparent !important;
  }

  /* note */
  body.gallery-page .gallery-note{
    text-align: center;
    max-width: 680px;
    margin: 54px auto 0;
    font-size: 0.95rem;
    line-height: 1.75;
    opacity: .82;
    padding: 0 10px;
  }
}