/* ==========================================================================
   Grace Villa — gallery

   The theme switch here is DELIBERATELY LOCAL. Everything inside .gscope
   reads its colour from --g-* custom properties declared on the scope itself,
   so flipping data-mode repaints this section (or this page) and touches
   nothing else on the site. No global class, no <html> attribute.
   ========================================================================== */

.gscope {
  --g-bg:     var(--ink);
  --g-bg-2:   var(--ink-2);
  --g-bg-3:   var(--ink-3);
  --g-text:   var(--ivory);
  --g-muted:  rgba(242, 237, 227, .60);
  --g-dim:    rgba(242, 237, 227, .38);
  --g-line:   rgba(198, 161, 91, .18);
  --g-hair:   rgba(242, 237, 227, .10);
  --g-gold:   var(--gold);
  --g-gold-lt: var(--gold-lt);
  --g-shadow: rgba(0, 0, 0, .95);
  --g-img:    brightness(.82) saturate(.95);

  position: relative;
  background: var(--g-bg);
  color: var(--g-text);
  transition: background .8s var(--ease), color .8s var(--ease);
}

/* --- the light half of the switch ---------------------------------------- */
.gscope[data-mode="light"] {
  --g-bg:     #F2EDE4;
  --g-bg-2:   #EAE3D6;
  --g-bg-3:   #E2DACA;
  --g-text:   #15120D;
  --g-muted:  rgba(21, 18, 13, .64);
  --g-dim:    rgba(21, 18, 13, .44);
  --g-line:   rgba(21, 18, 13, .16);
  --g-hair:   rgba(21, 18, 13, .10);
  --g-gold:   #8A6E35;
  --g-gold-lt: #6E5726;
  --g-shadow: rgba(60, 48, 26, .30);
  --g-img:    brightness(1) saturate(1.02);
}

/* the grain and vignette overlay is tuned for a dark page — lift it here */
.gscope[data-mode="light"] .gal-grain { opacity: .5; mix-blend-mode: multiply; }

/* ---------------------------------------------------------------- header */

.gscope .eyebrow { color: var(--g-gold); }
.gscope .eyebrow::before,
.gscope .eyebrow.is-centered::after { background: linear-gradient(90deg, transparent, var(--g-gold)); }
.gscope .lede { color: var(--g-muted); }
.gscope .italic { color: var(--g-gold-lt); }

.ghead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 38px;
}

/* ---------------------------------------------------------------- filters

   Morning Picks / Night Picks sit in the heading row, right-aligned to the
   foot of the heading, where the separate dark/light switch used to be.
   They are the switch now: morning turns the section light, night dark.  */

.gfilters { display: flex; gap: 8px; flex-wrap: wrap; }

.gfilter {
  position: relative;
  padding: 9px 18px;
  border: 1px solid var(--g-line);
  border-radius: 999px;
  background: none;
  color: var(--g-muted);
  font-family: var(--sans);
  font-size: .62rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  overflow: hidden;
  isolation: isolate;
  transition: color .4s var(--ease), border-color .4s var(--ease);
}
.gfilter::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--g-gold);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .45s var(--ease);
}
.gfilter:hover { border-color: var(--g-gold); color: var(--g-bg); }
.gfilter:hover::before { transform: scaleX(1); }
.gfilter.is-on { color: var(--g-bg); border-color: var(--g-gold); }
.gfilter.is-on::before { transform: scaleX(1); }

/* ---------------------------------------------------------------- grid */

/* Every tile is a square and every row lines up. No portrait tiles, no
   masonry row-spans — the mosaic looked restless and cropped faces oddly. */
.ggrid {
  display: grid;
  gap: clamp(10px, 1.3vw, 18px);
}

/* the home-page picks: a strict 3 x 3 */
.ggrid--picks { grid-template-columns: repeat(3, 1fr); }

/* the full archive: wider screens get a fourth column */
.ggrid--all { grid-template-columns: repeat(3, 1fr); }
@media (min-width: 1120px) { .ggrid--all { grid-template-columns: repeat(4, 1fr); } }

@media (max-width: 640px) {
  .ggrid--picks, .ggrid--all { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 420px) {
  .ggrid--picks, .ggrid--all { grid-template-columns: 1fr; }
}

.gcell {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1;              /* the square */
  padding: 0;
  border: 0;
  background: var(--g-bg-3);
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
  /* the tile itself never moves — only what is inside it animates */
  transition: box-shadow .6s var(--ease), background .8s var(--ease);
}
.gcell:hover { box-shadow: 0 24px 60px -30px var(--g-shadow); }
.gcell:focus-visible { outline: 2px solid var(--g-gold); outline-offset: 3px; }

.gcell img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: var(--g-img);
  transform: scale(1.02);
  transition: transform 1.5s var(--ease), filter .8s var(--ease);
}
.gcell:hover img { transform: scale(1.1); filter: brightness(1.04) saturate(1.05); }

/* --- the hover: four brackets close in like a viewfinder ------------------ */

