/* =========================================================================
   Antique Market Hero & Gallery — front-end styles
   All visual values are exposed as CSS custom properties so they can be
   overridden from the theme's custom.css without touching this file.
   ========================================================================= */

.amhg-hero,
.amhg-gallery {
	--amhg-frame-border: 1px solid rgba(0, 0, 0, 0.35);
	--amhg-frame-radius: 2px;
	--amhg-frame-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
	--amhg-sepia-duration: 1.6s;

	/* Hero height (the original Slider Revolution height was 382px). The
	   image fills this box via object-fit: cover, so any source image works. */
	--amhg-hero-height: 382px;

	/* Gallery tile frame (matches the brown/gold framed thumbnails) */
	--amhg-tile-border-color: #5d3417;
	--amhg-tile-inner-color: #c9a24b;
	--amhg-tile-border-width: 3px;
	--amhg-tile-gap: 14px;
	--amhg-tile-radius: 2px;

	/* Lightbox */
	--amhg-lightbox-bg: rgba(18, 14, 10, 0.92);
	--amhg-lightbox-accent: #c9a24b;

	box-sizing: border-box;
}
.amhg-hero *,
.amhg-gallery *,
.amhg-lightbox * {
	box-sizing: border-box;
}

/* ----------------------------------------------------------------------- */
/* HERO                                                                    */
/* ----------------------------------------------------------------------- */

.amhg-hero {
	width: 100%;
	margin: 0 auto;
}

.amhg-hero-frame {
	position: relative;
	width: 100%;
	height: var(--amhg-hero-height);
	overflow: hidden;
	border: var(--amhg-frame-border);
	border-radius: var(--amhg-frame-radius);
	box-shadow: var(--amhg-frame-shadow);
	background: #1a1a1a;
	line-height: 0;
}

.amhg-hero-track {
	position: relative;
	width: 100%;
	height: 100%;
}

.amhg-hero-slide {
	width: 100%;
	height: 100%;
}

/* Slider: stack slides and cross-fade */
.amhg-hero--slider .amhg-hero-track {
	display: grid;
}
.amhg-hero--slider .amhg-hero-slide {
	grid-area: 1 / 1;
	opacity: 0;
	transition: opacity 0.9s ease;
	pointer-events: none;
}
.amhg-hero--slider .amhg-hero-slide.is-active {
	opacity: 1;
	pointer-events: auto;
}

.amhg-hero-img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

/* --- Sepia → color effect --- */
.amhg-effect-sepia .amhg-hero-img {
	filter: sepia(100%) saturate(150%) brightness(96%);
	transition: filter var(--amhg-sepia-duration) ease;
}

/* On-load trigger: JS adds .is-color to the hero once loaded */
.amhg-effect-sepia.amhg-trigger-load.is-color .amhg-hero-img {
	filter: sepia(0%) saturate(100%) brightness(100%);
}

/* Slider always reveals color on the active slide */
.amhg-effect-sepia.amhg-hero--slider .amhg-hero-slide.is-active .amhg-hero-img {
	filter: sepia(0%) saturate(100%) brightness(100%);
}

/* On-hover trigger (single image) */
.amhg-effect-sepia.amhg-trigger-hover .amhg-hero-frame:hover .amhg-hero-img {
	filter: sepia(0%) saturate(100%) brightness(100%);
}

/* Honour reduced-motion: just show color, no slow fade */
@media (prefers-reduced-motion: reduce) {
	.amhg-effect-sepia .amhg-hero-img {
		transition: none;
	}
}

/* Slider controls */
.amhg-hero-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 42px;
	height: 42px;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	z-index: 3;
	transition: background 0.2s ease;
}
.amhg-hero-arrow:hover,
.amhg-hero-arrow:focus-visible {
	background: rgba(0, 0, 0, 0.7);
	outline: none;
}
.amhg-hero-prev {
	left: 12px;
}
.amhg-hero-next {
	right: 12px;
}

.amhg-hero-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 12px;
	display: flex;
	justify-content: center;
	gap: 8px;
	z-index: 3;
}
.amhg-hero-dot {
	width: 11px;
	height: 11px;
	padding: 0;
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	background: transparent;
	cursor: pointer;
	transition: background 0.2s ease;
}
.amhg-hero-dot.is-active {
	background: rgba(255, 255, 255, 0.95);
}

.amhg-hero--empty,
.amhg-gallery--empty {
	padding: 18px;
	border: 1px dashed #b00;
	color: #b00;
	font-size: 14px;
}

