/* =========================================================
   EWO GALLERY
   Mobile-first cleaned version
========================================================= */

/* ---------- Scroll lock class (required for JS) ---------- */
body.is-modal-open{
  position: fixed;
  width: 100%;
  overflow: hidden;
}

/* Optional: helps prevent rubber-band scroll chaining */
html,
body{
  overscroll-behavior: none;
}

.ewo-lightbox__img{ cursor: zoom-in; }
.ewo-lightbox__img.is-zoomed{ cursor: zoom-out; }
.ewo-lightbox__panel.is-zoomed{ cursor: grab; }
.ewo-lightbox__panel.is-zoomed.is-panning{ cursor: grabbing; }

/* VERY important so pointer pan doesn’t fight browser gestures */
.ewo-lightbox__panel{ touch-action: none; }

@font-face {
  font-family: "IMFellSC";
  src: url("../fonts/IMFellEnglishSC-Regular.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* =========================================================
   1) Page wrapper
========================================================= */
.ewo-gallery{
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.6rem 0.9rem 2.6rem;
  font-family: "IMFellSC", serif;
}

.ewo-gallery__head{
  margin-bottom: 1.2rem;
  font-family: "IMFellSC", serif;
  text-align: center;
}

.ewo-gallery__title{
  margin: 0 0 .35rem 0;
  font-family: "EWOAncient", serif;
  letter-spacing: .08em;
  font-size: clamp(2rem, 8vw, 3.3rem);
  font-weight: 600;
  text-align: center;
  padding-top: 1.25rem;
  padding-bottom: 1.25rem;
  line-height: 1.08;
  color: rgba(235, 246, 255, 0.98);
  animation: topsetsHaloBreath 14s ease-in-out infinite alternate;
  will-change: text-shadow;
}

.ewo-gallery__subtitle{
  margin: 0 0 1rem 0;
  opacity: .92;
  max-width: 72ch;
  font-family: "IMFellSC", serif;
}

/* =========================================================
   2) Filters (Categories)
========================================================= */
.ewo-gallery__filters{
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .75rem;
  justify-content: center;
}

.ewo-filter{
  appearance: none;
  border: 1px solid rgba(248, 159, 3, 0.35);
  background: rgba(10,14,26,0.55);
  color: rgba(248, 158, 3, 0.493);
  font-family: "IMFellSC", serif;
  padding: .6rem .85rem;
  border-radius: 0;
  text-align: center;
  font-size: 1.05rem;
  line-height: 1.2;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, border-color .12s ease, box-shadow .12s ease;
}

.ewo-filter:hover{
  transform: translateY(-1px);
  border-color: rgba(214,170,92,0.6);
  box-shadow: 0 10px 22px rgba(0,0,0,0.25);
}

.ewo-filter:focus-visible{
  outline: 2px solid rgba(180,215,255,.75);
  outline-offset: 2px;
}

.ewo-filter.is-active{
  background: rgba(214,170,92,0.16);
  border-color: rgba(214,170,92,0.75);
}

/* =========================================================
   3) Masonry grid (columns)
========================================================= */
.ewo-masonry{
  column-count: 2;
  column-gap: .75rem;
}

/* Tile button */
.ewo-tile{
  display: block;
  width: 100%;
  margin: 0 0 .75rem 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;

  break-inside: avoid;
  -webkit-column-break-inside: avoid;

  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
  transform: translateZ(0);
}

.ewo-tile img{
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1);
  transition: transform 1s ease, filter 1s ease;
}

.ewo-tile:hover img{
  transform: scale(1.02);
  filter: brightness(1.06);
}

.ewo-tile:focus-visible{
  outline: 2px solid rgba(180,215,255,.75);
  outline-offset: 3px;
}

/* Hidden tiles (filtering) */
.ewo-tile.is-hidden{
  display: none;
}

/* =========================================================
   4) Lightbox overlay
========================================================= */
.ewo-lightbox{
  position: fixed;
  inset: 0;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .35s ease;
}

.ewo-lightbox.is-open{
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Click-to-close veil */
.ewo-lightbox__veil{
  position: absolute;
  inset: 0;
  background: rgba(6, 8, 14, 0.86);
  backdrop-filter: blur(2px);
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent;
}

/* =========================================================
   5) Lightbox panel layout
========================================================= */
.ewo-lightbox__panel{
  position: absolute;
  inset: .75rem;
  margin: 0;

  border-radius: 16px;
  background: rgba(10,14,26,0.72);
  border: 1px solid rgba(214,170,92,0.35);
  box-shadow: 0 24px 70px rgba(0,0,0,0.55);

  height: calc(100dvh - 1.5rem);

  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;

  overflow: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  transform: scale(.98);
  transition: transform .18s ease;
}

.ewo-lightbox.is-open .ewo-lightbox__panel{
  transform: scale(1);
}

/* Fullscreen image area */
.ewo-lightbox__img{
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
  background: rgba(0,0,0,0.45);
  user-select: none;
  -webkit-user-drag: none;
  opacity: 1;
  transition: opacity 1s ease, transform .25s ease;
}

/* Caption */
.ewo-lightbox__cap{
  flex: 0 0 auto;
  padding: .8rem .9rem;
  text-align: center;
  color: rgba(248, 158, 3, 0.493);
  background: rgba(0,0,0,0.35);
  border-top: 1px solid rgba(214,170,92,0.22);
}

/* =========================================================
   6) Lightbox controls
========================================================= */
.ewo-lightbox__close{
  position: absolute;
  top: .55rem;
  right: .55rem;

  width: 42px;
  height: 42px;
  border-radius: 999px;

  border: 1px solid rgba(214,170,92,0.35);
  background: rgba(10,14,26,0.65);
  color: rgba(248, 158, 3, 0.493);
  z-index: 20;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;

  display: grid;
  place-items: center;
}

.ewo-lightbox__close:hover{
  border-color: rgba(214,170,92,0.6);
}

.ewo-lightbox__close:focus-visible{
  outline: 2px solid rgba(180,215,255,.75);
  outline-offset: 2px;
}

/* Prev/Next */
.ewo-lightbox__nav{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);

  width: 48px;
  height: 48px;
  border-radius: 999px;

  border: 1px solid rgba(214,170,92,0.35);
  background: rgba(10,14,26,0.55);
  color: rgba(248, 158, 3, 0.493);

  cursor: pointer;
  font-size: 32px;
  line-height: 1;

  display: grid;
  place-items: center;
}

