﻿/**
 * simplydwell/home-gallery
 * ─ .sd-hhead  : plan/spec header bar (plan name, price, logo, spec address)
 * ─ .sd-hgal   : 3-up image strip with prev/next slider (Figma spec)
 * ─ .sd-hgal-lb: full-screen lightbox (injected by view.js)
 */
.sd-hhead {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: start;
	gap: 20px 40px;
	box-sizing: border-box;
	padding: 36px var( --nc-content-gutter, 60px ) 26px;
}

.sd-hhead__col {
	min-width: 0;
}

/* Pin each column so the right block (status/address) stays right even when the
   community logo is absent — otherwise the omitted center column lets the right
   column collapse into the middle, taking the logo's place. */
.sd-hhead__left {
	grid-column: 1;
}

.sd-hhead__logo {
	grid-column: 2;
}

.sd-hhead__right {
	grid-column: 3;
}

/* Fonts match the legacy: Gotham (sans) for series/price/sq-ft/address/links, Vollkorn
   (serif) for the plan name + status; all regular weight, navy; price/sq-ft/status are
   uppercased like the legacy. */
.sd-hhead__series {
	margin: 0 0 8px;
	font-family: 'Lexend', sans-serif;
	font-size: 16px;
	font-weight: 400;
	text-transform: uppercase;
	color: #1F242E;
}

.sd-hhead__name {
	margin: 0 0 16px;
	font-family: 'Lexend', sans-serif;
	font-size: 32px;
	font-weight: 400;
	line-height: 1.1;
	text-transform: uppercase;
	color: #1F242E;
}

.sd-hhead__price {
	margin: 0 0 16px;
	font-family: 'Lexend', sans-serif;
	font-size: 24px;
	font-weight: 400;
	text-transform: uppercase;
	color: #1F242E;
}

.sd-hhead__sqft {
	margin: 0 0 16px;
	font-family: 'Lexend', sans-serif;
	font-size: 16px;
	font-weight: 400;
	text-transform: uppercase;
	color: #1F242E;
}

.sd-hhead__logo {
	display: flex;
	align-items: center;
	justify-content: center;
}

.sd-hhead__logo img {
	width: auto;
	height: auto;
	max-width: 240px;
	max-height: 160px;
	object-fit: contain;
}

/* The logo links back to its community — a quiet hover so it reads as clickable. */
.sd-hhead__logo-link {
	display: inline-flex;
	transition: opacity 0.15s ease;
}

.sd-hhead__logo-link:hover,
.sd-hhead__logo-link:focus-visible {
	opacity: 0.75;
	outline: none;
}

.sd-hhead__right {
	text-align: right;
}

.sd-hhead__status {
	margin: 0 0 10px;
	font-family: 'Lexend', sans-serif;
	font-size: 21px;
	font-weight: 400;
	line-height: 1.2;
	text-transform: uppercase;
	color: #1F242E;
}

/* "Expected completion July, 2026" — the quick move-in ready-by date, in brand blue so it
   lifts above the plain navy address lines below it. */
.sd-hhead__ready {
	margin: 0 0 12px;
	font-family: 'Lexend', sans-serif;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
	color: #2a5f9e;
}

.sd-hhead__addr {
	margin: 0 0 4px;
	font-family: 'Lexend', sans-serif;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.45;
	color: #1F242E;
}

/* The orange uppercase "View Plan ›" / "Visit The Home ›" links (legacy style). */
.sd-hhead__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 10px;
	font-family: 'Lexend', sans-serif;
	font-size: 14px;
	font-weight: 400;
	text-transform: uppercase;
	color: #ea6e24;
	text-decoration: none;
}

.sd-hhead__link::after {
	content: "\203A"; /* › */
	font-size: 1.25em;
	line-height: 1;
}

.sd-hhead__link:hover,
.sd-hhead__link:focus-visible {
	text-decoration: underline;
	text-underline-offset: 3px;
}

@media ( max-width: 860px ) {
	.sd-hhead {
		grid-template-columns: 1fr;
		justify-items: center;
		text-align: center;
		gap: 16px;
		padding-top: 26px;
	}

	.sd-hhead__left,
	.sd-hhead__logo,
	.sd-hhead__right {
		grid-column: auto;
	}

	.sd-hhead__logo {
		order: -1;
	}

	.sd-hhead__right {
		text-align: center;
	}

	.sd-hhead__link {
		justify-content: center;
	}
}

/* =============================================================================
   Gallery strip — .sd-hgal
   Figma: bg #FAF8F5, 4px padding top/bottom, 4px gap between images, 400px tall
   ============================================================================= */

.sd-hgal {
	position: relative;
	background: #FAF8F5;
	padding: 4px 0;
	overflow: hidden;
}

/* The overflow-clipping wrapper sits above the arrows so arrows overlay the edge */
.sd-hgal__track-wrap {
	overflow: hidden;
	width: 100%;
}

/* The sliding flex row — transform driven by view.js */
.sd-hgal__track {
	display: flex;
	flex-direction: row;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0;
	transition: transform 0.35s cubic-bezier( 0.4, 0, 0.2, 1 );
	will-change: transform;
}

/* Each item: exactly one-third of the visible width */
.sd-hgal__item {
	flex: 0 0 calc( ( 100% - 8px ) / 3 ); /* (total - 2 gaps) / 3 */
	height: clamp( 280px, 38vw, 420px );
	min-width: 0;
}

/* The clickable thumbnail button */
.sd-hgal__thumb {
	all: unset;
	display: block;
	width: 100%;
	height: 100%;
	cursor: zoom-in;
	overflow: hidden;
}

