/**
 * Galerie + Videogaleria — Shared page template styles
 * Namespace: .zsmh-gal-* (fotogalerie), .zsmh-vid-* (videogaleria), .zsmh-media-* (shared)
 *
 * Used by: page-galerie.php, page-videogaleria.php
 * @since Session 95
 */

/* ═══════════════════════════════════════════════
   0. DIVI OVERRIDES
   ═══════════════════════════════════════════════ */
body.page-galerie,
body.page-videogaleria {
	flex-direction: column !important;
}

.zsmh-galerie-page,
.zsmh-videogaleria-page {
	width: 100% !important;
	padding: 0 !important;
	float: none !important;
}

.zsmh-galerie-page .container,
.zsmh-videogaleria-page .container {
	width: 80%;
	max-width: 1080px;
	margin: 0 auto;
	padding: 0 0 48px !important;
}

/* ═══════════════════════════════════════════════
   1. SHARED — Filter bar, pills, view toggle, pagination
   ═══════════════════════════════════════════════ */

/* ── Filter bar ── */
.zsmh-media-filters {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 20px 0 16px;
	flex-wrap: wrap;
}

.zsmh-media-filters-right {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
}

/* ── Filter pills ── */
.zsmh-media-pill {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	font-family: var(--font-body);
	font-size: 12px;
	font-weight: 500;
	padding: 6px 14px;
	border-radius: 50px;
	border: 1px solid #ddd;
	color: #555;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s ease;
	white-space: nowrap;
}

.zsmh-media-pill:hover {
	border-color: #f19e00;
	color: #f19e00;
}

.zsmh-media-pill.active {
	background: #f19e00;
	color: #fff;
	border-color: #f19e00;
}

.zsmh-media-pill .dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	display: inline-block;
}

.zsmh-media-pill .emoji {
	font-size: 13px;
}

/* ── Year dropdown ── */
.zsmh-media-year-select {
	font-family: var(--font-body);
	font-size: 12px;
	padding: 6px 12px;
	border: 1px solid #ddd;
	border-radius: 50px;
	color: #555;
	cursor: pointer;
	outline: none;
	background: #fff;
	transition: border-color 0.2s;
}

.zsmh-media-year-select:focus {
	border-color: #f19e00;
}

/* ── View toggle ── */
.zsmh-media-view-toggle {
	display: flex;
	gap: 2px;
}

.zsmh-media-view-btn {
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 6px;
	border: 1px solid #ddd;
	cursor: pointer;
	transition: all 0.2s;
	font-size: 14px;
	color: #999;
	background: #fff;
	text-decoration: none;
}

.zsmh-media-view-btn:hover {
	border-color: #f19e00;
	color: #f19e00;
}

.zsmh-media-view-btn.active {
	background: #f19e00;
	color: #fff;
	border-color: #f19e00;
}

/* ── Info bar ── */
.zsmh-media-info {
	font-size: 13px;
	color: #777;
	padding: 0 0 16px;
	border-bottom: 1px solid #eee;
	margin-bottom: 20px;
}

.zsmh-media-info strong {
	color: #f19e00;
	font-weight: 700;
}

/* ── Pagination ── */
.zsmh-media-pagination {
	text-align: center;
	margin-top: 32px;
	padding: 16px 0;
}

.zsmh-media-pagination a,
.zsmh-media-pagination span {
	display: inline-block;
	padding: 8px 14px;
	margin: 0 3px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 13px;
	color: #555;
	text-decoration: none;
	transition: all 0.2s ease;
}

.zsmh-media-pagination a:hover {
	background: #f19e00;
	color: #fff;
	border-color: #f19e00;
}

.zsmh-media-pagination .current {
	background: #f19e00;
	color: #fff;
	border-color: #f19e00;
	font-weight: 600;
}

.zsmh-media-pagination .dots {
	border: none;
	padding: 8px 4px;
}

/* ── Cross-link ── */
.zsmh-media-crosslink {
	font-size: 13px;
	color: #777;
	margin-bottom: 24px;
}

.zsmh-media-crosslink a {
	color: #f19e00;
	text-decoration: none;
	font-weight: 500;
}