.gcell__edge {
  position: absolute;
  inset: 13px;
  z-index: 3;
  pointer-events: none;
}
.gcell__edge i {
  position: absolute;
  width: 24px;
  height: 24px;
  border: 0 solid var(--gold-lt);
  opacity: 0;
  transition: opacity .4s var(--ease), transform .55s var(--ease);
}
.gcell__edge i:nth-child(1) {
  top: 0; left: 0;
  border-top-width: 1px; border-left-width: 1px;
  transform: translate(-12px, -12px);
}
.gcell__edge i:nth-child(2) {
  top: 0; right: 0;
  border-top-width: 1px; border-right-width: 1px;
  transform: translate(12px, -12px);
  transition-delay: .05s;
}
.gcell__edge i:nth-child(3) {
  bottom: 0; left: 0;
  border-bottom-width: 1px; border-left-width: 1px;
  transform: translate(-12px, 12px);
  transition-delay: .1s;
}
.gcell__edge i:nth-child(4) {
  bottom: 0; right: 0;
  border-bottom-width: 1px; border-right-width: 1px;
  transform: translate(12px, 12px);
  transition-delay: .15s;
}
.gcell:hover .gcell__edge i { opacity: .9; transform: none; }

/* a single glancing sheen crosses the square */
.gcell__sheen {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(115deg,
    transparent 36%, rgba(255, 240, 214, .26) 50%, transparent 64%);
  transform: translateX(-115%);
  transition: transform 1.05s var(--ease);
}
.gcell:hover .gcell__sheen { transform: translateX(115%); }

.gcell__cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  padding: 46px 18px 16px;
  text-align: left;
  background: linear-gradient(transparent, rgba(6, 6, 10, .88) 55%);
  opacity: 0;
  transition: opacity .45s var(--ease);
  pointer-events: none;
}
.gcell:hover .gcell__cap { opacity: 1; }

.gcell__cap b {
  display: block;
  font-family: var(--display);
  font-size: clamp(.95rem, 1.5vw, 1.2rem);
  font-weight: 400;
  color: #F2EDE3;
  line-height: 1.25;
  transform: translateY(14px);
  transition: transform .6s var(--ease);
}
.gcell__cap em {
  display: block;
  font-style: normal;
  font-size: .54rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold-lt);
  margin-bottom: 5px;
  transform: translateX(-14px);
  opacity: 0;
  transition: transform .6s var(--ease) .08s, opacity .5s var(--ease) .08s;
}
.gcell:hover .gcell__cap b { transform: none; }
.gcell:hover .gcell__cap em { transform: none; opacity: 1; }

/* the expand cue */
.gcell__zoom {
  position: absolute;
  top: 13px; right: 13px;
  z-index: 4;
  width: 32px; height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(6, 6, 10, .6);
  backdrop-filter: blur(6px);
  color: var(--gold-lt);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .4s var(--ease) .12s, transform .45s var(--ease) .12s;
}
.gcell:hover .gcell__zoom { opacity: 1; transform: none; }

.gcell.is-out { display: none; }

/* ---------------------------------------------------------------- lightbox */

.lbox {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: grid;
  grid-template-rows: 1fr auto;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
  background: rgba(4, 4, 7, .95);
  backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .45s var(--ease), visibility .45s;
}
.lbox.is-open { opacity: 1; visibility: visible; }

.lbox__frame {
  position: relative;
  max-width: min(1100px, 100%);
  max-height: 100%;
  display: grid;
  place-items: center;
}
.lbox__frame img {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
  transform: scale(.94);
  opacity: 0;
  transition: transform .55s var(--ease), opacity .45s var(--ease);
  box-shadow: 0 40px 120px -40px #000;
}
.lbox.is-open .lbox__frame img { transform: none; opacity: 1; }

.lbox__cap {
  margin-top: 22px;
  text-align: center;
  color: var(--ivory);
}
.lbox__cap b {
  display: block;
  font-family: var(--display);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 400;
}
.lbox__cap em {
  display: block;
  font-style: normal;
  font-size: .6rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 7px;
}
.lbox__count {
  margin-top: 12px;
  font-size: .68rem;
  letter-spacing: .2em;
  color: var(--mist-dim);
}

.lbox__btn {
  position: absolute;
  top: 50%;
  width: 52px; height: 52px;
  margin-top: -26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(6, 6, 10, .7);
  color: var(--gold-lt);
  cursor: pointer;
  transition: all .4s var(--ease);
  z-index: 2;
}
.lbox__btn:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.lbox__btn--prev { left: clamp(-8px, -2vw, 0px); }
.lbox__btn--next { right: clamp(-8px, -2vw, 0px); }

.lbox__x {
  position: fixed;
  top: clamp(14px, 3vw, 28px);
  right: clamp(14px, 3vw, 28px);
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(6, 6, 10, .7);
  color: var(--ivory);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all .4s var(--ease);
  z-index: 3;
}
.lbox__x:hover { border-color: var(--gold); color: var(--gold); transform: rotate(90deg); }

