/* ==========================================================================
   Before & After Gallery — patient cases, photo carousel, testimonials card.
   ========================================================================== */

/* ---------- Patient cases ---------- */

.hl-gal-cases__head {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: flex-end;
	gap: 24px;
}
.hl-gal-cases__title { margin: 20px 0 0; }
.hl-gal-cases__count {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--hl-muted);
	font-variant-numeric: tabular-nums;
}

.hl-gal-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 36px; }
.hl-gal-filter {
	padding: 12px 20px;
	border-radius: 999px;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	color: var(--hl-body);
	background: #fff;
	border: 1px solid var(--hl-line);
	cursor: pointer;
	transition: border-color 0.2s ease, color 0.2s ease;
}
.hl-gal-filter:hover { border-color: var(--hl-blue); color: var(--hl-blue); }
.hl-gal-filter.is-active {
	background: var(--hl-navy);
	border-color: var(--hl-navy);
	color: #fff;
}

.hl-gal-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
	gap: 24px;
	margin-top: 36px;
}

/* The filter sets the hidden attribute, and the browser's built-in
   [hidden] { display:none } loses to any author display rule — this card sets
   display:flex, so without this line a "hidden" card stayed fully visible. */
.hl-gal-card[hidden] { display: none; }

.hl-gal-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--hl-line);
	border-radius: var(--hl-radius);
	overflow: hidden;
	box-shadow: var(--hl-shadow);
}

/* Both halves of the card are buttons, so the browser default button styling
   has to be unset on each rather than on a shared wrapper. */
.hl-gal-card__media,
.hl-gal-card__body {
	font: inherit;
	text-align: left;
	border: 0;
	padding: 0;
	cursor: pointer;
	color: inherit;
}

.hl-gal-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	background: var(--hl-mist);
	width: 100%;
	cursor: zoom-in;
}
/* contain, not cover: a before/after pair must not be cropped to fill the tile. */
.hl-gal-card__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.hl-gal-card__body {
	flex: 1;
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 20px 22px;
	background: #fff;
	border-top: 1px solid var(--hl-line-2);
	color: var(--hl-navy);
	transition: background 0.2s ease;
}
.hl-gal-card__body:hover { background: #F5F9FC; }

.hl-gal-card__text { min-width: 0; }
.hl-gal-card__label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--hl-muted);
}
.hl-gal-card__stat {
	display: block;
	font-size: 19px;
	font-weight: 600;
	line-height: 1.3;
	margin-top: 6px;
}
.hl-gal-card__cta {
	flex-shrink: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--hl-blue-dark);
}

.hl-gal-empty {
	margin: 36px 0 0;
	padding: 48px 24px;
	text-align: center;
	background: var(--hl-mist);
	border-radius: var(--hl-radius);
	color: var(--hl-body);
}

/* ---------- Photo carousel ---------- */

.hl-gal-photos__title { margin: 20px 0 0; }

.hl-gal-photos__arrows { display: flex; justify-content: flex-end; gap: 12px; margin-top: 28px; }
.hl-gal-arrow {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 1px solid #C5D0D8;
	background: #fff;
	color: var(--hl-navy);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.hl-gal-arrow:hover {
	border-color: var(--hl-blue);
	background: var(--hl-blue);
	color: #fff;
}
/* Set by the script when the track is already at one end. */
.hl-gal-arrow[disabled] { opacity: 0.4; cursor: default; }
.hl-gal-arrow[disabled]:hover { background: #fff; border-color: #C5D0D8; color: var(--hl-navy); }

/* A paged slider (see [data-pager] in main.js): whole photos, the arrows turn the page,
   no scroll bar. Without the script the photos simply wrap. */
.hl-gal-track {
	--pager-gap: 20px;
	display: flex;
	flex-wrap: wrap;
	gap: 20px;
	margin-top: 20px;
	padding: 4px 0 28px;
}
.hl-gal-arrow[hidden] { display: none; }

.hl-gal-slide {
	flex: 0 0 clamp(220px, calc((100% - 60px) / 4), 340px);
	aspect-ratio: 3 / 4;
	border-radius: var(--hl-radius);
	overflow: hidden;
	background: #fff;
	box-shadow: 0 18px 40px -18px rgba(11, 34, 51, 0.35);
	padding: 0;
	border: 0;
	cursor: zoom-in;
}
.hl-gal-slide img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	/* Biased above centre: these are full-body shots and the subject's legs,
	   which is what the photo is about, sit in the upper-middle of the frame. */
	object-position: center 30%;
	display: block;
}

@media (prefers-reduced-motion: reduce) {
	.hl-gal-filter,
	.hl-gal-arrow,
	.hl-gal-card__body { transition: none; }
}

/* ---------- Testimonials link card ---------- */

.hl-gal-testi__card {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	background: #fff;
	border: 1px solid var(--hl-line);
	border-radius: var(--hl-radius);
	overflow: hidden;
	color: var(--hl-navy);
	box-shadow: var(--hl-shadow);
	transition: border-color 0.2s ease;
}
.hl-gal-testi__card:hover { border-color: var(--hl-blue); }

.hl-gal-testi__media {
	flex: 0 1 420px;
	min-height: 260px;
	position: relative;
	background: var(--hl-navy);
}
.hl-gal-testi__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.hl-gal-testi__body {
	flex: 1 1 380px;
	padding: 44px;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.hl-gal-testi__eyebrow {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--hl-blue-dark);
}
.hl-gal-testi__title {
	font-family: var(--hl-serif);
	font-size: clamp(32px, 3.4vw, 46px);
	line-height: 1.05;
	margin-top: 12px;
}
.hl-gal-testi__cta {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--hl-blue-dark);
	margin-top: 24px;
}