.zsmh-media-crosslink a:hover {
	text-decoration: underline;
}

/* ═══════════════════════════════════════════════
   2. FOTOGALERIE — Hero (single image + Ken Burns)
   ═══════════════════════════════════════════════ */
.zsmh-gal-hero {
	position: relative;
	overflow: hidden;
	border-radius: 16px;
	margin-bottom: 0;
	height: 300px;
}

.zsmh-gal-hero-bg {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	background-color: #e0e0e0;
	animation: zsmh-ken-burns 25s ease-in-out infinite alternate;
}

@keyframes zsmh-ken-burns {
	0%   { transform: scale(1);    }
	100% { transform: scale(1.08); }
}

.zsmh-gal-hero-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0,0,0,0.05) 0%, rgba(0,0,0,0.7) 100%);
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	padding: 32px 40px;
	color: #fff;
	z-index: 1;
}

.zsmh-gal-hero-title {
	font-family: var(--font-heading);
	font-size: 2rem;
	font-weight: 700;
	margin-bottom: 4px;
}

.zsmh-gal-hero-subtitle {
	font-size: 14px;
	opacity: 0.8;
}

.zsmh-gal-hero-stats {
	display: flex;
	gap: 24px;
	margin-top: 12px;
}

.zsmh-gal-hero-stat {
	font-size: 13px;
	font-weight: 500;
	display: flex;
	align-items: center;
	gap: 5px;
}

.zsmh-gal-hero-stat strong {
	font-size: 20px;
	color: #f19e00;
}

/* ═══════════════════════════════════════════════
   3. FOTOGALERIE — Grid (CSS Grid, uniform height, row-first order)
   Cards have fixed aspect ratio with object-fit: cover for consistent layout.
   Items flow left→right in chronological order.
   ═══════════════════════════════════════════════ */
.zsmh-gal-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-bottom: 40px;
}

/* Hidden when timeline active */
.zsmh-galerie-page.view-timeline .zsmh-gal-grid { display: none; }
.zsmh-galerie-page.view-timeline .zsmh-gal-timeline { display: block; }
.zsmh-gal-timeline { display: none; }

/* ── Gallery card ── */
.zsmh-gal-card {
	position: relative;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	transition: box-shadow 0.25s ease;
	cursor: pointer;
	background: #fff;
	aspect-ratio: 4 / 3;
}

.zsmh-gal-card:hover {
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
}

.zsmh-gal-card a {
	display: block;
	text-decoration: none;
	color: inherit;
	overflow: hidden;
	height: 100%;
}

/* ── Card image ── */
.zsmh-gal-card img {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	transition: filter 0.3s ease;
}

.zsmh-gal-card:hover img {
	filter: brightness(1.08);
}

/* ── Overlay (title + meta on image) ── */
.zsmh-gal-card-overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 24px 12px 10px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
	display: flex;
	flex-direction: column;
	gap: 2px;
	z-index: 2;
	transition: background 0.3s ease;
}

