/* Shared by gallery-modal.php and inspection-modal.php */

.gallery-modal, .inspection-modal {
	position: fixed;
	inset: 0;
	z-index: -100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 40px 20px;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	/* visibility/z-index are delayed on close (stay in their "open" state
	   through the fade-out) but instant on open — WebKit ignores
	   pointer-events:none on nested cross-origin iframes (the Pacetas
	   embed), so visibility:hidden + a negative z-index (sinking it behind
	   the page's own stacking context) is what actually stops the hidden
	   modal's iframe from swallowing taps/typing meant for the page
	   underneath. */
	transition: opacity 0.25s ease, visibility 0s linear 0.25s, z-index 0s linear 0.25s;
}
.gallery-modal.is-open, .inspection-modal.is-open {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	z-index: 200;
	transition: opacity 0.25s ease, visibility 0s linear 0s, z-index 0s linear 0s;
}

.gallery-modal__overlay, .inspection-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(10,10,9,0.85);
}

.gallery-modal__dialog {
	position: relative;
	background: var(--ink);
	color: var(--cream);
	max-width: 1920px;
	width: 100%;
	max-height: 88vh;
	overflow-y: auto;
	border-radius: 6px;
	transform: scale(0.96) translateY(12px);
	transition: transform 0.25s ease;
}
.inspection-modal__dialog {
	position: relative;
	background: var(--dark-card);
	color: var(--cream);
	max-width: 620px;
	width: 100%;
	max-height: 88vh;
	overflow-y: auto;
	border-radius: 6px;
	padding: 40px;
	transform: scale(0.96) translateY(12px);
	transition: transform 0.25s ease;
}
.gallery-modal.is-open .gallery-modal__dialog,
.inspection-modal.is-open .inspection-modal__dialog {
	transform: scale(1) translateY(0);
}

.gallery-modal__close, .inspection-modal__close {
	position: absolute;
	top: 20px; right: 20px;
	z-index: 2;
	display: flex; align-items: center; justify-content: center;
	background: rgba(245,241,235,0.08);
	color: var(--cream);
}
.gallery-modal__close { width: 36px; height: 36px; border-radius: 50%; }
.gallery-modal__close svg { width: 16px; height: 16px; }
.inspection-modal__close { width: 44px; height: 44px; border-radius: 0; }
.inspection-modal__close svg { width: 20px; height: 20px; }

/* 65/35 media-to-sidebar split — fr units (not %) so .gallery-modal__panel's
   own gap doesn't throw the math off, same reasoning as every other grid
   ratio in this codebase. */
.gallery-modal__panel { display: none; grid-template-columns: 65fr 35fr; }
.gallery-modal__panel.is-active { display: grid; }

.gallery-modal__media { padding: 24px; }
/* max-height keeps the main image from growing unbounded now that the
   dialog can stretch to 1920px wide — without it, a 4:3 box at that width
   would be taller than the 88vh dialog itself, pushing .gallery-modal__thumbs
   (and the sidebar) out of view below the fold. object-fit:cover on the img
   means this just crops slightly tighter on very wide screens instead. */
/* position:relative makes this the anchor for .gallery-lightbox__nav's
   position:absolute — without it, the buttons anchor to .gallery-modal__dialog
   (the nearest positioned ancestor otherwise), which spans the full width
   including the sidebar, so "next" ends up pinned to the dialog's edge
   instead of the main image's. */
.gallery-modal__main { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 55vh; border-radius: 4px; overflow: hidden; margin-bottom: 16px; }
.gallery-modal__main img, .gallery-modal__main-placeholder { width: 100%; height: 100%; object-fit: cover; }
.gallery-modal__main-placeholder { background: var(--dark-card); }
/* Capped + independently scrollable so a long thumbnail strip never grows
   past this and pushes the main image (or the sidebar) out of view either —
   .gallery-modal__main and .gallery-modal__thumbs always stay visible together. */
.gallery-modal__thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-height: 120px; overflow-y: auto; }
.gallery-modal__thumb { aspect-ratio: 1; border-radius: 3px; overflow: hidden; opacity: 0.7; border: 2px solid transparent; transition: opacity 0.2s ease, border-color 0.2s ease; }
.gallery-modal__thumb:hover { opacity: 1; }
.gallery-modal__thumb.is-active { opacity: 1; border-color: var(--gold); }
.gallery-modal__thumb img { width: 100%; height: 100%; object-fit: cover; }

.gallery-modal__sidebar { background: var(--dark-card); padding: 32px; display: flex; flex-direction: column; }
.gallery-modal__title { font-size: 22px; margin-bottom: 12px; }
.gallery-modal__desc { color: var(--cream-dim); font-size: 14px; margin-bottom: 24px; }
.gallery-modal__inspection-types { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.gallery-modal__inspection-type { border-top: 1px solid var(--border-dark); padding-top: 12px; display: flex; flex-direction: column; gap: 2px; }
.gallery-modal__inspection-type-title { font-size: 14px; font-weight: 500; }
.gallery-modal__inspection-type-desc { font-size: 12px; color: var(--cream-dim); }
.gallery-modal__cta { margin-top: auto; text-align: center; }

/* Inspection booking modal ---------------------------------------------------
   Header is ours; the form itself is a Pacetas hosted iframe embed (see
   template-parts/modals/inspection-modal.php). */

.inspection-modal__eyebrow { display: block; color: var(--gold); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 16px; }
.inspection-modal__title { font-size: clamp(28px, 3.2vw, 40px); text-transform: uppercase; margin: 0 0 20px; }
.inspection-modal__subtext { color: var(--cream-dim); font-size: 15px; line-height: 1.6; margin: 0 0 32px; }

.inspection-modal__crm-embed { width: 100%; height: 502px; }
.inspection-modal__crm-embed iframe { display: block; }

@media (max-width: 768px) {
	.gallery-modal__panel.is-active { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
	.inspection-modal__dialog { padding: 16px; }
}