.sd-hgal__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.3s ease;
}

.sd-hgal__thumb:hover img,
.sd-hgal__thumb:focus-visible img {
	transform: scale( 1.04 );
}

.sd-hgal__thumb:focus-visible {
	outline: 3px solid #EA6E24;
	outline-offset: -3px;
}

/* Prev / next arrows */
.sd-hgal__arrow {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba( 31, 36, 46, 0.72 );
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease, opacity 0.2s ease;
}

.sd-hgal__arrow:hover {
	background: rgba( 31, 36, 46, 0.92 );
}

.sd-hgal__arrow:disabled {
	opacity: 0.3;
	cursor: default;
	pointer-events: none;
}

.sd-hgal__arrow--prev { left: 12px; }
.sd-hgal__arrow--next { right: 12px; }

.sd-hgal__arrow svg {
	display: block;
	width: 20px;
	height: 20px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* =============================================================================
   Lightbox — .sd-hgal-lb  (injected to <body> by view.js)
   ============================================================================= */

.sd-hgal-lb {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 99999;
	align-items: center;
	justify-content: center;
}

.sd-hgal-lb.is-open {
	display: flex;
}

.sd-hgal-lb__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.88 );
}

.sd-hgal-lb__inner {
	position: relative;
	z-index: 1;
	display: flex;
	align-items: center;
	gap: 16px;
	max-width: 100vw;
	max-height: 100vh;
	padding: 16px;
	box-sizing: border-box;
}

.sd-hgal-lb__figure {
	margin: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	max-width: calc( 100vw - 160px );
	max-height: calc( 100vh - 80px );
}

.sd-hgal-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc( 100vh - 80px );
	object-fit: contain;
	border-radius: 2px;
}

/* Close button — top-right corner */
.sd-hgal-lb__close {
	position: absolute;
	top: 12px;
	right: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, 0.15 );
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease;
}

.sd-hgal-lb__close:hover {
	background: rgba( 255, 255, 255, 0.3 );
}

.sd-hgal-lb__close:focus-visible {
	outline: 2px solid #EA6E24;
	outline-offset: 2px;
}

/* Prev / next navigation */
.sd-hgal-lb__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 52px;
	height: 52px;
	padding: 0;
	border: 2px solid rgba( 255, 255, 255, 0.4 );
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
}

.sd-hgal-lb__nav:hover {
	border-color: #fff;
	background: rgba( 255, 255, 255, 0.12 );
}

.sd-hgal-lb__nav:focus-visible {
	outline: 2px solid #EA6E24;
	outline-offset: 2px;
}

/* Photo counter — 2 ∕ 12 */
.sd-hgal-lb__counter {
	position: absolute;
	bottom: 20px;
	left: 50%;
	transform: translateX( -50% );
	color: rgba( 255, 255, 255, 0.75 );
	font-family: 'Lexend', sans-serif;
	font-size: 14px;
	font-weight: 400;
	letter-spacing: 0.05em;
	pointer-events: none;
}

/* =============================================================================
   Gallery tabs — .sd-hgal-tabs
   Only rendered when a plan/spec has BOTH its own photos and a linked model
   gallery; a single-source gallery stays a bare .sd-hgal strip as before.
   ============================================================================= */
.sd-hgal-tabs {
	background: #FAF8F5;
}

.sd-hgal-tabs__list {
	display: flex;
	flex-direction: row;
	align-items: stretch;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	padding: 20px var( --nc-content-gutter, 60px ) 0;
	margin-bottom: 30px;
}

.sd-hgal-tabs__tab {
	all: unset;
	box-sizing: border-box;
	padding: 12px 28px;
	border: 1.5px solid #DCD6CD;
	border-radius: 31px;
	font-family: 'Lexend', sans-serif;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
	color: #737A87;
	cursor: pointer;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.sd-hgal-tabs__tab:hover {
	border-color: #EA6E24;
	color: #EA6E24;
}

.sd-hgal-tabs__tab.is-active {
	background: #EA6E24;
	border-color: #EA6E24;
	color: #FFFFFF;
}

.sd-hgal-tabs__tab:focus-visible {
	outline: 2px solid #E2BB61;
	outline-offset: 2px;
}

/* The panel wraps a .sd-hgal strip, which brings its own background/padding. */
.sd-hgal-tabs__panel {
	margin-top: 16px;
}

.sd-hgal-tabs__panel:focus-visible {
	outline: 2px solid #E2BB61;
	outline-offset: -2px;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media ( max-width: 860px ) {
	.sd-hgal__item {
		flex: 0 0 calc( ( 100% - 4px ) / 2 ); /* 2-up on tablet */
		height: clamp( 260px, 38vw, 400px );
	}

	.sd-hgal-tabs__list {
		padding: 16px var( --nc-content-gutter, 20px ) 0;
	}
}

@media ( max-width: 480px ) {
	/* Tabs share the row evenly rather than overflowing the viewport. */
	.sd-hgal-tabs__tab {
		flex: 1 1 0;
		padding: 12px 10px;
		font-size: 14px;
	}
}

@media ( max-width: 480px ) {
	.sd-hgal__item {
		flex: 0 0 85%; /* single scrollable items on mobile */
		height: clamp( 200px, 55vw, 320px );
	}

	.sd-hgal__arrow {
		display: none; /* rely on swipe on mobile */
	}

	.sd-hgal-lb__figure {
		max-width: 100vw;
	}

	.sd-hgal-lb__nav {
		width: 40px;
		height: 40px;
	}
}
