/**
 * HW Editorial Gallery — Dedicated gallery styles for editorial posts.
 *
 * Design language: Bodoni Moda headings, coral accent, generous whitespace,
 * Farbfilter colour theming via inline custom properties.
 *
 * @package fwbase
 * @since   2026-04
 */

/* =========================================================================
 * 0. DESIGN TOKENS (inherit from editorial, fallback if not set)
 * ========================================================================= */
.hw-editorial-gal {
	--hw-brand:        #e6ac92;
	--hw-brand-dark:   #d87d54;
	--hw-brand-light:  #f5c1aa;
	--hw-border-warm:  #b7a297;
	--hw-border-light: #ededed;
	--hw-cream:        #f8ebe6;
	--hw-bg-warm:      #fbfafa;
	--hw-text:         #333;
	--hw-text-muted:   #676767;

	/* Farbfilter accents — overridden by inline style if present */
	--hw-accent:       var(--hw-brand);
	--hw-accent-dark:  var(--hw-brand-dark);
	--hw-accent-soft:  var(--hw-cream);
}


/* =========================================================================
 * 1. HEADER / BREADCRUMB
 * ========================================================================= */
.hw-editorial-gal__header {
	max-width: 1320px;
	margin: 0 auto;
	padding: 2rem 1.5rem 1.5rem;
	text-align: center;
}

.hw-editorial-gal__breadcrumb {
	margin-bottom: 1.25rem;
}

.hw-editorial-gal__back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-family: 'Lato', sans-serif;
	font-size: 0.78rem;
	font-weight: 400;
	letter-spacing: 0.03em;
	color: var(--hw-text-muted);
	text-decoration: none;
	transition: color 0.2s;
}

.hw-editorial-gal__back:hover {
	color: var(--hw-accent-dark);
	text-decoration: none;
}

.hw-editorial-gal__back svg {
	flex-shrink: 0;
	transition: transform 0.2s;
}

.hw-editorial-gal__back:hover svg {
	transform: translateX(-3px);
}

.hw-editorial-gal__back span {
	max-width: 400px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.hw-editorial-gal__title {
	font-family: 'Bodoni Moda', serif;
	font-weight: 400;
	font-style: italic;
	font-size: clamp(1.6rem, 3vw, 2.4rem);
	color: var(--hw-text);
	margin: 0 0 0.6rem;
	letter-spacing: 0.01em;
}

.hw-editorial-gal__meta {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	font-family: 'Lato', sans-serif;
	font-size: 0.78rem;
	color: var(--hw-text-muted);
}

.hw-editorial-gal__photographer {
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.hw-editorial-gal__photographer a {
	color: var(--hw-accent-dark);
	text-decoration: none;
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s;
}

.hw-editorial-gal__photographer a:hover {
	border-color: var(--hw-accent-dark);
	color: var(--hw-accent-dark);
	text-decoration: none;
}

.hw-editorial-gal__photographer svg {
	color: var(--hw-accent);
}

.hw-editorial-gal__count {
	opacity: 0.7;
}


/* =========================================================================
 * 2. GALLERY GRID (CSS Columns — Masonry-style)
 * ========================================================================= */
.hw-editorial-gal__grid {
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 12px 3rem;
	columns: 2;
	column-gap: 8px;
}

@media (min-width: 640px) {
	.hw-editorial-gal__grid {
		columns: 3;
		padding: 0 16px 3rem;
	}
}

@media (min-width: 1024px) {
	.hw-editorial-gal__grid {
		columns: 4;
		padding: 0 20px 3rem;
	}
}


/* =========================================================================
 * 3. GALLERY ITEM
 * ========================================================================= */
.hw-editorial-gal__item {
	position: relative;
	overflow: hidden;
	break-inside: avoid;
	margin-bottom: 8px;
	cursor: pointer;
	background: #f5f0eb;
}

.hw-editorial-gal__item img {
	display: block;
	width: 100%;
	height: auto;
	transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94),
				opacity 0.3s ease;
}

.hw-editorial-gal__item:hover img {
	transform: scale(1.03);
}


/* =========================================================================
 * 4. HOVER OVERLAY
 * ========================================================================= */
.hw-editorial-gal__overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(
		0deg,
		rgba(0, 0, 0, 0.45) 0%,
		rgba(0, 0, 0, 0) 40%
	);
	opacity: 0;
	transition: opacity 0.3s ease;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	padding: 10px;
}

.hw-editorial-gal__item:hover .hw-editorial-gal__overlay {
	opacity: 1;
}

.hw-editorial-gal__overlay-actions {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Pinterest button */
.hw-editorial-gal__pin {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	color: #e60023;
	transition: transform 0.2s, background 0.2s;
	text-decoration: none;
}

.hw-editorial-gal__pin:hover {
	transform: scale(1.1);
	background: #fff;
	color: #e60023;
	text-decoration: none;
}

.hw-editorial-gal__pin svg {
	fill: #e60023;
}

/* Heart / Bookmark button */
.hw-editorial-gal__heart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.9);
	cursor: pointer;
	transition: transform 0.2s, background 0.2s;
}

