/* Palmilla Gallery: hero, category tabs, grid and lightbox. Measurements from Figma 1895:4603 (1682 wide), 1998:5879 (lightbox) and 1998:6076 (402 wide). */

.pgal {
	--pgal-teal: #097173;
	--pgal-ink: #635d58;
	--pgal-mint: #7ed7d2;
	--pgal-sand: #f5f3ef;
	--pgal-header: 84px;
	--pgal-ease: cubic-bezier(.22, .61, .36, 1);
	box-sizing: border-box;
}
.pgal *, .pgal *::before, .pgal *::after { box-sizing: inherit; }
.pgal :where(ul, ol) { list-style: none; margin: 0; padding: 0; }
.pgal :where(li) { margin: 0; }
.pgal :where(img) { display: block; max-width: none; height: auto; }

/* The kit styles every <button>; ours start from nothing. */
.pgal button.pgal-b,
.pgal button.pgal-b:hover,
.pgal button.pgal-b:focus,
.pgal button.pgal-b:active {
	appearance: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: inherit;
	line-height: inherit;
	min-height: 0;
	width: auto;
	cursor: pointer;
	transition: none;
}
.pgal .pgal-b:focus-visible,
.pgal a:focus-visible {
	outline: 2px solid var(--pgal-teal);
	outline-offset: 3px;
}
.pgal-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	margin: -1px; padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Shared: category button + Expand ---------- */

.pgal .pgal-cta {
	display: inline-flex;
	align-items: center;
	gap: 15px;
	color: #fff;
	font: 700 11px/15px nexa, sans-serif;
	letter-spacing: 1.65px;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
}
.pgal .pgal-cta:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.pgal .pgal-cta svg { flex: none; transition: transform .25s var(--pgal-ease); }
.pgal .pgal-cta:hover svg { transform: translateX(3px); }
.pgal button.pgal-expand {
	position: relative;
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	color: #fff;
}
.pgal button.pgal-expand svg { grid-area: 1 / 1; width: 29px; height: 29px; }
.pgal button.pgal-expand span {
	grid-area: 1 / 1;
	font: 700 6.6px/1 nexa, sans-serif;
	letter-spacing: 1.25px;
	text-transform: uppercase;
	padding-left: 1.25px; /* re-centre against the trailing letter-spacing */
}
/* Stays white on the teal panel: the reset above would otherwise hand hover/focus the parent's dark text colour. */
.pgal button.pgal-expand:hover,
.pgal button.pgal-expand:focus,
.pgal button.pgal-expand:active { color: #fff; }
.pgal button.pgal-expand:hover svg { transform: scale(1.08); }

/* ---------- Hero ---------- */

.pgal-hero {
	--pill: 6.1vw;
	--gap: 1.19vw;
	--card-h: max(240px, min(max(380px, 40.43vw), 100svh - 150px, 760px)); /* design size, 380 floor, but never taller than the window allows */
	--radius: clamp(36px, 3.03vw, 56px);
	position: relative;
	width: 93.05vw;
	max-width: 100%;
	margin: 0 auto;
	padding-bottom: 2.74vw; /* the second card sits 46px lower in the design */
}
.pgal-hero-track {
	display: flex;
	gap: var(--gap);
	align-items: flex-start;
}
.pgal-hero-card {
	position: relative;
	flex: 0 0 var(--pill);
	height: var(--card-h);
	min-width: 0;
	border-radius: var(--radius);
	overflow: hidden;
	background: #e9e3d8;
	cursor: pointer;
	isolation: isolate;
	transform: translateY(var(--y, 0));
	transition: flex-grow .7s var(--pgal-ease), transform .7s var(--pgal-ease);
}
.pgal-hero-card:nth-child(2) { --y: 2.74vw; }
.pgal-hero-card:nth-child(4) { --y: -6.54vw; }
.pgal-hero-card.is-active { flex-grow: 1; --y: 0px; cursor: default; }
.pgal-hero-media {
	position: absolute;
	inset: 0;
	container-type: size;
	overflow: hidden;
}
.pgal .pgal-hero-media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}
.pgal .pgal-hero-media iframe {
	position: absolute;
	top: 50%;
	left: 50%;
	width: max(100cqw, 177.78cqh);
	height: max(100cqh, 56.25cqw);
	max-width: none;
	max-height: none;
	transform: translate(-50%, -50%);
	border: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity .8s ease;
}
.pgal-hero-media iframe.is-playing { opacity: 1; }
.pgal-hero-overlay {
	position: absolute;
	inset: auto 0 0;
	height: 46.6%;
	display: flex;
	align-items: flex-end;
	justify-content: center;
	gap: 58px;
	padding-bottom: 36px;
	background: linear-gradient(to top, rgba(9, 113, 115, .82) 16.2%, rgba(9, 113, 115, 0) 97.8%);
	opacity: 0;
	transition: opacity .4s ease;
	pointer-events: none;
}
.pgal-hero-overlay .pgal-cta { flex-direction: row-reverse; padding-bottom: 14px; }
.pgal-hero-card.is-active .pgal-hero-overlay,
.pgal-hero-card:has(:focus-visible) .pgal-hero-overlay { opacity: 1; transition-delay: .25s; pointer-events: auto; }
.pgal-dots { display: none; }

