/* css/facilities.css - the Facilities page: a featured photo slideshow with thumbnails and dots, a photo gallery below it, and a full-viewport viewer (js/facilities.js).
 * Both sit in the page's own section container (style.css `section`: 5% side padding, 1280px at most), the same content edges as the header and the homepage.
 * The photographs are real and uncropped in the slideshow and the viewer (object-fit: contain over a soft blurred copy of the same photo); the gallery keeps each
 * photo's own proportions (CSS columns, a box reserved from the photo's pixel size, so loading never moves the page). No captions are invented. */
/* The page hero (css/style.css .page-header) is now just the heading, centered: the same space above and below it (103px, 118px on narrow phones), and no margin under the
   heading since nothing follows it. */
.page-header.fac-hero { padding-top: 103px; padding-bottom: 103px; }
.page-header.fac-hero h1 { margin-bottom: 0; }
@media (max-width: 580px) { .page-header.fac-hero { padding-top: 118px; padding-bottom: 118px; } }

.fac-showcase, .fac-gallery { --fac-ratio: 4 / 3; }
.fac-showcase[hidden], .fac-gallery[hidden], .fac-dots[hidden], .fac-thumbs[hidden] { display: none; }
.fac-show { width: 100%; margin: 24px auto 0; }

/* ---------------------------------------------------------------- slideshow */
.fac-stage { position: relative; width: 100%; aspect-ratio: var(--fac-ratio); overflow: hidden; border-radius: var(--radius-lg); background: linear-gradient(160deg, #031c2d, #053b5c); box-shadow: var(--shadow-hover); isolation: isolate; touch-action: pan-y; }
.fac-slide { position: absolute; inset: 0; margin: 0; opacity: 0; visibility: hidden; transition: opacity 0.6s ease, visibility 0s linear 0.6s; }
.fac-slide.is-active { opacity: 1; visibility: visible; z-index: 1; transition: opacity 0.6s ease; }
.fac-bg { position: absolute; inset: -24px; background-size: cover; background-position: center; filter: blur(22px) saturate(1.1); opacity: 0.55; transform: scale(1.05); }
.fac-fg { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; user-select: none; -webkit-user-drag: none; }
.fac-skeleton { position: absolute; inset: 0; z-index: 2; background: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.09) 50%, rgba(255, 255, 255, 0) 70%) 0 0 / 200% 100%; animation: fac-shimmer 1.4s linear infinite; }
.fac-showcase.is-ready .fac-skeleton { display: none; }
@keyframes fac-shimmer { to { background-position: -200% 0; } }

.fac-btn { position: absolute; z-index: 3; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: rgba(3, 28, 45, 0.55); color: #fff; font-size: 1rem; cursor: pointer; backdrop-filter: blur(4px); transition: background-color 0.15s ease; }
.fac-btn:hover { background: rgba(3, 28, 45, 0.82); }
.fac-btn:disabled { opacity: 0.4; cursor: default; }
.fac-btn[hidden] { display: none; }
.fac-prev { left: 12px; top: 50%; transform: translateY(-50%); }
.fac-next { right: 12px; top: 50%; transform: translateY(-50%); }
.fac-full { top: 12px; right: 12px; }
.fac-play { top: 12px; right: 64px; }
.fac-count { position: absolute; z-index: 3; top: 12px; left: 12px; padding: 5px 11px; border-radius: 999px; background: rgba(3, 28, 45, 0.55); color: #fff; font-size: 0.8rem; font-weight: 600; font-variant-numeric: tabular-nums; backdrop-filter: blur(4px); }

.fac-dots { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; margin: 10px 0 0; }
.fac-dot { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.fac-dot::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: rgba(4, 41, 64, 0.22); transition: var(--transition-fast); }
.fac-dot[aria-current="true"]::before { width: 22px; border-radius: 8px; background: var(--secondary); }

.fac-thumbs { display: flex; gap: 8px; margin: 8px 0 0; padding: 2px 2px 8px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: thin; }
.fac-thumb { flex: none; width: 96px; height: 72px; padding: 0; border: 2px solid transparent; border-radius: 10px; overflow: hidden; background: #dfe7ec; cursor: pointer; scroll-snap-align: center; opacity: 0.72; transition: opacity 0.15s ease, border-color 0.15s ease; }
.fac-thumb:hover { opacity: 1; }
.fac-thumb[aria-current="true"] { opacity: 1; border-color: var(--primary); }
.fac-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }

.fac-btn:focus-visible, .fac-dot:focus-visible, .fac-thumb:focus-visible, .fac-tile:focus-visible, .fac-lb-btn:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- gallery: each photo keeps its own proportions */
.fac-masonry { columns: 2; column-gap: 12px; margin-top: 24px; }
.fac-tile { position: relative; display: block; width: 100%; margin: 0 0 12px; padding: 0; border: 0; border-radius: var(--radius); overflow: hidden; background: #dfe7ec; break-inside: avoid; cursor: zoom-in; box-shadow: var(--shadow-card, 0 2px 10px rgba(4, 41, 64, 0.12)); }
.fac-tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 0.45s ease; }
.fac-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(3, 28, 45, 0) 55%, rgba(3, 28, 45, 0.45)); opacity: 0; transition: opacity 0.25s ease; pointer-events: none; }
.fac-tile:hover img { transform: scale(1.04); }
.fac-tile:hover::after { opacity: 1; }