.hw-editorial-gal__heart:hover {
	transform: scale(1.1);
	background: #fff;
}

.hw-editorial-gal__heart svg {
	stroke: #e27a5f;
}

.hw-editorial-gal__heart.hw-bm-active svg {
	fill: #e27a5f;
	stroke: #e27a5f;
}

/* Mobile: tap-to-reveal overlay */
@media (hover: none) {
	.hw-editorial-gal__item.is-tapped .hw-editorial-gal__overlay {
		opacity: 1;
	}
}


/* =========================================================================
 * 5. FULLSCREEN OVERLAY
 * ========================================================================= */
.hw-editorial-gal__fullscreen {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: rgba(0, 0, 0, 0.94);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0.35s;
}

.hw-editorial-gal__fullscreen.is-active {
	opacity: 1;
	visibility: visible;
}

/* Image stage — flex child that shrinks to fit between top bar and info bar.
   `min-height: 0` is critical: without it, flex items default to
   min-height: min-content which prevents the stage from shrinking below
   the image's intrinsic height — causing portrait images to overflow/crop. */
.hw-editorial-gal__fs-stage {
	flex: 1 1 0%;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	overflow: hidden;
	padding: 56px 60px 0;
	box-sizing: border-box;
	touch-action: pan-y;
}

/* Portrait fix: the image must respect BOTH max-width and max-height of its
   flex container. `object-fit: contain` alone isn't enough — the browser also
   needs width/height: auto so it doesn't stretch to fill the container, and
   the parent needs min-height: 0 (above) so the flex track actually shrinks. */
.hw-editorial-gal__fs-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	transition: opacity 0.25s ease;
	user-select: none;
	-webkit-user-select: none;
}

.hw-editorial-gal__fs-img.is-loading {
	opacity: 0.3;
}

/* Close button & Nav arrows — reset theme button styles.
   Theme applies styles to button:not(.off-canvas-toggle)... with
   ::before/::after pseudo-elements for pink borders. We must override. */
.hw-editorial-gal__fs-close,
.hw-editorial-gal__fs-prev,
.hw-editorial-gal__fs-next {
	position: absolute !important;
	display: block !important;
	background: none !important;
	border: none !important;
	margin: 0 !important;
	line-height: 1 !important;
	font-size: inherit !important;
	text-align: center !important;
	z-index: 10;
	cursor: pointer;
}

/* Kill the theme's ::before/::after pink border/background */
.hw-editorial-gal__fs-close::before,
.hw-editorial-gal__fs-close::after,
.hw-editorial-gal__fs-prev::before,
.hw-editorial-gal__fs-prev::after,
.hw-editorial-gal__fs-next::before,
.hw-editorial-gal__fs-next::after {
	content: none !important;
	display: none !important;
}

/* Close button */
.hw-editorial-gal__fs-close {
	top: 16px !important;
	right: 16px !important;
	left: auto !important;
	color: rgba(255, 255, 255, 0.7);
	padding: 8px;
	transition: color 0.2s, transform 0.2s;
}

.hw-editorial-gal__fs-close:hover {
	color: #fff;
	transform: scale(1.1);
	background: none !important;
}

/* Nav arrows */
.hw-editorial-gal__fs-prev,
.hw-editorial-gal__fs-next {
	top: 50% !important;
	transform: translateY(-50%);
	color: rgba(255, 255, 255, 0.6);
	padding: 12px;
	transition: color 0.2s, transform 0.2s;
}

.hw-editorial-gal__fs-prev {
	left: 12px !important;
	right: auto !important;
}

.hw-editorial-gal__fs-next {
	right: 12px !important;
	left: auto !important;
}

.hw-editorial-gal__fs-prev:hover,
.hw-editorial-gal__fs-next:hover {
	color: #fff;
	background: none !important;
}

.hw-editorial-gal__fs-prev:hover {
	transform: translateY(-50%) translateX(-2px);
}

.hw-editorial-gal__fs-next:hover {
	transform: translateY(-50%) translateX(2px);
}

/* Bottom info bar */
.hw-editorial-gal__fs-info {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	padding: 12px 20px 16px;
	width: 100%;
	box-sizing: border-box;
	color: rgba(255, 255, 255, 0.75);
	font-family: 'Lato', sans-serif;
	font-size: 0.78rem;
	flex-wrap: wrap;
}

.hw-editorial-gal__fs-caption {
	font-family: 'Bodoni Moda', serif;
	font-style: italic;
	font-size: 0.88rem;
	color: rgba(255, 255, 255, 0.85);
}

.hw-editorial-gal__fs-caption:empty {
	display: none;
}

.hw-editorial-gal__fs-counter {
	opacity: 0.5;
	font-size: 0.72rem;
}

.hw-editorial-gal__fs-actions {
	display: flex;
	align-items: center;
	gap: 14px;
}