.zsmh-gal-card:hover .zsmh-gal-card-overlay {
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

.zsmh-gal-card-title {
	font-family: var(--font-heading);
	font-size: 13px;
	font-weight: 600;
	color: #fff;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.zsmh-gal-card-meta {
	font-size: 11px;
	color: rgba(255, 255, 255, 0.75);
}

/* ── Placeholder for galleries without image ── */
.zsmh-gal-card-placeholder {
	width: 100%;
	min-height: 160px;
	background: linear-gradient(135deg, #f5f5f5, #e0e0e0);
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 40px;
	color: #ccc;
}

/* ── Fallback card inside gallery card ── */
.zsmh-gal-card .zsmh-fallback-card {
	height: 100%;
	min-height: 140px;
	aspect-ratio: auto;
}

/* ═══════════════════════════════════════════════
   4. FOTOGALERIE — Timeline view
   ═══════════════════════════════════════════════ */
.zsmh-gal-timeline-section {
	margin: 32px 0;
}

.zsmh-gal-timeline-year {
	font-family: var(--font-heading);
	font-size: 1.8rem;
	font-weight: 700;
	color: #f19e00;
	margin-bottom: 16px;
}

.zsmh-gal-timeline-month {
	font-family: var(--font-heading);
	font-size: 1rem;
	font-weight: 700;
	color: #333;
	margin-bottom: 12px;
	display: flex;
	align-items: center;
	gap: 8px;
}

.zsmh-gal-timeline-month::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #eee;
}

.zsmh-gal-timeline-count {
	font-size: 12px;
	color: #999;
	font-weight: 400;
	background: #f0f0f0;
	padding: 2px 8px;
	border-radius: 50px;
	flex-shrink: 0;
}

.zsmh-gal-timeline-row {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 12px;
	margin-bottom: 24px;
}

.zsmh-gal-timeline-item {
	border-radius: 8px;
	overflow: hidden;
	position: relative;
	aspect-ratio: 16 / 10;
	cursor: pointer;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	background: #f0f0f0;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.zsmh-gal-timeline-item:hover {
	transform: translateY(-3px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.zsmh-gal-timeline-item a {
	display: block;
	text-decoration: none;
	color: inherit;
	height: 100%;
}

.zsmh-gal-timeline-item img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: filter 0.3s ease;
}

.zsmh-gal-timeline-item:hover img {
	filter: brightness(1.08);
}

.zsmh-gal-timeline-item-info {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 8px 10px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
	color: #fff;
	font-size: 11px;
	font-weight: 600;
	transition: background 0.3s ease;
}

.zsmh-gal-timeline-item:hover .zsmh-gal-timeline-item-info {
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
}

/* Fallback inside timeline */
.zsmh-gal-timeline-item .zsmh-fallback-card {
	height: 100%;
	min-height: 0;
	aspect-ratio: auto;
}

/* ═══════════════════════════════════════════════
   5. VIDEOGALERIA — Title bar
   ═══════════════════════════════════════════════ */
.zsmh-vid-titlebar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 20px;
	padding-top: 32px;
	gap: 16px;
}

.zsmh-vid-title {
	font-family: var(--font-heading);
	font-size: 1.8rem;
	font-weight: 700;
	color: #222;
	margin-bottom: 4px;
}

.zsmh-vid-subtitle {
	font-size: 13px;
	color: #777;
}

.zsmh-vid-subtitle strong {
	color: #f19e00;
}

/* ═══════════════════════════════════════════════
   6. VIDEOGALERIA — Cinema layout
   ═══════════════════════════════════════════════ */
.zsmh-vid-cinema {
	display: grid;
	grid-template-columns: 2fr 1fr;
	gap: 12px;
	margin-bottom: 24px;
}

/* Hidden when grid active */
.zsmh-videogaleria-page.view-grid .zsmh-vid-cinema { display: none; }
.zsmh-videogaleria-page.view-grid .zsmh-vid-grid { display: grid; }

/* ── Featured video ── */
.zsmh-vid-main {
	border-radius: 12px;
	overflow: hidden;
	position: relative;
	background: #000;
	aspect-ratio: 16 / 9;
}

.zsmh-vid-main {
	cursor: pointer;
}

.zsmh-vid-main img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.7;
	transition: opacity 0.3s;
}

.zsmh-vid-main:hover img {
	opacity: 0.85;
}

.zsmh-vid-main-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 64px;
	height: 64px;
	background: #f19e00;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 20px rgba(241, 158, 0, 0.4);
	transition: transform 0.2s;
	pointer-events: none;
	z-index: 2;
}

.zsmh-vid-main:hover .zsmh-vid-main-play {
	transform: translate(-50%, -50%) scale(1.1);
}

.zsmh-vid-main-play::after {
	content: '';
	border-left: 20px solid #fff;
	border-top: 12px solid transparent;
	border-bottom: 12px solid transparent;
	margin-left: 4px;
}

.zsmh-vid-main-info {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 20px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
	color: #fff;
	z-index: 1;
}

.zsmh-vid-main-info h3 {
	font-family: var(--font-heading);
	font-size: 18px;
	font-weight: 700;
	margin-bottom: 4px;
}

.zsmh-vid-main-info span {
	font-size: 12px;
	opacity: 0.7;
}

