/* Findar V46178 — complete property gallery + Photos tab SAFE patch. */

/* V46179 SAFE — dynamic sticky stack offset, shared by every navigable section. */
body.findar-mobile-premium-single #photos,
body.findar-mobile-premium-single #fmp-tab-apercu,
body.findar-mobile-premium-single #fmp-tab-analyse,
body.findar-mobile-premium-single #fmp-tab-description,
body.findar-mobile-premium-single #fmp-tab-caracteristiques,
body.findar-mobile-premium-single #fmp-tab-quartier,
body.findar-mobile-premium-single #fmp-tab-ensoleillement,
body.single-propriete #photos,
body.single-propriete #fmp-tab-apercu,
body.single-propriete #fmp-tab-analyse,
body.single-propriete #fmp-tab-description,
body.single-propriete #fmp-tab-caracteristiques,
body.single-propriete #fmp-tab-quartier,
body.single-propriete #fmp-tab-ensoleillement{
  scroll-margin-top:var(--fmp78-anchor-offset,220px)!important;
}

body.findar-mobile-premium-single .fmp16a-sticky-tabs,
body.single-propriete .fmp16a-sticky-tabs{
  flex-wrap:nowrap!important;
  overflow-x:auto!important;
  overflow-y:hidden!important;
  -webkit-overflow-scrolling:touch;
  overscroll-behavior-x:contain;
  scrollbar-width:none!important;
}

body.findar-mobile-premium-single .fmp16a-sticky-tabs::-webkit-scrollbar,
body.single-propriete .fmp16a-sticky-tabs::-webkit-scrollbar{
  display:none!important;
}

body.findar-mobile-premium-single .fmp16a-sticky-tabs > a,
body.single-propriete .fmp16a-sticky-tabs > a{
  flex:0 0 auto!important;
  white-space:nowrap!important;
}

body.fmp78-lightbox-open{overflow:hidden!important}

.fmp78-lightbox{
  position:fixed;
  inset:0;
  z-index:1000000;
  display:grid;
  grid-template-columns:minmax(48px,84px) minmax(0,1fr) minmax(48px,84px);
  align-items:center;
  gap:12px;
  padding:clamp(16px,3vw,36px);
  background:rgba(4,10,22,.94);
  color:#fff;
  font-family:Outfit,Inter,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
}

.fmp78-lightbox[hidden]{display:none!important}

.fmp78-lightbox figure{
  min-width:0;
  max-width:min(1200px,100%);
  max-height:calc(100vh - 72px);
  margin:0 auto;
  display:grid;
  justify-items:center;
  gap:12px;
}

.fmp78-lightbox img{
  display:block;
  max-width:100%;
  max-height:calc(100vh - 112px);
  width:auto;
  height:auto;
  object-fit:contain;
  border-radius:12px;
  box-shadow:0 24px 70px rgba(0,0,0,.42);
}

.fmp78-lightbox figcaption{
  min-height:28px;
  padding:5px 11px;
  border-radius:999px;
  background:rgba(255,255,255,.13);
  font-size:13px;
  font-weight:750;
  line-height:18px;
}

.fmp78-lightbox button{
  display:inline-grid;
  place-items:center;
  width:52px;
  height:52px;
  padding:0;
  border:1px solid rgba(255,255,255,.28);
  border-radius:999px;
  background:rgba(255,255,255,.12);
  color:#fff;
  font:700 38px/1 Outfit,Inter,sans-serif;
  cursor:pointer;
  backdrop-filter:blur(12px);
}

.fmp78-lightbox button:hover,
.fmp78-lightbox button:focus-visible{
  background:#fff;
  color:#071226;
  outline:3px solid rgba(22,93,255,.72);
  outline-offset:3px;
}

.fmp78-lightbox-close{
  position:absolute;
  top:18px;
  right:18px;
  width:46px!important;
  height:46px!important;
  font-size:30px!important;
}

.fmp78-lightbox-prev{justify-self:start}
.fmp78-lightbox-next{justify-self:end}