@media (max-width: 600px) {
  .lbox__btn { width: 42px; height: 42px; margin-top: -21px; }
  .lbox__btn--prev { left: 2px; }
  .lbox__btn--next { right: 2px; }
}

/* ---------------------------------------------------------------- misc */

/* the scope keeps its own hairline rules and empty state on brand */
.gscope .rule { background: var(--g-line); }
.gscope .gnote {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--g-hair);
  font-size: .78rem;
  letter-spacing: .06em;
  color: var(--g-dim);
  transition: color .8s var(--ease), border-color .8s var(--ease);
}

/* the section version sits between two dark bands, so give it a seam */
.gscope--section { border-block: 1px solid var(--g-line); }

@media (prefers-reduced-motion: reduce) {
  .gscope, .gscope * { transition-duration: .001ms !important; }
}

/* ==========================================================================
   Film tiles — the client's own footage of the house
   ========================================================================== */

/* the clip sits over the poster and only becomes visible once it is playing,
   so there is never a flash of black while it buffers */
.gcell__film {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .5s var(--ease);
  pointer-events: none;
}
.gcell.is-playing .gcell__film { opacity: 1; }
.gcell.is-playing img { opacity: 0; }
.gcell img { transition: transform 1.5s var(--ease), filter .8s var(--ease), opacity .5s var(--ease); }

/* a film tile keeps a standing cue so it reads as playable before you hover */
.gcell.is-film .gcell__zoom {
  opacity: .85;
  transform: none;
  background: rgba(6, 6, 10, .55);
}
.gcell.is-film:hover .gcell__zoom { opacity: 1; background: var(--gold); color: var(--ink); }

/* the thin gold progress hairline along the bottom while it plays */
.gcell.is-film::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  height: 2px;
  width: 100%;
  z-index: 5;
  background: linear-gradient(90deg, var(--gold-hi), var(--gold));
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform .4s var(--ease);
}
.gcell.is-film.is-playing::after { transform: scaleX(1); transition-duration: 8s; }

/* ---------------------------------------------------------- video lightbox */

.lbox__frame video {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  background: #000;
  box-shadow: 0 40px 120px -40px #000;
  transform: scale(.94);
  opacity: 0;
  transition: transform .55s var(--ease), opacity .45s var(--ease);
}
.lbox.is-open .lbox__frame video { transform: none; opacity: 1; }
.lbox__frame video[hidden] { display: none; }

/* Films open silent: this pill over the top-left corner turns the sound on.
   (The player's own volume control does the same and sets how loud.) */
.lbox__sound {
  position: absolute;
  top: 12px; left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 15px 9px 12px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: rgba(6, 6, 10, .78);
  backdrop-filter: blur(8px);
  color: var(--gold-lt);
  font-size: .64rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background .4s var(--ease), color .4s var(--ease), border-color .4s var(--ease);
}
.lbox__sound[hidden] { display: none; }
.lbox__sound span { display: inline-flex; align-items: center; }
.lbox__sound:hover { background: var(--gold); color: var(--ink); }
.lbox__sound-on { display: none !important; }
.lbox__sound[aria-pressed="true"] { border-color: var(--line); color: var(--ivory); }
.lbox__sound[aria-pressed="true"] .lbox__sound-on { display: inline-flex !important; }
.lbox__sound[aria-pressed="true"] .lbox__sound-off { display: none; }
.lbox__sound:focus-visible { outline: 1px solid var(--gold-hi); outline-offset: 3px; }
@media (max-width: 600px) { .lbox__sound { top: 8px; left: 8px; padding: 8px 12px 8px 10px; } }

/* ==========================================================================
   The occasions band — three celebration clips, side by side
   ========================================================================== */

.occasions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.3vw, 18px);
}
@media (max-width: 720px) { .occasions { grid-template-columns: 1fr; } }

.occasion {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  background: var(--ink-3);
  isolation: isolate;
  transition: border-color .5s var(--ease), box-shadow .6s var(--ease);
}
.occasion:hover { border-color: rgba(198, 161, 91, .45); box-shadow: 0 30px 70px -34px #000; }

.occasion video,
.occasion img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .5s var(--ease), transform 1.4s var(--ease);
}
/* The clip sits over the still and carries its own poster frame, so it can be
   visible from the start: these play on scroll rather than on hover, and
   fading them in on a class would only delay the first frame. The still
   underneath is what shows under prefers-reduced-motion, where the clip is
   display:none. */
.occasion video { opacity: 1; z-index: 1; }
.occasion:hover video,
.occasion:hover img { transform: scale(1.06); }

.occasion__cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  padding: 44px 20px 18px;
  background: linear-gradient(transparent, rgba(6, 6, 10, .9) 60%);
  pointer-events: none;
}
.occasion__cap b {
  display: block;
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--ivory);
}
.occasion__cap em {
  display: block;
  font-style: normal;
  font-size: .56rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--gold-lt);
  margin-bottom: 5px;
}

@media (prefers-reduced-motion: reduce) {
  .gcell__film, .occasion video, .rail__card video { display: none; }
}