/* ── Playlist sidebar ── */
.zsmh-vid-playlist {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 380px;
	overflow-y: auto;
}

.zsmh-vid-playlist-item {
	display: flex;
	gap: 10px;
	padding: 8px;
	border-radius: 8px;
	cursor: pointer;
	transition: background 0.2s;
	text-decoration: none;
	color: inherit;
}

.zsmh-vid-playlist-item:hover {
	background: #f5f5f5;
}

.zsmh-vid-playlist-item.active {
	background: rgba(241, 158, 0, 0.08);
}

.zsmh-vid-playlist-thumb {
	width: 100px;
	height: 56px;
	border-radius: 6px;
	overflow: hidden;
	flex-shrink: 0;
	position: relative;
	background: #000;
}

.zsmh-vid-playlist-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.85;
}

.zsmh-vid-playlist-thumb .mini-play {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(0, 0, 0, 0.3);
	color: #fff;
	font-size: 18px;
	opacity: 0;
	transition: opacity 0.2s;
}

.zsmh-vid-playlist-item:hover .mini-play {
	opacity: 1;
}

.zsmh-vid-playlist-info {
	min-width: 0;
}

.zsmh-vid-playlist-info h4 {
	font-family: var(--font-heading);
	font-size: 12px;
	font-weight: 600;
	color: #333;
	margin-bottom: 2px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.zsmh-vid-playlist-info span {
	font-size: 11px;
	color: #999;
}

/* ═══════════════════════════════════════════════
   7. VIDEOGALERIA — Video grid
   ═══════════════════════════════════════════════ */
.zsmh-vid-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

/* Only shown when view-grid active, or always below cinema (for remaining videos) */
.zsmh-vid-grid-rest {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin-top: 4px;
}

.zsmh-vid-card {
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
	transition: transform 0.25s ease, box-shadow 0.25s ease;
	cursor: pointer;
}

.zsmh-vid-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.zsmh-vid-card a {
	display: block;
	text-decoration: none;
	color: inherit;
}

.zsmh-vid-card-thumb {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: #000;
}

.zsmh-vid-card-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.85;
	transition: opacity 0.3s, transform 0.35s;
}

.zsmh-vid-card:hover .zsmh-vid-card-thumb img {
	opacity: 1;
	transform: scale(1.05);
}

.zsmh-vid-card-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 44px;
	height: 44px;
	background: rgba(241, 158, 0, 0.9);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s;
	pointer-events: none;
}

.zsmh-vid-card:hover .zsmh-vid-card-play {
	transform: translate(-50%, -50%) scale(1.1);
}

.zsmh-vid-card-play::after {
	content: '';
	border-left: 14px solid #fff;
	border-top: 8px solid transparent;
	border-bottom: 8px solid transparent;
	margin-left: 3px;
}

.zsmh-vid-card-body {
	padding: 12px 14px;
}