@media (max-width:780px){
  .fmp78-lightbox{
    grid-template-columns:44px minmax(0,1fr) 44px;
    gap:5px;
    padding:62px 8px 22px;
  }
  .fmp78-lightbox button{
    width:42px;
    height:42px;
    font-size:31px;
  }
  .fmp78-lightbox-close{top:10px;right:10px}
  .fmp78-lightbox img{
    max-height:calc(100vh - 132px);
    border-radius:8px;
  }
}

@media (prefers-reduced-motion:reduce){
  .fmp78-lightbox *{scroll-behavior:auto!important;transition:none!important}
}

/* ============================================================
   Findar V46187 — persistent Redfin-inspired PDP navigation SAFE.
   Presentation only: no data, CPT, routing, contact or WhatsApp changes.
   ============================================================ */
body.findar-mobile-premium-single .fmp16a-sticky-tabs,
body.single-propriete .fmp16a-sticky-tabs{
  width:100%!important;
  min-height:54px!important;
  display:flex!important;
  align-items:center!important;
  gap:2px!important;
  padding:0 clamp(8px,1vw,14px)!important;
  border-top:1px solid #e5eaf0!important;
  border-bottom:1px solid #e5eaf0!important;
  border-radius:0!important;
  background:rgba(255,255,255,.99)!important;
  box-shadow:none!important;
  -webkit-backdrop-filter:blur(14px)!important;
  backdrop-filter:blur(14px)!important;
}

body.findar-mobile-premium-single .fmp16a-sticky-tabs > a,
body.single-propriete .fmp16a-sticky-tabs > a{
  position:relative!important;
  min-height:54px!important;
  padding:0 16px!important;
  color:#475569!important;
  font-size:14px!important;
  line-height:1!important;
  font-weight:750!important;
  text-decoration:none!important;
}

body.findar-mobile-premium-single .fmp16a-sticky-tabs > a:hover,
body.findar-mobile-premium-single .fmp16a-sticky-tabs > a.is-active,
body.single-propriete .fmp16a-sticky-tabs > a:hover,
body.single-propriete .fmp16a-sticky-tabs > a.is-active{
  color:#087a4b!important;
}

body.findar-mobile-premium-single .fmp16a-sticky-tabs > a::after,
body.single-propriete .fmp16a-sticky-tabs > a::after{
  left:16px!important;
  right:16px!important;
  bottom:0!important;
  height:3px!important;
}

/* Authoritative sticky state: compact property summary first, section rail immediately below. */
body.findar-mobile-premium-single.fmp16d-is-stuck:not(.fmp16d-at-end) .fmp16a-sticky-tabs,
body.single-propriete.fmp16d-is-stuck:not(.fmp16d-at-end) .fmp16a-sticky-tabs{
  position:fixed!important;
  top:calc(var(--fmp78-admin-h,0px) + var(--fmp78-header-h,74px) + var(--fmp78-summary-h,74px))!important;
  left:0!important;
  right:0!important;
  z-index:99979!important;
  width:100%!important;
  min-height:var(--fmp78-tabs-h,54px)!important;
  height:var(--fmp78-tabs-h,54px)!important;
  padding-left:max(18px,calc((100vw - 1480px)/2 + 16px))!important;
  padding-right:max(18px,calc((100vw - 1480px)/2 + 16px))!important;
  border-top:1px solid rgba(226,232,240,.84)!important;
  border-bottom:1px solid rgba(226,232,240,.98)!important;
  background:rgba(255,255,255,.99)!important;
  box-shadow:0 8px 22px rgba(15,23,42,.06)!important;
  visibility:visible!important;
  opacity:1!important;
}

/* Fallback only when the newer conditional controller is not managing the page. */
body.findar-mobile-premium-single.fmp-single-scroll-ready:not(.fmp16d-managed) .fmp16a-sticky-tabs,
body.single-propriete.fmp-single-scroll-ready:not(.fmp16d-managed) .fmp16a-sticky-tabs{
  position:fixed!important;
  top:calc(var(--fmp78-admin-h,0px) + var(--fmp78-header-h,74px) + var(--fmp78-summary-h,74px))!important;
  left:0!important;
  right:0!important;
  z-index:99979!important;
  visibility:visible!important;
  opacity:1!important;
}