/* ---------- Tabs ---------- */

.pgal-tabbar {
	position: sticky;
	top: calc(var(--pgal-header) + 32px);
	z-index: 20;
	width: min(1124px, 66.83vw);
	margin: 0 auto;
	padding: 23px 24px;
	border: .5px solid var(--pgal-ink);
	border-radius: 8px;
	background: rgba(255, 255, 255, .8);
	-webkit-backdrop-filter: blur(4.7px);
	backdrop-filter: blur(4.7px);
}
.pgal-tabs {
	display: flex;
	justify-content: center;
	gap: 30px;
}
.pgal button.pgal-tab,
.pgal button.pgal-tab:hover,
.pgal button.pgal-tab:focus {
	flex: 0 0 auto;
	min-width: 123px;
	height: 39px;
	padding: 0 16px;
	border: .5px solid var(--pgal-ink);
	border-radius: 6px;
	color: var(--pgal-teal);
	font: 700 10px/18px nexa, sans-serif;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background-color .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.pgal button.pgal-tab:hover { background: rgba(255, 255, 255, .9); border-color: var(--pgal-teal); }
.pgal button.pgal-tab[aria-pressed="true"] {
	border-color: transparent;
	background: #fff;
	box-shadow: 2px 2px 4px rgba(0, 0, 0, .25);
}

/* ---------- Grid ---------- */

.pgal-gallery { padding-bottom: 96px; }
.pgal-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 20px 19px;
	width: 94.95vw;
	max-width: 1840px;
	margin: 93px auto 0;
}
.pgal-card {
	position: relative;
	aspect-ratio: 385 / 417;
	border-radius: clamp(24px, 2.08vw, 40px);
	overflow: hidden;
	background: #e9e3d8;
	cursor: pointer;
	isolation: isolate;
	animation: pgal-in .6s var(--pgal-ease) both;
}
.pgal .pgal-card img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform .8s var(--pgal-ease);
}
.pgal-card:hover img { transform: scale(1.03); }
.pgal-play {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 55px;
	height: 54px;
	transform: translate(-50%, -50%);
	pointer-events: none;
	filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .18));
}
.pgal .pgal-play svg { width: 100%; height: 100%; display: block; }
.pgal-panel {
	position: absolute;
	inset: auto 0 0;
	height: 21.34%;
	min-height: 64px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 18px 0 25px;
	background: rgba(9, 113, 115, .75);
	opacity: 0;
	transform: translateY(12px);
	transition: opacity .3s ease, transform .3s var(--pgal-ease);
}
.pgal-card:hover .pgal-panel,
.pgal-card:has(:focus-visible) .pgal-panel { opacity: 1; transform: none; }
/* After a lightbox opened by mouse or tap closes, focus goes back to the card without showing its panel. */
.pgal-card[data-quiet]:not(:hover) .pgal-panel { opacity: 0; transform: translateY(12px); }
@keyframes pgal-in { from { opacity: 0; transform: translateY(18px); } }

/* ---------- Lightbox ---------- */