.ewo-lightbox__prev{ left: .55rem; }
.ewo-lightbox__next{ right: .55rem; }

.ewo-lightbox__nav:hover{
  border-color: rgba(214,170,92,0.6);
}

.ewo-lightbox__nav:focus-visible{
  outline: 2px solid rgba(180,215,255,.75);
  outline-offset: 2px;
}

/* Play button */
.ewo-lightbox__play{
  position: absolute;
  left: .55rem;
  bottom: .55rem;

  padding: .55rem .85rem;
  border-radius: 999px;

  border: 1px solid rgba(214,170,92,0.35);
  background: rgba(10,14,26,0.55);
  color: rgba(248, 158, 3, 0.493);

  cursor: pointer;
}

.ewo-lightbox__play:hover{
  border-color: rgba(214,170,92,0.6);
}

.ewo-lightbox__play:focus-visible{
  outline: 2px solid rgba(180,215,255,.75);
  outline-offset: 2px;
}

/* zoom states */
.ewo-lightbox__img.is-zoomed{
  cursor: zoom-out;
  transform: scale(2);
}

/* allow panning when zoomed */
.ewo-lightbox__panel.is-zoomed{
  overflow: auto;
}

/* =========================================
   GALLERY SLIDESHOW BUTTON
========================================= */
.ewo-gallery__slideshow{
  display:block;
  margin:.7rem auto 1.25rem;
  padding:.6rem 1rem;
  text-align: center;

  font-family:"IM Fell English SC", serif;
  font-size:1rem;
  letter-spacing:.06em;

  color:#e6c27a;
  background:rgba(10,14,26,0.55);

  border:1px solid rgba(214,170,92,0.45);
  border-radius:4px;

  cursor:pointer;

  transition:
    transform .18s ease,
    background .18s ease,
    color .18s ease,
    border-color .18s ease,
    box-shadow .18s ease;
}

/* hover state */
.ewo-gallery__slideshow:hover{
  transform:translateY(-4px);
  background:#d6aa5c;
  color:#0b0f1a;
  border-color:#d6aa5c;
  box-shadow:
    0 6px 14px rgba(0,0,0,.45),
    0 0 8px rgba(214,170,92,.45);
}

/* click press */
.ewo-gallery__slideshow:active{
  transform:translateY(-1px);
  box-shadow:0 3px 6px rgba(0,0,0,.4);
}

/* play icon */
.ewo-gallery__slideshow::before{
  margin-right:1.1rem;
  font-size:.75rem;
}

/* =========================================
   Lightbox MODAL FADE TRANSITION
========================================= */
.ewo-lightbox__img.fade-out{
  opacity: 0;
}

/* =========================================================
   8) Safety: if any global styles try to force images max-width
========================================================= */
.ewo-lightbox__panel img{
  max-width: 100%;
}

/* =========================================================
   Larger screens
========================================================= */
@media (min-width: 421px){
  .ewo-lightbox__nav{
    width: 54px;
    height: 54px;
    font-size: 36px;
  }

  .ewo-lightbox__close{
    width: 44px;
    height: 44px;
    font-size: 26px;
  }
}

@media (min-width: 720px){
  .ewo-gallery{
    padding: 2.2rem 1rem 3.2rem;
  }

  .ewo-gallery__title{
    font-size: clamp(2.6rem, 2.8vw, 3.3rem);
    padding-top: 2rem;
    padding-bottom: 2rem;
  }

  .ewo-gallery__filters{
    gap: 1rem;
    justify-content: flex-start;
  }

  .ewo-filter{
    font-size: 1.5rem;
    padding: .55rem .9rem;
  }

  .ewo-masonry{
    column-count: 3;
    column-gap: .9rem;
  }

  .ewo-tile{
    margin: 0 0 .9rem 0;
  }

  .ewo-lightbox__panel{
    inset: 1rem;
    border-radius: 18px;
    height: calc(100dvh - 2rem);
  }

  .ewo-lightbox__cap{
    padding: .9rem 1rem;
  }

  .ewo-gallery__slideshow{
    margin: .7rem 0 1.4rem;
    font-size: 1.1rem;
  }
}

@media (min-width: 900px){
  .ewo-lightbox__panel{
    inset: 2rem;
    height: calc(100dvh - 4rem);
  }
}

@media (min-width: 1024px){
  .ewo-masonry{
    column-count: 4;
  }
}

/* =========================================
   LIGHTBOX — small screen positioning fix
========================================= */

@media (max-width: 600px){

  /* Move PLAY button up */
  .ewo-lightbox__play{
    bottom: 4.8rem;   /* was ~.75rem */
  }

  /* Move PREV/NEXT buttons down slightly */
  .ewo-lightbox__nav{
    top: 68%;   /* was 50% */
  }

  /* Optional: tighten caption so it doesn't push things */
  .ewo-lightbox__cap{
    padding: .7rem .8rem;
  }
}