.hw-editorial-gal__fs-pin {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: rgba(255, 255, 255, 0.75);
	text-decoration: none;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	transition: color 0.2s;
}

.hw-editorial-gal__fs-pin:hover {
	color: #fff;
	text-decoration: none;
}

.hw-editorial-gal__fs-pin svg {
	fill: rgba(255, 255, 255, 0.75);
	transition: fill 0.2s;
}

.hw-editorial-gal__fs-pin:hover svg {
	fill: #e60023;
}

/* Fullscreen heart */
.hw-editorial-gal__fs-heart {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	color: rgba(255, 255, 255, 0.75);
	cursor: pointer;
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	transition: color 0.2s;
	background: none;
	border: none;
	padding: 0;
}

.hw-editorial-gal__fs-heart:hover {
	color: #fff;
}

.hw-editorial-gal__fs-heart svg {
	stroke: rgba(255, 255, 255, 0.75);
	transition: stroke 0.2s, fill 0.2s;
}

.hw-editorial-gal__fs-heart:hover svg {
	stroke: #e27a5f;
}

.hw-editorial-gal__fs-heart.hw-bm-active svg {
	fill: #e27a5f;
	stroke: #e27a5f;
}

.hw-editorial-gal__fs-photographer {
	color: rgba(255, 255, 255, 0.6);
	font-size: 0.72rem;
}

.hw-editorial-gal__fs-photographer a {
	color: rgba(255, 255, 255, 0.8);
	text-decoration: none;
	border-bottom: 1px solid rgba(255, 255, 255, 0.3);
	transition: color 0.2s, border-color 0.2s;
}

.hw-editorial-gal__fs-photographer a:hover {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.6);
}


/* =========================================================================
 * 6. RESPONSIVE
 * ========================================================================= */
@media (max-width: 640px) {
	.hw-editorial-gal__header {
		padding: 1.25rem 1rem 1rem;
	}

	.hw-editorial-gal__title {
		font-size: 1.4rem;
	}

	.hw-editorial-gal__meta {
		flex-direction: column;
		gap: 0.4rem;
	}

	.hw-editorial-gal__grid {
		column-gap: 6px;
	}

	.hw-editorial-gal__item {
		margin-bottom: 6px;
	}

	/* Fullscreen — tighter padding so portrait images get maximum height */
	.hw-editorial-gal__fs-stage {
		padding: 48px 6px 0;
	}

	.hw-editorial-gal__fs-prev {
		left: 4px !important;
	}

	.hw-editorial-gal__fs-next {
		right: 4px !important;
	}

	.hw-editorial-gal__fs-info {
		padding: 8px 12px 14px;
		gap: 0.6rem;
	}
}

/* Admin-bar offsets */
.admin-bar .hw-editorial-gal__fullscreen {
	top: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar .hw-editorial-gal__fullscreen {
		top: 46px;
	}
}


/* =========================================================================
 * 7. PAGE OVERRIDES (hide unnecessary page chrome)
 * ========================================================================= */
.page-template-template-gallery-scroll .hw-editorial-gal ~ .site-footer-wrapper,
.page-template-template-gallery-scroll .hw-editorial-gal ~ .footer-instagram {
	/* Footer visible, no change needed */
}

/* Remove default page header when editorial gallery is showing */
.hw-editorial-gal ~ .page-header,
.hw-editorial-gal + .page-header {
	display: none;
}

/* Hide the standard gallery filters/grid when editorial gallery is active */
.hw-editorial-gal ~ .hw-gallery-filters,
.hw-editorial-gal ~ #main {
	display: none;
}


/* =========================================================================
 * 8. INFINITE SCROLL SENTINEL & SPINNER
 * ========================================================================= */
.hw-editorial-gal__scroll-sentinel {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.75rem;
	padding: 2rem 1rem 3rem;
}

.hw-editorial-gal__scroll-sentinel.is-done {
	display: none;
}

.hw-editorial-gal__spinner {
	display: flex;
	gap: 6px;
}

.hw-editorial-gal__spinner span {
	display: block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--hw-accent, #e6ac92);
	animation: hw-gal-bounce 1.2s ease-in-out infinite;
}

.hw-editorial-gal__spinner span:nth-child(2) {
	animation-delay: 0.15s;
}

.hw-editorial-gal__spinner span:nth-child(3) {
	animation-delay: 0.3s;
}

@keyframes hw-gal-bounce {
	0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
	40%           { opacity: 1;   transform: scale(1.1); }
}

.hw-editorial-gal__scroll-status {
	font-family: 'Lato', sans-serif;
	font-size: 0.78rem;
	color: var(--hw-text-muted, #676767);
}


/* =========================================================================
 * 9. REDUCED MOTION
 * ========================================================================= */
@media (prefers-reduced-motion: reduce) {
	.hw-editorial-gal__item img {
		transition: none;
	}

	.hw-editorial-gal__overlay {
		transition: none;
	}

	.hw-editorial-gal__fullscreen {
		transition: none;
	}

	.hw-editorial-gal__fs-img {
		transition: none;
	}
}
