/* ================================================================
   AGL Single Artwork Widget
   ================================================================ */

.gsa {
	--gsa-gap: 48px;
	--gsa-col-a: 3fr;
	--gsa-col-b: 2fr;
	display: grid;
	gap: var(--gsa-gap);
	width: 100%;
	position: relative;
}

/* ── Layout variants ─────────────────────────────────────────── */

.gsa--split {
	grid-template-columns: var(--gsa-col-a) var(--gsa-col-b);
	align-items: center;
}

.gsa--split_r {
	grid-template-columns: var(--gsa-col-b) var(--gsa-col-a);
	align-items: center;
}

.gsa--split_r .gsa__media { order: 2; }
.gsa--split_r .gsa__info  { order: 1; }

.gsa--stack {
	grid-template-columns: 1fr;
	justify-items: center;
}

.gsa--stack .gsa__media,
.gsa--stack .gsa__info {
	width: 100%;
}

.gsa--stack .gsa__info {
	max-width: 780px;
}

.gsa--caption {
	grid-template-columns: 1fr;
	justify-items: center;
	gap: clamp(18px, 2.5vw, 36px);
}

.gsa--caption .gsa__media {
	width: 100%;
}

.gsa--overlay {
	grid-template-columns: 1fr;
	position: relative;
}

.gsa--overlay .gsa__media {
	grid-row: 1;
	grid-column: 1;
}

.gsa--overlay .gsa__info {
	grid-row: 1;
	grid-column: 1;
	position: relative;
	z-index: 2;
	align-self: end;
	color: #fff;
	padding: clamp(24px, 5vw, 64px);
}

.gsa--overlay .gsa__info,
.gsa--overlay .gsa__info .gsa__artist,
.gsa--overlay .gsa__info .gsa__title,
.gsa--overlay .gsa__info .gsa__title a,
.gsa--overlay .gsa__info .gsa__meta dt,
.gsa--overlay .gsa__info .gsa__meta dd,
.gsa--overlay .gsa__info .gsa__desc,
.gsa--overlay .gsa__info .gsa__price {
	color: inherit;
}

/* ── Media ──────────────────────────────────────────────────── */

.gsa__media {
	position: relative;
	width: 100%;
	min-width: 0;
}

.gsa-media__frame {
	position: relative;
	width: 100%;
	overflow: hidden;
	background: #f3f3f3;
}

.gsa-media__link {
	display: block;
	width: 100%;
	height: 100%;
	line-height: 0;
	text-align: center;
}

.gsa-media__img,
.gsa-media__frame img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	max-height: 100%;
	margin: 0 auto;
}

/* Natural ratio = let image drive height, but never exceed the frame's max-height.
   Using the frame's max-height on the image itself (via CSS vars) + width:auto avoids
   the overflow-clip problem where width:100% forces a height larger than max-height. */
.gsa--ratio-natural .gsa-media__frame {
	aspect-ratio: auto;
	background: transparent;
	overflow: visible;
	display: flex;
	align-items: center;
	justify-content: center;
}

.gsa--ratio-natural .gsa-media__link {
	display: inline-flex;
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: inherit;
	justify-content: center;
}

.gsa--ratio-natural .gsa-media__img {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: inherit;
	object-fit: contain;
	object-position: center;
	margin: 0 auto;
}

/* Stacked & Caption layouts: image should never be cropped — let height drive so
   the full artwork is visible under the frame's max-height cap. */
.gsa--stack.gsa--ratio-natural .gsa-media__img,
.gsa--caption.gsa--ratio-natural .gsa-media__img {
	max-height: inherit;
}

/* Fixed ratios */
.gsa--ratio-1x1  .gsa-media__frame { aspect-ratio: 1 / 1; }
.gsa--ratio-4x5  .gsa-media__frame { aspect-ratio: 4 / 5; }
.gsa--ratio-3x4  .gsa-media__frame { aspect-ratio: 3 / 4; }
.gsa--ratio-16x9 .gsa-media__frame { aspect-ratio: 16 / 9; }
.gsa--ratio-4x3  .gsa-media__frame { aspect-ratio: 4 / 3; }

.gsa:not(.gsa--ratio-natural) .gsa-media__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
}

.gsa--fit-cover:not(.gsa--ratio-natural) .gsa-media__img {
	object-fit: cover;
}

.gsa--fit-contain:not(.gsa--ratio-natural) .gsa-media__img {
	object-fit: contain;
}

