/* =========================================================
   Intracoastal Homes — listing photo viewer (1.16.0; own file since 1.17.2)
   Full-screen photos over the listing page. Built by js/ich-photo-viewer.js
   and added at the end of <body>, so these rules don't sit under .ich-listing.
   Loaded right after listing.css on residential, suite, building and sold-home pages.
   ========================================================= */
html.ich-lb-open,
html.ich-lb-open body{ overflow: hidden; }

.ich-lb{
	position: fixed;
	inset: 0;
	z-index: 100001; /* above the site header, WP admin bar and the mobile tour bar */
	display: flex;
	flex-direction: column;
	background: #131518;
	color: #fff;
	font-family: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	opacity: 0;
	transition: opacity 0.22s ease;
	-webkit-tap-highlight-color: transparent;
}
.ich-lb[hidden]{ display: none; }
.ich-lb.is-visible{ opacity: 1; }

.ich-lb button{
	font-family: inherit;
	color: #fff;
	background: none;
	border: 0;
	border-radius: 0;
	margin: 0;
	cursor: pointer;
	box-shadow: none;
}
.ich-lb button:focus-visible{ outline: 2px solid #fff; outline-offset: 2px; }

/* Top bar: listing name · "3 / 24" · Close */
.ich-lb-top{
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 16px;
	padding: 12px 16px 12px 24px;
	padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.ich-lb-title{
	margin: 0;
	font-family: 'Fraunces', Georgia, serif;
	font-size: 1.05rem;
	font-weight: 400;
	color: rgba(255, 255, 255, 0.86);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ich-lb-count{
	margin: 0;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.72);
	font-variant-numeric: tabular-nums;
}
.ich-lb .ich-lb-close{
	justify-self: end;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 44px;
	padding: 8px 14px;
	font-size: 0.85rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	border: 1px solid rgba(255, 255, 255, 0.28);
	border-radius: 999px;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
.ich-lb .ich-lb-close:hover{ background: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.5); color: #fff; }

/* Stage: one photo at a time, swipe/scroll sideways */
.ich-lb-stage{
	position: relative;
	flex: 1 1 auto;
	min-height: 0;
}
.ich-lb-track{
	display: flex;
	height: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}
.ich-lb-track::-webkit-scrollbar{ display: none; }
.ich-lb-slide{
	flex: 0 0 100%;
	height: 100%;
	margin: 0;
	padding: 8px 88px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	scroll-snap-align: center;
	scroll-snap-stop: always;
}
.ich-lb-slide img{
	display: block;
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	min-height: 0;
	object-fit: contain;
	user-select: none;
	-webkit-user-drag: none;
	background: rgba(255, 255, 255, 0.04);
}
.ich-lb-caption{
	flex: 0 0 auto;
	max-width: 60rem;
	font-size: 0.9rem;
	line-height: 1.5;
	text-align: center;
	color: rgba(255, 255, 255, 0.78);
}

.ich-lb .ich-lb-arrow{
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 56px;
	height: 56px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.08);
	transition: background-color 0.15s ease, opacity 0.15s ease;
}
.ich-lb .ich-lb-arrow:hover{ background: rgba(255, 255, 255, 0.2); color: #fff; }
.ich-lb .ich-lb-arrow:disabled{ opacity: 0.25; cursor: default; background: rgba(255, 255, 255, 0.08); }
.ich-lb-prev{ left: 18px; }
.ich-lb-next{ right: 18px; }

/* Thumbnails along the bottom */
.ich-lb-thumbs{
	flex: 0 0 auto;
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 12px 24px 16px;
	padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.3) transparent;
}
.ich-lb-thumbs::before,
.ich-lb-thumbs::after{ content: ""; flex: 1 0 0; } /* centre the row when it fits */
.ich-lb .ich-lb-thumb{
	flex: 0 0 auto;
	width: 72px;
	height: 54px;
	padding: 0;
	overflow: hidden;
	opacity: 0.5;
	outline: 2px solid transparent;
	outline-offset: 2px;
	transition: opacity 0.15s ease, outline-color 0.15s ease;
}
.ich-lb .ich-lb-thumb img{
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.ich-lb .ich-lb-thumb:hover{ opacity: 0.85; }
.ich-lb .ich-lb-thumb[aria-current="true"]{ opacity: 1; outline-color: #fff; }

@media (max-width: 760px){
	.ich-lb-top{ grid-template-columns: auto 1fr auto; padding-left: 16px; }
	.ich-lb-title{ display: none; }
	.ich-lb-count{ grid-column: 1; }
	.ich-lb .ich-lb-close{ grid-column: 3; }
	.ich-lb-slide{ padding: 0; }
	.ich-lb-arrow{ display: none !important; } /* swipe instead */
	.ich-lb .ich-lb-thumb{ width: 56px; height: 42px; }
	.ich-lb-thumbs{ padding-left: 12px; padding-right: 12px; gap: 6px; }
}
/* Short screens (phone held sideways): give the photo all the room */
@media (max-height: 520px){
	.ich-lb-thumbs{ display: none; }
	.ich-lb-top{ padding-top: 6px; padding-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce){
	.ich-lb,
	.ich-lb-track{ transition: none; scroll-behavior: auto; }
}