@media (min-width:981px){
  /* Redfin principle: one dominant photo, a clean secondary image wall. */
  body.findar-mobile-premium-single .fmp-trulia-gallery,
  body.single-propriete .fmp-trulia-gallery{
    display:grid!important;
    grid-template-columns:minmax(0,1.65fr) minmax(380px,.95fr)!important;
    grid-template-rows:minmax(0,1fr)!important;
    gap:8px!important;
    height:clamp(440px,39vw,575px)!important;
    min-height:440px!important;
    margin-bottom:26px!important;
    border-radius:14px!important;
    overflow:hidden!important;
    background:#eef2f6!important;
    box-shadow:none!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-gallery-main,
  body.findar-mobile-premium-single .fmp-trulia-gallery-tile,
  body.single-propriete .fmp-trulia-gallery-main,
  body.single-propriete .fmp-trulia-gallery-tile{
    min-width:0!important;
    min-height:0!important;
    height:auto!important;
    border:0!important;
    border-radius:0!important;
    overflow:hidden!important;
    background:#e9eef4!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-gallery-side,
  body.single-propriete .fmp-trulia-gallery-side{
    display:grid!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-template-rows:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    min-width:0!important;
    min-height:0!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-gallery img,
  body.single-propriete .fmp-trulia-gallery img{
    display:block!important;
    width:100%!important;
    height:100%!important;
    object-fit:cover!important;
    object-position:center!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:only-child,
  body.single-propriete .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:only-child{
    grid-column:1/-1!important;
    grid-row:1/-1!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:first-child:nth-last-child(2),
  body.findar-mobile-premium-single .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:first-child:nth-last-child(2) ~ .fmp-trulia-gallery-tile,
  body.single-propriete .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:first-child:nth-last-child(2),
  body.single-propriete .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:first-child:nth-last-child(2) ~ .fmp-trulia-gallery-tile{
    grid-row:1/-1!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:nth-child(3):last-child,
  body.single-propriete .fmp-trulia-gallery-side .fmp-trulia-gallery-tile:nth-child(3):last-child{
    grid-column:1/-1!important;
  }

  /* Keep seller actions available while reading long sections, like a real product page. */
  body.findar-mobile-premium-single .fmp16e-body-layout .fmp-trulia-sidecol,
  body.findar-mobile-premium-single .fmp-trulia-sidecol,
  body.single-propriete .fmp16e-body-layout .fmp-trulia-sidecol,
  body.single-propriete .fmp-trulia-sidecol{
    position:sticky!important;
    top:calc(var(--fmp78-admin-h,0px) + var(--fmp78-header-h,74px) + var(--fmp78-summary-h,74px) + var(--fmp78-tabs-h,54px) + 16px)!important;
    align-self:start!important;
  }
}

@media (max-width:780px){
  body.findar-mobile-premium-single .fmp16a-sticky-tabs,
  body.single-propriete .fmp16a-sticky-tabs{
    min-height:50px!important;
    height:50px!important;
    gap:18px!important;
    padding:0 12px!important;
  }

  body.findar-mobile-premium-single .fmp16a-sticky-tabs > a,
  body.single-propriete .fmp16a-sticky-tabs > a{
    min-height:50px!important;
    padding:0 3px!important;
    font-size:13px!important;
  }

  body.findar-mobile-premium-single .fmp16a-sticky-tabs > a::after,
  body.single-propriete .fmp16a-sticky-tabs > a::after{
    left:3px!important;
    right:3px!important;
  }

  body.findar-mobile-premium-single.fmp16d-is-stuck:not(.fmp16d-at-end) .fmp16a-sticky-tabs,
  body.single-propriete.fmp16d-is-stuck:not(.fmp16d-at-end) .fmp16a-sticky-tabs{
    top:calc(var(--fmp78-admin-h,0px) + var(--fmp78-header-h,64px) + var(--fmp78-summary-h,62px))!important;
    height:50px!important;
    min-height:50px!important;
    padding-left:12px!important;
    padding-right:12px!important;
  }

  body.findar-mobile-premium-single .fmp-trulia-sidecol,
  body.single-propriete .fmp-trulia-sidecol{
    position:static!important;
    top:auto!important;
  }
}