.pgal-lb {
	position: fixed;
	inset: 0;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--pgal-ink);
	overflow: hidden;
}
.pgal-lb::backdrop { background: rgba(0, 0, 0, .65); }
.pgal-lb[open] { display: grid; place-items: center; }
.pgal-lb-box {
	--pad: 22px;
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(1461px, calc(100vw - 2 * clamp(16px, 6.54vw, 110px)));
	height: calc(100dvh - 96px);
	border-radius: 21px;
	background: var(--pgal-sand);
	overflow: hidden;
	box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
	animation: pgal-lb-in .45s var(--pgal-ease) both;
}
@keyframes pgal-lb-in { from { opacity: 0; transform: translateY(24px) scale(.985); } }
.pgal-lb-head {
	flex: none;
	display: flex;
	align-items: center;
	height: 84px;
	padding: 0 32px;
	background: #fff;
}
.pgal button.pgal-lb-back,
.pgal button.pgal-lb-back:hover,
.pgal button.pgal-lb-back:focus {
	display: inline-flex;
	align-items: center;
	gap: 22px;
	min-height: 44px;
	color: var(--pgal-teal);
	font: 700 14px/18px nexa, sans-serif;
	letter-spacing: 2.1px;
	text-transform: uppercase;
}
.pgal button.pgal-lb-back svg { transition: transform .25s var(--pgal-ease); }
.pgal button.pgal-lb-back:hover svg { transform: translateX(-4px); }
.pgal-lb-scroll {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: var(--pad) var(--pad) 64px;
	scrollbar-width: thin;
}
.pgal-lb-list { display: flex; flex-direction: column; align-items: center; gap: 64px; }
.pgal-lb-item {
	position: relative;
	width: min(100%, calc((100dvh - 96px - 84px - 2 * var(--pad)) * var(--ar)));
	aspect-ratio: var(--ar);
	border-radius: 35px;
	overflow: hidden;
	background: #e9e3d8;
}
.pgal .pgal-lb-item img,
.pgal .pgal-lb-item iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border: 0;
	border-radius: 0;
}
.pgal-lb-item .pgal-play { width: 80px; height: 78px; }
.pgal button.pgal-lb-poster { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.pgal .pgal-lb-cta {
	position: absolute;
	right: 24px;
	bottom: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-width: 204px;
	height: 51px;
	padding: 0 22px 0 37px;
	border-radius: 4px;
	background: #fff;
	color: var(--pgal-teal);
	font: 700 11px/18px nexa, sans-serif;
	letter-spacing: 1.65px;
	text-transform: uppercase;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color .2s ease, color .2s ease;
}
.pgal .pgal-lb-cta:hover { background: var(--pgal-teal); color: #fff; }
.pgal-lb-item.is-video .pgal-lb-cta { bottom: auto; top: 24px; }
.pgal-lb-item.is-playing .pgal-lb-cta { opacity: 0; pointer-events: none; }

/* ---------- Tablet ---------- */

@media (max-width: 1279px) {
	.pgal-tabbar { width: calc(100% - 60px); padding: 20px; }
	.pgal-tabs { gap: 12px; }
	.pgal button.pgal-tab, .pgal button.pgal-tab:hover, .pgal button.pgal-tab:focus { flex: 1 1 0; min-width: 0; padding: 0 8px; white-space: normal; line-height: 12px; text-wrap: balance; }
}
@media (max-width: 1024px) {
	.pgal-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: calc(100% - 60px); margin-top: 64px; }
	.pgal-hero { --pill: 7vw; }
	.pgal-hero-overlay { gap: 32px; padding-bottom: 24px; }
	.pgal button.pgal-tab, .pgal button.pgal-tab:hover, .pgal button.pgal-tab:focus { letter-spacing: 1px; font-size: 9px; }
}

/* ---------- Phones (Figma 1998:6076, 402 wide) ---------- */

@media (max-width: 767px) {
	.pgal-hero {
		--card-h: min(680px, 169.2vw, calc(100svh - 120px));
		--radius: clamp(36px, 12.7vw, 51px);
		width: 100%;
		padding: 0;
	}
	.pgal-hero-track {
		gap: 12px;
		padding: 0 4vw;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		overscroll-behavior-x: contain;
	}
	.pgal-hero-track::-webkit-scrollbar { display: none; }
	.pgal-hero-card,
	.pgal-hero-card.is-active {
		flex: 0 0 92vw;
		transform: none;
		scroll-snap-align: center;
		transition: none;
		cursor: pointer;
	}
	.pgal-hero-overlay {
		height: 33%;
		background: linear-gradient(to top, rgba(0, 0, 0, .82) 22.6%, rgba(0, 0, 0, 0) 100%);
		align-items: flex-end;
		justify-content: center;
		padding-bottom: 88px;
		opacity: 1;
		pointer-events: auto;
	}
	.pgal-hero-overlay .pgal-cta,
	.pgal-hero-overlay button.pgal-expand { display: none; }
	.pgal-dots {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 26px;
		display: flex;
		justify-content: center;
		gap: 6px;
		pointer-events: none;
	}
	.pgal button.pgal-dot,
	.pgal button.pgal-dot:hover,
	.pgal button.pgal-dot:focus {
		position: relative;
		width: 44px;
		height: 44px;
		pointer-events: auto;
	}
	.pgal button.pgal-dot::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 20px;
		height: 20px;
		margin: -10px 0 0 -10px;
		border-radius: 50%;
		background: #fff;
		transition: background-color .25s ease, transform .25s ease;
	}
	.pgal button.pgal-dot[aria-current="true"]::before { background: var(--pgal-mint); }

	.pgal-tabbar { top: calc(var(--pgal-header) + 12px); width: calc(100% - 8vw); padding: 16px 13px; }
	.pgal-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 10px; }
	.pgal button.pgal-tab, .pgal button.pgal-tab:hover, .pgal button.pgal-tab:focus {
		height: 34px;
		padding: 0 4px;
		font-size: 9px;
		line-height: 11px;
		letter-spacing: .9px;
		white-space: normal;
		text-wrap: balance;
		border-width: .5px;
		border-radius: 5px;
	}
	.pgal-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; width: 63.43vw; max-width: 420px; margin-top: 70px; }
	/* Once it sticks, the 3x2 menu folds into one swipeable row so it covers less of the screen. */
	.pgal-tabbar.is-stuck { padding: 8px; }
	.pgal-tabbar.is-stuck .pgal-tabs {
		display: flex;
		gap: 8px;
		overflow-x: auto;
		scroll-snap-type: x proximity;
		scroll-padding-inline: 2px;
		scrollbar-width: none;
		overscroll-behavior-x: contain;
	}
	.pgal-tabbar.is-stuck .pgal-tabs::-webkit-scrollbar { display: none; }
	.pgal-tabbar.is-stuck button.pgal-tab,
	.pgal-tabbar.is-stuck button.pgal-tab:hover,
	.pgal-tabbar.is-stuck button.pgal-tab:focus { flex: 0 0 auto; padding: 0 14px; white-space: nowrap; scroll-snap-align: start; }
	.pgal-card { aspect-ratio: 255 / 257; border-radius: 23px; }
	.pgal-panel { min-height: 55px; padding: 0 10px 0 16px; }
	.pgal .pgal-cta { gap: 10px; font-size: 9px; letter-spacing: 1.2px; }
	.pgal-gallery { padding-bottom: 64px; }

	.pgal-lb-box { --pad: 10px; width: calc(100vw - 16px); height: calc(100dvh - 16px); border-radius: 16px; }
	.pgal-lb-head { height: 60px; padding: 0 16px; }
	.pgal button.pgal-lb-back, .pgal button.pgal-lb-back:hover, .pgal button.pgal-lb-back:focus { font-size: 12px; gap: 14px; letter-spacing: 1.8px; }
	.pgal-lb-list { gap: 24px; }
	.pgal-lb-item { width: 100%; border-radius: 20px; }
	.pgal .pgal-lb-cta { right: 12px; bottom: 12px; min-width: 0; height: 44px; padding: 0 16px 0 20px; gap: 14px; }
	.pgal-lb-item.is-video .pgal-lb-cta { top: 12px; }
}

@media (min-width: 480px) and (max-width: 767px) {
	.pgal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); width: calc(100% - 8vw); max-width: none; }
}
@media (max-width: 400px) {
	.pgal-hero-overlay { padding-bottom: 76px; }
}

/* Short screens (landscape phones): the menu stays in place instead of covering half the view. */
@media (max-height: 560px) {
	.pgal-tabbar, .pgal-tabbar.is-stuck { position: relative; top: auto; }
	.pgal-hero { --card-h: max(220px, calc(100svh - 120px)); }
}

/* Touch screens have no hover: the lightbox carries each item's button instead of the card. */
@media (hover: none) {
	.pgal-card:hover:not(:has(:focus-visible)) .pgal-panel { opacity: 0; transform: translateY(12px); }
	.pgal-card:not(:has(:focus-visible)) .pgal-panel { pointer-events: none; }
	.pgal-card:hover img { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.pgal-hero-card, .pgal-hero-overlay, .pgal-card, .pgal-card img, .pgal-panel, .pgal-lb-box, .pgal .pgal-hero-media iframe { transition: none !important; animation: none !important; }
}