.gsa-media__placeholder {
	position: absolute;
	inset: 0;
	background: linear-gradient(135deg, #e7e7e7 0%, #ccc 100%);
}

/* ── Info ──────────────────────────────────────────────────── */

.gsa__info {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.gsa__artist {
	display: inline-block;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	text-decoration: none;
	color: #666;
	margin-bottom: -6px;
}

.gsa__artist:hover {
	color: #111;
}

.gsa__title {
	margin: 0;
	font-size: clamp(22px, 2.2vw, 32px);
	font-weight: 400;
	line-height: 1.2;
	letter-spacing: 0.01em;
	font-style: italic;
	color: #111;
}

.gsa__title a {
	color: inherit;
	text-decoration: none;
}

.gsa__title a:hover {
	text-decoration: underline;
	text-underline-offset: 4px;
}

/* Meta list (Year / Medium / Dimensions) */
.gsa__meta {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 6px 0 2px;
	padding: 0;
	font-size: 14px;
	line-height: 1.5;
	color: #333;
}

.gsa__meta-row {
	display: flex;
	gap: 12px;
}

.gsa__meta dt {
	flex: 0 0 110px;
	margin: 0;
	color: #999;
	font-weight: 400;
	text-transform: uppercase;
	font-size: 11px;
	letter-spacing: 0.08em;
	padding-top: 2px;
}

.gsa__meta dd {
	margin: 0;
	flex: 1;
	min-width: 0;
	color: #222;
}

.gsa__desc {
	font-size: 15px;
	line-height: 1.6;
	color: #555;
	margin-top: 6px;
}

.gsa__desc p {
	margin: 0 0 0.75em;
}

.gsa__desc p:last-child {
	margin-bottom: 0;
}

.gsa__price {
	font-size: 18px;
	font-weight: 500;
	color: #111;
	margin-top: 6px;
}

.gsa__price .price {
	color: inherit;
}

.gsa__price del,
.gsa__price ins {
	margin-right: 8px;
}

/* ── Actions ────────────────────────────────────────────────── */

.gsa__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
	margin-top: 12px;
}

.gsa__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 14px 28px;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #fff;
	background: #111;
	border: 1px solid #111;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.gsa__btn:hover {
	background: #fff;
	color: #111;
}

.gsa__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #111;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
	padding-bottom: 2px;
	transition: opacity 0.3s;
}

.gsa__link:hover { opacity: 0.7; }

.gsa__link svg {
	transition: transform 0.3s;
}

.gsa__link:hover svg {
	transform: translateX(3px);
}

/* Inquiry button (from inquiry system) plays nicely inside actions */
.gsa__info .glozin-inquiry-wrapper {
	display: inline-flex;
}

/* ── Caption layout ─────────────────────────────────────────── */

.gsa__caption-wrap {
	width: 100%;
	display: flex;
	justify-content: center;
	padding: 0 clamp(12px, 3vw, 32px);
}

.gsa__caption {
	margin: 0;
	max-width: 780px;
	text-align: center;
	font-size: clamp(16px, 1.6vw, 22px);
	line-height: 1.45;
	color: #222;
	font-weight: 400;
	letter-spacing: 0.01em;
}

.gsa__caption a {
	color: inherit;
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.3s;
}

.gsa__caption a:hover {
	border-bottom-color: currentColor;
}

.gsa__cap-title {
	font-style: italic;
}

.gsa__cap-sep {
	display: inline-block;
	margin: 0 2px;
	color: #888;
}

.gsa__cap-medium,
.gsa__cap-artist,
.gsa__cap-year {
	font-style: normal;
}

.gsa__caption--minimal {
	font-size: clamp(18px, 1.8vw, 24px);
}

.gsa__caption--gallery .gsa__cap-title {
	font-weight: 500;
}

/* ── Responsive ─────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.gsa {
		--gsa-gap: 36px;
	}
	.gsa--split,
	.gsa--split_r {
		grid-template-columns: 1fr;
	}
	.gsa--split_r .gsa__media { order: 1; }
	.gsa--split_r .gsa__info  { order: 2; }
	.gsa__meta dt { flex-basis: 90px; }
}

@media (max-width: 640px) {
	.gsa {
		--gsa-gap: 24px;
	}
	.gsa__title {
		font-size: 22px;
	}
	.gsa__meta {
		font-size: 13px;
	}
	.gsa__meta dt {
		flex-basis: 80px;
	}
	.gsa__btn {
		padding: 12px 22px;
	}
}