@media (max-width: 600px) {
	.hl-gal-testi__body { padding: 28px 24px; }
	.hl-gal-card__body { padding: 16px 18px; }
}

/* ==========================================================================
   Case viewer — photo beside the patient's story.
   ========================================================================== */

.hl-gal-viewer {
	position: fixed;
	inset: 0;
	z-index: 220;
	background: rgba(7, 24, 37, 0.82);
	display: none;
	align-items: center;
	justify-content: center;
	padding: 4vh 16px;
	overflow-y: auto;
}
.hl-gal-viewer.is-open { display: flex; }

.hl-gal-viewer__dialog {
	position: relative;
	display: grid;
	/* Photo takes the room it needs; the story column stays a readable width. */
	grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.9fr);
	width: 100%;
	max-width: 1180px;
	max-height: 92vh;
	background: #fff;
	border-radius: 6px;
	overflow: hidden;
	box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.6);
	border-top: 3px solid var(--hl-blue);
}

.hl-gal-viewer__media {
	position: relative;
	background: var(--hl-mist);
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 320px;
}
/* contain, never cover: a before/after pair must not be cropped. */
.hl-gal-viewer__media img {
	width: 100%;
	height: 100%;
	max-height: 92vh;
	object-fit: contain;
	display: block;
}

.hl-gal-viewer__arrow {
	position: absolute;
	z-index: 2;
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	border-radius: 50%;
	border: 0;
	background: rgba(11, 34, 51, 0.72);
	color: #fff;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}
.hl-gal-viewer__arrow:hover { background: var(--hl-blue); }
.hl-gal-viewer__arrow--prev { left: 16px; }
.hl-gal-viewer__arrow--next { right: 16px; }

.hl-gal-viewer__close {
	position: absolute;
	top: 18px;
	right: 18px;
	z-index: 2;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid var(--hl-line);
	background: #fff;
	color: var(--hl-navy);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}
.hl-gal-viewer__close:hover { border-color: var(--hl-blue); color: var(--hl-blue); }

.hl-gal-viewer__panel {
	padding: 56px 40px 40px;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.hl-gal-viewer__meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--hl-muted);
}
.hl-gal-viewer__count { flex-shrink: 0; font-variant-numeric: tabular-nums; }
.hl-gal-viewer__stat {
	font-family: var(--hl-serif);
	font-weight: 400;
	font-size: clamp(30px, 3vw, 42px);
	line-height: 1.1;
	color: var(--hl-navy);
	margin: 0;
}
.hl-gal-viewer__text { font-size: 17px; line-height: 1.8; color: var(--hl-body); }
.hl-gal-viewer__cta {
	margin-top: auto;
	display: flex;
	justify-content: center;
	align-items: center;
	background: var(--hl-blue);
	color: #fff;
	padding: 18px 24px;
	border-radius: var(--hl-radius-btn);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background 0.2s ease;
}
.hl-gal-viewer__cta:hover { background: var(--hl-blue-dark); }

@media (max-width: 900px) {
	/* Stacked: photo first, story beneath, so the dialog still fits a phone. */
	.hl-gal-viewer__dialog { grid-template-columns: minmax(0, 1fr); max-height: 94vh; overflow-y: auto; }
	.hl-gal-viewer__media { min-height: 0; }
	.hl-gal-viewer__media img { max-height: 48vh; }
	.hl-gal-viewer__panel { padding: 28px 24px 24px; }
	.hl-gal-viewer__arrow { width: 44px; height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
	.hl-gal-viewer__arrow, .hl-gal-viewer__cta { transition: none; }
}

/* ---------- Patient videos ---------- */

.hl-gal-videos__title { margin-top: 12px; }

.hl-gal-videos__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 28px;
	margin-top: 44px;
	/* Rows size to each card, so a portrait clip doesn't stretch its row-mates. */
	align-items: start;
}

.hl-gal-video { margin: 0; }

.hl-gal-video__frame {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: var(--hl-radius);
	overflow: hidden;
	background: var(--hl-navy);
	box-shadow: var(--hl-shadow);
}

/* The portrait flag sits on the <figure>; the frame inherits the shape from
   main.css (.hl-video--portrait .hl-gal-video__frame). */

.hl-gal-video__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.hl-gal-video__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	padding: 0;
	border: 0;
	background: var(--hl-navy);
	cursor: pointer;
}

.hl-gal-video__poster img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hl-gal-video__play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: var(--hl-blue);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s ease;
}

.hl-gal-video__poster:hover .hl-gal-video__play,
.hl-gal-video__poster:focus .hl-gal-video__play { background: var(--hl-blue-dark); }

.hl-gal-video__play span {
	width: 0;
	height: 0;
	border-left: 18px solid #fff;
	border-top: 11px solid transparent;
	border-bottom: 11px solid transparent;
	margin-left: 5px;
}

.hl-gal-video__title {
	margin-top: 12px;
	font-weight: 600;
	color: var(--hl-navy);
}

@media (prefers-reduced-motion: reduce) {
	.hl-gal-video__play { transition: none; }
}