/* ---------------------------------------------------------------- viewer (a native modal <dialog>: Escape, focus containment and the dimmed page come with it) */
.fac-lightbox { width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(3, 14, 22, 0.96); color: #fff; overflow: hidden; }
.fac-lightbox:not([open]) { display: none; }
.fac-lightbox::backdrop { background: rgba(3, 14, 22, 0.96); }
.fac-lb-top { position: absolute; z-index: 2; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.fac-lb-count { font-size: 0.9rem; font-weight: 600; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.85); }
.fac-lb-btn { display: inline-grid; place-items: center; width: 48px; height: 48px; padding: 0; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 1.1rem; cursor: pointer; transition: background-color 0.15s ease; }
.fac-lb-btn:hover { background: rgba(255, 255, 255, 0.26); }
.fac-lb-btn:disabled { opacity: 0.35; cursor: default; }
.fac-lb-nav { position: absolute; z-index: 2; top: 50%; transform: translateY(-50%); }
.fac-lb-prev { left: 12px; }
.fac-lb-next { right: 12px; }
.fac-lb-fig { position: absolute; inset: 64px 72px 24px; margin: 0; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; touch-action: pan-y; }
.fac-lb-fig img { flex: 0 1 auto; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 6px; user-select: none; -webkit-user-drag: none; }
html.fac-lb-open { overflow: hidden; }

@media (min-width: 640px) { .fac-masonry { column-gap: 16px; } .fac-tile { margin-bottom: 16px; } .fac-thumb { width: 112px; height: 84px; } }
@media (min-width: 1000px) {
    .fac-masonry { columns: 3; }
    /* a wide stage that never grows taller than the screen: the width follows the available height */
    .fac-showcase, .fac-gallery { --fac-ratio: 16 / 9; }
    .fac-show { width: min(100%, calc((100vh - 150px) * 1.7778)); width: min(100%, calc((100svh - 150px) * 1.7778)); min-width: min(100%, 640px); }
}
@media (max-width: 560px) {
    .fac-lb-fig { inset: 60px 8px 76px; }
    .fac-lb-nav { top: auto; bottom: 14px; transform: none; }
    .fac-lb-prev { left: calc(50% - 60px); }
    .fac-lb-next { right: calc(50% - 60px); }
    .fac-btn { width: 40px; height: 40px; }
    .fac-prev { left: 8px; } .fac-next { right: 8px; }
    .fac-full { top: 8px; right: 8px; } .fac-play { top: 8px; right: 54px; } .fac-count { top: 8px; left: 8px; }
}
@media (prefers-reduced-motion: reduce) {
    .fac-slide, .fac-slide.is-active { transition: none; }
    .fac-skeleton { animation: none; }
    .fac-tile img, .fac-tile::after { transition: none; }
    .fac-tile:hover img { transform: none; }
}
