/* Count-aware gallery; scoped so the existing profile layout stays untouched. */
.facility-detail .hero-grid>.hero-gallery[data-gallery-layout]{
 --gallery-height:clamp(280px,29vw,400px);
 display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);
 align-items:stretch;gap:10px;width:100%;min-width:0;position:static;
}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-main{position:relative;min-width:0;height:var(--gallery-height)}
.facility-detail .hero-gallery[data-gallery-layout] .hero-image{height:100%;min-height:0;margin:0;border-radius:16px}
.facility-detail .hero-gallery[data-gallery-layout] .hero-image img{display:block;width:100%;height:100%;object-fit:cover}
.facility-detail .hero-gallery[data-gallery-layout] .hero-image [data-hero-drag-panel]{display:none}
.facility-detail .hero-gallery[data-gallery-layout] .thumb-strip{
 display:grid;grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr));
 grid-auto-rows:auto;gap:10px;height:var(--gallery-height);max-height:none;min-width:0;margin:0;padding:0;overflow:visible;
}
.facility-detail .hero-gallery[data-gallery-layout] .thumb{
 position:relative;display:block;width:100%;min-width:0;height:100%;min-height:0;margin:0;padding:0;
 border-radius:12px;border:1px solid var(--border,#dfe8f5);overflow:hidden;touch-action:manipulation;
}
.facility-detail .hero-gallery[data-gallery-layout] .thumb img{display:block;width:100%;height:100%;object-fit:cover}
.facility-detail .hero-gallery[data-gallery-layout] .thumb.is-active{border-color:#2d63ff;box-shadow:0 0 0 2px rgba(45,99,255,.26)}
.facility-detail .hero-gallery[data-gallery-layout] .thumb-more{
 position:absolute;inset:0;z-index:2;display:flex;align-items:center;justify-content:center;
 padding:12px;background:rgba(15,23,42,.66);color:#fff;font-size:clamp(17px,2vw,25px);font-weight:700;
 text-align:center;overflow-wrap:anywhere;pointer-events:none;
}
.facility-detail .hero-grid>.hero-gallery[data-gallery-layout="single"],
.facility-detail .hero-grid>.hero-gallery[data-gallery-layout="empty"]{grid-template-columns:minmax(0,1fr)}
.facility-detail .hero-gallery[data-gallery-layout="single"] .hero-image img{object-fit:contain;background:#edf2f7}
.facility-detail .hero-grid>.hero-gallery[data-gallery-layout="duo"]{grid-template-columns:repeat(2,minmax(0,1fr))}
.facility-detail .hero-gallery[data-gallery-layout="duo"] .thumb-strip{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
.facility-detail .hero-grid>.hero-gallery[data-gallery-layout="trio"]{grid-template-columns:minmax(0,2fr) minmax(0,1fr)}
.facility-detail .hero-gallery[data-gallery-layout="trio"] .thumb-strip{grid-template-columns:minmax(0,1fr)}
.facility-detail .hero-gallery[data-gallery-layout="quad"] .thumb:first-child{grid-column:1/-1}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-nav{display:none}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-empty{
 display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;
 min-height:160px;padding:28px 20px;border:1px dashed var(--border,#dfe8f5);border-radius:16px;
 color:#526781;background:#f7f9fc;text-align:center;
}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-empty svg{width:28px;height:28px;color:#7488a5}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-empty strong{font-size:15px;color:var(--text,#142d50)}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-empty p{margin:0;font-size:13px;line-height:1.5}
.facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-status{
 position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0;
}
@media(max-width:980px) and (min-width:768px){
 .facility-detail .hero-grid>.hero-gallery[data-gallery-layout]{--gallery-height:300px;gap:8px}
 .facility-detail .hero-gallery[data-gallery-layout] .thumb-strip{gap:8px}
}
@media(max-width:767px){
 .facility-detail .hero-grid>.hero-gallery[data-gallery-layout]{grid-template-columns:minmax(0,1fr);gap:8px;--gallery-height:clamp(210px,62vw,360px)}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image{border-radius:12px;touch-action:pan-y pinch-zoom}
 /* Keep overlays still; only the three image planes follow the finger. */
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready]{overflow:hidden;isolation:isolate;background:#edf2f7;touch-action:pan-y pinch-zoom;transform:none;filter:none;transition:none}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready]>img{
  position:absolute;inset:0;display:block;pointer-events:none;user-select:none;-webkit-user-drag:none;
  opacity:1;transform:translate3d(var(--hero-drag-x,0px),0,0);transition:none;
 }
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready]>[data-hero-drag-panel="-1"]{transform:translate3d(calc(-100% + var(--hero-drag-x,0px)),0,0)}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready]>[data-hero-drag-panel="1"]{transform:translate3d(calc(100% + var(--hero-drag-x,0px)),0,0)}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready].is-settling>img{transition:transform .24s cubic-bezier(.22,.68,0,1)}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready].is-dragging>img{will-change:transform}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready]>.view-all{z-index:2}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready].is-awaiting-image::before{
  content:"";position:absolute;z-index:2;top:calc(50% - 16px);left:calc(50% - 12px);width:24px;height:24px;
  border:3px solid #c1cfee;border-top-color:#2d63ff;border-radius:50%;pointer-events:none;animation:heroGalleryLoading .8s linear infinite;
 }
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image[data-hero-drag-ready].is-awaiting-image::after{
  content:attr(data-hero-drag-loading);position:absolute;inset:auto;z-index:2;top:calc(50% + 20px);left:50%;
  width:max-content;max-width:80%;padding:6px 12px;border-radius:20px;background:rgba(255,255,255,.94);color:#142d50;
  font-size:12px;line-height:1.4;text-align:center;opacity:1;transform:translateX(-50%);pointer-events:none;transition:none;
 }
 .facility-detail .hero-gallery[data-gallery-layout] .thumb-strip{
  grid-template-columns:repeat(4,minmax(0,1fr));grid-template-rows:72px;
  gap:8px;height:72px;max-height:none;overflow:visible;scroll-snap-type:none;
 }
 .facility-detail .hero-gallery[data-gallery-layout] .thumb{grid-column:auto;flex:none;height:72px;min-height:44px;border-radius:9px}
 .facility-detail .hero-gallery[data-gallery-layout="trio"] .thumb-strip{grid-template-columns:repeat(2,minmax(0,1fr))}
 .facility-detail .hero-gallery[data-gallery-layout="quad"] .thumb-strip{grid-template-columns:repeat(3,minmax(0,1fr))}
 .facility-detail .hero-gallery[data-gallery-layout="quad"] .thumb:first-child{grid-column:auto}
 .facility-detail .hero-gallery[data-gallery-layout="duo"] .thumb-strip{display:none}
 .facility-detail .hero-gallery[data-gallery-layout] .thumb-more{font-size:16px;padding:6px}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-nav{
  position:absolute;top:50%;z-index:3;display:inline-flex;align-items:center;justify-content:center;
  width:44px;height:44px;padding:0;border:1px solid rgba(255,255,255,.65);border-radius:50%;
  background:rgba(15,23,42,.78);color:#fff;cursor:pointer;transform:translateY(-50%);touch-action:manipulation;
  transition:background .18s ease;
 }
 .facility-detail .hero-gallery[data-gallery-layout] [data-hero-gallery-prev]{left:10px}
 .facility-detail .hero-gallery[data-gallery-layout] [data-hero-gallery-next]{right:10px}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-nav svg{width:22px;height:22px;pointer-events:none}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-nav:hover{background:#142d50}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-nav:focus-visible{outline:3px solid #2d63ff;outline-offset:3px}
 .facility-detail .hero-gallery[data-gallery-layout] .view-all{left:10px;bottom:10px;max-width:calc(100% - 20px);padding:7px 10px;font-size:12px;line-height:1.4;flex-wrap:wrap}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-count{display:inline;font-variant-numeric:tabular-nums}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-label{display:none}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-swipe-hint{display:inline;color:#fff}
 .facility-detail .hero-gallery[data-gallery-layout="single"] .hero-gallery-label{display:inline}
 .facility-detail .hero-gallery[data-gallery-layout="single"] .hero-gallery-count{display:none}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-gallery-empty{min-height:140px;padding:22px 16px}
}
@keyframes heroGalleryLoading{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){
 .facility-detail .hero-gallery[data-gallery-layout] :is(.gallery-trigger,.hero-gallery-nav,.hero-image img){transition:none!important}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image.is-changing:not([data-hero-drag-ready]) img{opacity:1;transform:none}
 .facility-detail .hero-gallery[data-gallery-layout] .hero-image.is-awaiting-image::before{animation:none}
}
