/**
 * Emé D5 Cut — five luxury effects + house gallery
 * 1. Editorial masonry (native ratios)
 * 2. Luxury focus dim
 * 3. Speaker restart with sound
 * 4. Clip-mask scroll reveals
 * 5. Still hero ken-burns
 */

/* ---------- 1. House gallery masonry (D5 denser scale) ---------- */
.eme-house-gallery {
  padding: 3rem 0 3.5rem;
  background: var(--eme-bg, #FAF7F2);
  color: var(--eme-fg, #1A1A1A);
}
.eme-house-gallery__head {
  max-width: 34rem;
  margin: 0 auto 1.75rem;
  padding: 0 1rem;
  text-align: center;
}
.eme-house-gallery__h {
  font-family: 'Cormorant Garamond', 'Cormorant', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.65rem, 3vw, 2.35rem);
  margin: 0.35rem 0 0.55rem;
  letter-spacing: -0.01em;
}
.eme-house-gallery__sub {
  margin: 0 auto;
  max-width: 28rem;
  color: var(--eme-muted, #4A4A4A);
  font-size: 0.84rem;
  line-height: 1.6;
}
/* Compact multi-column mosaic — tiles read small like D5 portfolio */
.eme-house-gallery__grid {
  column-count: 2;
  column-gap: 0.45rem;
  padding: 0 0.75rem;
  max-width: 980px;
  margin: 0 auto;
}
@media (min-width: 640px) {
  .eme-house-gallery__grid {
    column-count: 3;
    column-gap: 0.55rem;
    padding: 0 1rem;
  }
}
@media (min-width: 960px) {
  .eme-house-gallery__grid {
    column-count: 4;
    column-gap: 0.65rem;
    max-width: 1080px;
    padding: 0 1.25rem;
  }
}
@media (min-width: 1280px) {
  .eme-house-gallery__grid {
    column-count: 5;
    column-gap: 0.7rem;
    max-width: 1180px;
  }
}
.eme-house-gallery__item {
  break-inside: avoid;
  margin: 0 0 0.45rem;
  position: relative;
  transition: opacity 0.45s ease, filter 0.45s ease, transform 0.45s ease;
}
@media (min-width: 640px) {
  .eme-house-gallery__item { margin-bottom: 0.55rem; }
}
@media (min-width: 960px) {
  .eme-house-gallery__item { margin-bottom: 0.65rem; }
}
.eme-house-gallery__media {
  position: relative;
  overflow: hidden;
  background: #EDE8E0;
  border-radius: 0; /* D5 hard edge */
}
.eme-house-gallery__media img,
.eme-house-gallery__media video {
  display: block;
  width: 100%;
  height: auto; /* native ratios — never stretch */
  vertical-align: middle;
}
.eme-house-gallery__item--product .eme-house-gallery__media {
  background: #F3EEE6;
}

/* ---------- 2. Luxury focus dim (watch without interruption) ---------- */
.eme-house-gallery {
  position: relative;
}
.eme-house-gallery__veil {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(26, 22, 18, 0.55);
  backdrop-filter: blur(1.5px);
  -webkit-backdrop-filter: blur(1.5px);
  cursor: pointer;
  border: 0;
  padding: 0;
  width: 100%;
  height: 100%;
}
.eme-house-gallery.is-focusing .eme-house-gallery__veil {
  display: block;
}
.eme-house-gallery.is-focusing .eme-house-gallery__head {
  position: relative;
  z-index: 5;
  opacity: 0.45;
  transition: opacity 0.35s ease;
}
.eme-house-gallery.is-focusing .eme-house-gallery__grid {
  position: relative;
  z-index: 5;
}
.eme-house-gallery.is-focusing .eme-house-gallery__item:not(.is-focused) {
  opacity: 0.22;
  filter: saturate(0.7) brightness(0.85);
  pointer-events: none;
  transition: opacity 0.4s ease, filter 0.4s ease, transform 0.4s ease;
}
.eme-house-gallery__item.is-focused {
  z-index: 6;
  opacity: 1;
  filter: none;
  pointer-events: auto;
}
.eme-house-gallery.is-focusing .eme-house-gallery__item.is-focused {
  transform: translateZ(0) scale(1.02);
  box-shadow: 0 18px 48px rgba(26, 22, 18, 0.28);
}
.eme-house-gallery.is-focusing .eme-house-gallery__item.is-focused .eme-house-gallery__media {
  outline: 1px solid rgba(250, 247, 242, 0.35);
}

/* ---------- 3. Speaker control ---------- */
.eme-house-gallery__speaker {
  position: absolute;
  right: 0.4rem;
  bottom: 0.4rem;
  z-index: 3;
  width: 1.85rem;
  height: 1.85rem;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #FAF7F2;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.25s ease, transform 0.25s ease;
}
.eme-house-gallery__speaker:hover {
  background: rgba(26, 26, 26, 0.78);
  transform: scale(1.04);
}
.eme-house-gallery__item.is-sound-on .eme-house-gallery__speaker {
  background: rgba(148, 172, 133, 0.92);
  color: #1A1A1A;
}
.eme-house-gallery__item.is-sound-on .ico-muted { display: none; }
.eme-house-gallery__item.is-sound-on .ico-sound { display: block !important; }
.eme-house-gallery__item:not(.is-sound-on) .ico-sound { display: none !important; }

/* ---------- 4. Clip-mask scroll reveals (progressive: visible by default) ---------- */
.eme-reveal--clip,
.eme-mission.eme-reveal,
.eme-community.eme-reveal,
.eme-house-gallery.eme-reveal {
  clip-path: none;
  opacity: 1;
  transform: none;
}
.eme-reveal--clip.eme-reveal--animate,
.eme-mission.eme-reveal.eme-reveal--animate,
.eme-community.eme-reveal.eme-reveal--animate,
.eme-house-gallery.eme-reveal.eme-reveal--animate {
  clip-path: inset(8% 4% 8% 4%);
  opacity: 0.01;
  transform: translateY(28px);
  transition:
    clip-path 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.7s ease,
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.eme-reveal--clip.is-in,
.eme-reveal--clip.is-visible,
.eme-mission.eme-reveal.is-in,
.eme-mission.eme-reveal.is-visible,
.eme-community.eme-reveal.is-in,
.eme-community.eme-reveal.is-visible,
.eme-house-gallery.eme-reveal.is-in,
.eme-house-gallery.eme-reveal.is-visible {
  clip-path: inset(0 0 0 0);
  opacity: 1;
  transform: none;
}

/* Named Routines HoverGrid: no sibling dim (kept clear and bright) */

/* Product / avatar tile links + captions */
a.eme-hovergrid__img {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
a.eme-hovergrid__img:focus-visible {
  outline: 2px solid rgba(250, 247, 242, 0.85);
  outline-offset: 2px;
}
.eme-hovergrid__cap {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 1.6rem 0.75rem 0.65rem;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #FAF7F2;
  text-decoration: none;
  background: linear-gradient(to top, rgba(26, 22, 18, 0.72) 0%, rgba(26, 22, 18, 0.28) 55%, transparent 100%);
  pointer-events: none;
  transition: opacity 0.25s ease;
}
a.eme-hovergrid__img:hover .eme-hovergrid__cap,
a.eme-hovergrid__img:focus-visible .eme-hovergrid__cap {
  opacity: 1;
}
.eme-hovergrid .tile-product .eme-hovergrid__cap,
.eme-hovergrid .tile-secondary .eme-hovergrid__cap {
  font-size: 0.68rem;
  padding: 1.25rem 0.6rem 0.5rem;
}

/* ---------- 5. Still hero ken-burns ---------- */
.eme-hero--slides .eme-hero__slide {
  transform: scale(1.04);
  transition: opacity 1.2s ease, transform 8s ease-out;
}
.eme-hero--slides .eme-hero__slide.is-active {
  transform: scale(1);
}
.eme-hero--slides .eme-hero__slide.is-leaving {
  transform: scale(1.06);
}

/* Soft image lift (gallery stills + community) */
.eme-house-gallery__item--image .eme-house-gallery__media img,
.eme-community__tile img {
  transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.eme-house-gallery__item--image:hover .eme-house-gallery__media img,
.eme-community__tile:hover img {
  transform: scale(1.03);
}

@media (prefers-reduced-motion: reduce) {
  .eme-reveal--clip,
  .eme-mission.eme-reveal,
  .eme-community.eme-reveal,
  .eme-house-gallery.eme-reveal {
    clip-path: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .eme-hero--slides .eme-hero__slide,
  .eme-house-gallery__item,
  .eme-house-gallery__item--image .eme-house-gallery__media img,
  .eme-community__tile img,
  .eme-hovergrid .eme-hovergrid__img {
    transition: none !important;
    transform: none !important;
  }
  .eme-house-gallery.is-focusing .eme-house-gallery__item.is-focused {
    transform: none;
  }
}

/* Hero 10-still rotation — product vs character framing */
.eme-hero--slides .eme-hero__slide {
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
}
.eme-hero--slides .eme-hero__slide[data-focus="face"] {
  background-position: center 18%;
}
.eme-hero--slides .eme-hero__slide[data-focus="product"] {
  background-position: center center;
}

/* Hero HoverGrid-style clip reveals */
.eme-hero--slides.eme-hero--hovergrid .eme-hero__slide {
  opacity: 1 !important;
  transition: none;
  will-change: clip-path, transform, filter;
  background-size: cover;
  background-repeat: no-repeat;
}
.eme-hero--slides.eme-hero--hovergrid .eme-hero__slide.is-active {
  z-index: 2;
}
.eme-hero--slides.eme-hero--hovergrid .eme-hero__slide.is-leaving {
  z-index: 1;
}
@media (prefers-reduced-motion: reduce) {
  .eme-hero--slides.eme-hero--hovergrid .eme-hero__slide {
    clip-path: none !important;
    opacity: 0 !important;
    transform: none !important;
    filter: none !important;
  }
  .eme-hero--slides.eme-hero--hovergrid .eme-hero__slide.is-active {
    opacity: 1 !important;
  }
}
