/* Filaro Collection - Gallery phone page (sandbox bring-back 10/Aug/26)
   Scoped to body[data-gallery-page]. Desktop books keep design drawer. */

body[data-gallery-page] {
  --gp-nav-h: 3.75rem;
  --gp-caption-h: 4.35rem;
  --gp-chips-h: 3.4rem;
  --muted: rgba(26, 20, 18, 0.55);
  overflow: hidden;
  background: var(--cream, #f7f5ef);
  color: var(--ink-dark, #1a1412);
  min-height: 100svh;
  min-height: 100dvh;
  position: relative !important;
  top: auto !important;
  width: auto !important;
  -webkit-tap-highlight-color: transparent;
}

/* Site nav - ink on cream */
body[data-gallery-page] .site-nav {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 60;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  max-width: 100%;
  height: var(--gp-nav-h);
  padding: 0.9rem var(--gutter, 1.25rem);
  color: var(--ink-dark, #1a1412);
  background: transparent;
}
body[data-gallery-page] .site-nav__brand-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}
body[data-gallery-page] .site-nav__brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: inherit;
}
body[data-gallery-page] .site-nav__logo {
  height: 1.25rem;
  width: auto;
  opacity: 0.95;
  filter: brightness(0);
}
body[data-gallery-page] .site-nav__address {
  margin: 0;
  line-height: 0;
  opacity: 0.9;
}
body[data-gallery-page] .site-nav__address-img {
  display: block;
  height: 1.05rem;
  width: auto;
  max-width: min(48vw, 11.5rem);
  filter: brightness(0);
}
body[data-gallery-page] .site-nav__book {
  display: flex;
  align-items: center;
  justify-content: center;
}
body[data-gallery-page] .site-nav__links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  font-size: calc(0.8125rem + 2px);
  font-weight: 500;
}
body[data-gallery-page] .site-nav__links a {
  text-decoration: none;
  opacity: 0.9;
  color: inherit;
}
body[data-gallery-page] .site-nav__end { justify-self: end; }
body[data-gallery-page] .site-nav__tools {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
body[data-gallery-page] .site-nav__sound-wrap { position: relative; }
body[data-gallery-page] .site-nav__sound {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
body[data-gallery-page] .site-nav__sound svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
body[data-gallery-page] .site-nav__sound .icon-unmuted { display: none; }
body[data-gallery-page] .site-nav__sound:not(.is-muted) .icon-muted { display: none; }
body[data-gallery-page] .site-nav__sound:not(.is-muted) .icon-unmuted { display: block; }
body[data-gallery-page] .site-nav__ot img {
  display: block;
  height: 0.85rem;
  width: auto;
  filter: brightness(0);
}

/* Stub drawer for hop mount - no visible chrome */
body[data-gallery-page] .design-drawer,
body[data-gallery-page] .design-drawer.is-open,
body[data-gallery-page] .design-drawer.is-page {
  position: fixed;
  inset: 0;
  z-index: 0;
  visibility: hidden;
  pointer-events: none;
  opacity: 0;
}

/* --- Phone layout: image first --- */
body[data-gallery-page] .gp-stage {
  position: fixed;
  z-index: 20;
  top: var(--gp-nav-h);
  right: 0;
  left: 0;
  bottom: calc(var(--gp-caption-h) + var(--gp-chips-h) + env(safe-area-inset-bottom, 0px));
  background: #e8e4dc;
  overflow: hidden;
  touch-action: none;
}
body[data-gallery-page] .gp-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
body[data-gallery-page] .gp-frame.is-panning { cursor: grabbing; }
body[data-gallery-page] .gp-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: translate(0px, 0px) scale(1);
  transform-origin: center center;
  opacity: 0;
  transition: opacity 0.55s cubic-bezier(0.32, 0.72, 0, 1);
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}
body[data-gallery-page] .gp-img.is-live { opacity: 1; }
body[data-gallery-page] .gp-img.is-instant { transition: none !important; }

body[data-gallery-page] .gp-caption {
  position: fixed;
  z-index: 40;
  right: 0;
  left: 0;
  bottom: calc(var(--gp-chips-h) + env(safe-area-inset-bottom, 0px));
  height: var(--gp-caption-h);
  padding: 0.55rem var(--gutter, 1.25rem) 0.35rem;
  background: var(--cream, #f7f5ef);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}
body[data-gallery-page] .gp-caption__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}
body[data-gallery-page] .gp-caption__label {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: var(--tracking-label, 0.1em);
  text-transform: uppercase;
}
body[data-gallery-page] .gp-caption__count {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.06em;
  color: var(--muted);
  flex-shrink: 0;
}
body[data-gallery-page] .gp-caption__note {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 300;
  letter-spacing: 0.012em;
  line-height: 1.35;
  color: var(--muted);
  max-width: 34rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body[data-gallery-page] .gp-chips {
  position: fixed;
  z-index: 40;
  right: 0;
  bottom: 0;
  left: 0;
  height: calc(var(--gp-chips-h) + env(safe-area-inset-bottom, 0px));
  padding: 0.35rem var(--gutter, 1.25rem) calc(0.55rem + env(safe-area-inset-bottom, 0px));
  background: var(--cream, #f7f5ef);
  display: flex;
  align-items: center;
  gap: 0.15rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
body[data-gallery-page] .gp-chips::-webkit-scrollbar { display: none; }
body[data-gallery-page] .gp-chip {
  appearance: none;
  flex: 0 0 auto;
  margin: 0;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.02em;
  cursor: pointer;
  position: relative;
}
body[data-gallery-page] .gp-chip.is-on { color: var(--ink-dark, #1a1412); }
body[data-gallery-page] .gp-chip.is-on::after {
  content: "";
  position: absolute;
  left: 0.7rem;
  right: 0.7rem;
  bottom: 0.2rem;
  height: 1px;
  background: var(--ink-dark, #1a1412);
}
body[data-gallery-page] .gp-chip--all {
  margin-left: auto;
  letter-spacing: var(--tracking-label, 0.1em);
  text-transform: uppercase;
  font-size: 0.68rem;
}

body[data-gallery-page] .gp-all {
  position: fixed;
  z-index: 35;
  top: var(--gp-nav-h);
  right: 0;
  bottom: calc(var(--gp-chips-h) + env(safe-area-inset-bottom, 0px));
  left: 0;
  display: none;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.5rem var(--gutter, 1.25rem) 1rem;
  background: var(--cream, #f7f5ef);
}
body[data-gallery-page].is-all .gp-all { display: block; }
body[data-gallery-page].is-all .gp-stage,
body[data-gallery-page].is-all .gp-caption { display: none; }
body[data-gallery-page] .gp-all__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}
body[data-gallery-page] .gp-all__card {
  appearance: none;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: #e8e4dc;
  cursor: pointer;
  overflow: hidden;
}
body[data-gallery-page] .gp-all__card img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

@media (max-width: 767px) {
  body[data-gallery-page] .site-nav {
    grid-template-columns: 1fr auto !important;
  }
  body[data-gallery-page] .site-nav__book,
  body[data-gallery-page] .site-nav__ot,
  body[data-gallery-page] .explore-nav__word {
    display: none !important;
  }
  body[data-gallery-page] .site-nav__end {
    grid-column: 2 !important;
    padding-left: 0.35rem !important;
  }
  body[data-gallery-page] .site-nav__address {
    display: block;
    margin-left: 0.2rem;
    margin-top: 0.28rem;
  }
  body[data-gallery-page] .explore-nav:not([data-chapter-nav]) .explore-nav__plus {
    color: var(--ink-dark, #1a1412);
  }
  body[data-gallery-page] .explore-nav:not([data-chapter-nav]) .explore-nav__plus::before,
  body[data-gallery-page] .explore-nav:not([data-chapter-nav]) .explore-nav__plus::after {
    background: var(--ink-dark, #1a1412);
  }
}

@media (min-width: 768px) {
  body[data-gallery-page] .explore-nav__item--current { opacity: 1; }
  /* Phone layout still shown - this page is phone Explore tool; desktop hops stay drawer on books */
  body[data-gallery-page] .gp-stage,
  body[data-gallery-page] .gp-caption,
  body[data-gallery-page] .gp-chips,
  body[data-gallery-page] .gp-all {
    max-width: 390px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 390px;
  }
  body[data-gallery-page] .gp-stage {
    transform: translateX(-50%);
  }
}