.zsmh-vid-card-title {
	font-family: var(--font-heading);
	font-size: 13px;
	font-weight: 600;
	color: #222;
	margin-bottom: 4px;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.zsmh-vid-card-meta {
	font-size: 11px;
	color: #999;
}

/* Fallback inside video card */
.zsmh-vid-card-thumb .zsmh-fallback-card {
	height: 100%;
	min-height: 0;
	aspect-ratio: auto;
	opacity: 0.85;
}

/* ═══════════════════════════════════════════════
   7b. VIDEOGALERIA — Inline YouTube iframe
   ═══════════════════════════════════════════════ */
.zsmh-vid-iframe {
	width: 100%;
	height: 100%;
	border: none;
	position: absolute;
	inset: 0;
	z-index: 3;
}

.zsmh-vid-main.is-playing {
	background: #000;
	cursor: default;
}

/* ═══════════════════════════════════════════════
   8. DIVI OVERRIDE FIXES
   ═══════════════════════════════════════════════ */
.zsmh-galerie-page h1,
.zsmh-galerie-page h2,
.zsmh-galerie-page h3,
.zsmh-videogaleria-page h1,
.zsmh-videogaleria-page h2,
.zsmh-videogaleria-page h3 {
	padding-bottom: 0 !important;
}

.zsmh-galerie-page p,
.zsmh-videogaleria-page p {
	padding-bottom: 0 !important;
}

/* ═══════════════════════════════════════════════
   9. RESPONSIVE
   ═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
	.zsmh-gal-hero {
		height: 260px;
	}

	.zsmh-gal-hero-overlay {
		padding: 24px 30px;
	}

	.zsmh-gal-hero-title {
		font-size: 1.6rem;
	}
}

@media (max-width: 768px) {
	.zsmh-galerie-page .container,
	.zsmh-videogaleria-page .container {
		width: 92%;
	}

	/* Hero */
	.zsmh-gal-hero {
		height: 240px;
	}

	.zsmh-gal-hero-overlay {
		padding: 20px;
	}

	.zsmh-gal-hero-title {
		font-size: 1.4rem;
	}

	.zsmh-gal-hero-stats {
		gap: 16px;
	}

	.zsmh-gal-hero-stat strong {
		font-size: 16px;
	}

	/* Gallery grid — 2 columns */
	.zsmh-gal-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Timeline */
	.zsmh-gal-timeline-row {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Cinema */
	.zsmh-vid-cinema {
		grid-template-columns: 1fr;
	}

	.zsmh-vid-playlist {
		flex-direction: row;
		overflow-x: auto;
		overflow-y: hidden;
		max-height: none;
		gap: 12px;
		padding-bottom: 8px;
	}

	.zsmh-vid-playlist-item {
		flex-direction: column;
		min-width: 140px;
	}

	.zsmh-vid-playlist-thumb {
		width: 100%;
		height: 80px;
	}

	/* Video grid */
	.zsmh-vid-grid,
	.zsmh-vid-grid-rest {
		grid-template-columns: repeat(2, 1fr);
	}

	/* Title bar */
	.zsmh-vid-titlebar {
		flex-direction: column;
		align-items: flex-start;
		padding-top: 16px;
	}

	/* Filters */
	.zsmh-media-filters-right {
		margin-left: 0;
		width: 100%;
	}
}

@media (max-width: 480px) {
	/* Container width — na malých obrazovkách širší ako desktop 80% */
	.zsmh-galerie-page .container,
	.zsmh-videogaleria-page .container {
		width: 95%;
	}

	/* Hero */
	.zsmh-gal-hero {
		height: 200px;
	}

	/* Gallery grid — 1 column */
	.zsmh-gal-grid {
		grid-template-columns: 1fr;
	}

	/* Timeline */
	.zsmh-gal-timeline-row {
		grid-template-columns: 1fr 1fr;
		gap: 8px;
	}

	/* Video grid */
	.zsmh-vid-grid,
	.zsmh-vid-grid-rest {
		grid-template-columns: 1fr;
	}

	/* Video main play button smaller */
	.zsmh-vid-main-play {
		width: 48px;
		height: 48px;
	}

	.zsmh-vid-main-play::after {
		border-left-width: 16px;
		border-top-width: 10px;
		border-bottom-width: 10px;
	}

	/* Hero stats wrap */
	.zsmh-gal-hero-stats {
		flex-wrap: wrap;
		gap: 10px;
	}
}

/* ═══════════════════════════════════════════════
   10. GRID STABILIZER + AJAX LOADING
   ═══════════════════════════════════════════════ */
/* Hide grid until images are loaded to prevent layout shift.
   JS adds .zsmh-gal-grid-loading, then swaps to .zsmh-gal-grid-ready. */
.zsmh-gal-grid-loading {
	opacity: 0;
}
.zsmh-gal-grid-ready {
	opacity: 1;
	transition: opacity 0.25s ease;
}

/* Empty state */
.zsmh-gal-empty {
	text-align: center;
	padding: 60px 0;
	color: #999;
	font-size: 15px;
}

@media print {
	.zsmh-gal-hero,
	.zsmh-media-filters,
	.zsmh-media-view-toggle,
	.zsmh-media-pagination,
	.zsmh-vid-main-play,
	.zsmh-vid-card-play {
		display: none !important;
	}

	.zsmh-gal-card {
		break-inside: avoid;
	}
}