/* Hero height steps down on smaller screens (the original RevSlider scaled
   proportionally on mobile). Desktop stays at the original 382px. To lock a
   single height on every screen, delete these two queries or set
   --amhg-hero-height in the theme CSS. */
@media (max-width: 768px) {
	.amhg-hero {
		--amhg-hero-height: 300px;
	}
}
@media (max-width: 520px) {
	.amhg-hero {
		--amhg-hero-height: 210px;
	}
}

/* ----------------------------------------------------------------------- */
/* GALLERY GRID                                                            */
/* ----------------------------------------------------------------------- */

.amhg-gallery {
	width: 100%;
	margin: 0 auto;
}

.amhg-gallery-grid {
	display: grid;
	grid-template-columns: repeat(var(--amhg-cols, 8), 1fr);
	gap: var(--amhg-tile-gap);
}

.amhg-tile {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 0;
	margin: 0;
	cursor: pointer;
	overflow: hidden;
	background: #efe9e1;
	border: var(--amhg-tile-border-width) solid var(--amhg-tile-border-color);
	border-radius: var(--amhg-tile-radius);
	box-shadow: inset 0 0 0 1px var(--amhg-tile-inner-color);
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}
/* Fallback for browsers without aspect-ratio */
@supports not (aspect-ratio: 1 / 1) {
	.amhg-tile::before {
		content: "";
		display: block;
		padding-top: 100%;
	}
}

.amhg-tile:hover,
.amhg-tile:focus-visible {
	transform: translateY(-2px);
	box-shadow: inset 0 0 0 1px var(--amhg-tile-inner-color), 0 6px 14px rgba(0, 0, 0, 0.35);
	outline: none;
}

.amhg-tile-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Responsive column collapse */
@media (max-width: 1100px) {
	.amhg-gallery-grid {
		grid-template-columns: repeat(6, 1fr);
	}
}
@media (max-width: 800px) {
	.amhg-gallery-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}
@media (max-width: 520px) {
	.amhg-gallery-grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 10px;
	}
}
@media (max-width: 360px) {
	.amhg-gallery-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

/* ----------------------------------------------------------------------- */
/* LIGHTBOX                                                                */
/* ----------------------------------------------------------------------- */

.amhg-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--amhg-lightbox-bg);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
	-webkit-tap-highlight-color: transparent;
}
.amhg-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.amhg-lb-stage {
	position: relative;
	max-width: 92vw;
	max-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.amhg-lb-img {
	max-width: 92vw;
	max-height: 86vh;
	width: auto;
	height: auto;
	display: block;
	border: 2px solid rgba(255, 255, 255, 0.12);
	box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6);
	border-radius: 2px;
	background: #111;
	user-select: none;
}

.amhg-lb-btn {
	position: absolute;
	border: 0;
	background: rgba(0, 0, 0, 0.45);
	color: #fff;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
	z-index: 2;
}
.amhg-lb-btn:hover,
.amhg-lb-btn:focus-visible {
	background: rgba(0, 0, 0, 0.75);
	color: var(--amhg-lightbox-accent);
	outline: none;
}

.amhg-lb-prev,
.amhg-lb-next {
	top: 50%;
	transform: translateY(-50%);
	width: 50px;
	height: 50px;
	border-radius: 50%;
	font-size: 24px;
	line-height: 1;
}
.amhg-lb-prev {
	left: -64px;
}
.amhg-lb-next {
	right: -64px;
}

.amhg-lb-close {
	top: -52px;
	right: -2px;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	font-size: 24px;
	line-height: 1;
}

.amhg-lb-counter {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -42px;
	text-align: center;
	color: rgba(255, 255, 255, 0.85);
	font-size: 14px;
	letter-spacing: 0.04em;
}

/* Phones / tablets: move controls inside the viewport */
@media (max-width: 900px) {
	.amhg-lb-prev {
		left: 6px;
	}
	.amhg-lb-next {
		right: 6px;
	}
	.amhg-lb-close {
		top: 8px;
		right: 8px;
		background: rgba(0, 0, 0, 0.6);
	}
	.amhg-lb-counter {
		bottom: 10px;
		text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
	}
	.amhg-lb-stage {
		max-height: 80vh;
	}
	.amhg-lb-img {
		max-height: 80vh;
	}
}

body.amhg-lb-locked {
	overflow: hidden;
}
