/**
 * Photo Story Mode
 *
 * Full-screen horizontal photo story with swipe + arrow navigation.
 * JS: assets/js/photo-story.js
 */

/* === Trigger in hero meta row === */

.plecat-photo-story-trigger {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 0;
	border: none;
	background: none;
	color: var(--wp--preset--color--base);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--xx-small);
	font-weight: 400;
	cursor: pointer;
	opacity: 0.8;
	transition: opacity 0.2s ease;
}

.plecat-photo-story-trigger:hover {
	opacity: 1;
}

@keyframes plecat-story-nudge {
	0%   { opacity: 0; transform: translateY(4px); }
	100% { opacity: 0.8; transform: translateY(0); }
}

@media (max-width: 782px) {
	.plecat-photo-story-trigger {
		text-decoration: underline;
		text-underline-offset: 3px;
		text-decoration-color: rgba(255, 255, 255, 0.3);
		animation: plecat-story-nudge 0.8s ease 1.5s both;
	}
}

@media (min-width: 783px) {
	.plecat-photo-story-trigger:hover {
		text-decoration: underline;
		text-underline-offset: 3px;
	}
}

/* === Overlay === */

.plecat-photo-story {
	position: fixed;
	inset: 0;
	z-index: 10001;
	background: var(--wp--preset--color--contrast);
	opacity: 0;
	transition: opacity 0.3s ease;
	display: flex;
	flex-direction: column;
}

.plecat-photo-story.is-open {
	opacity: 1;
}

/* === Story progress segments === */

.plecat-photo-story__progress {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	z-index: 3;
	display: flex;
	gap: 3px;
	padding: 10px 16px;
}

.plecat-photo-story__progress-segment {
	flex: 1;
	height: 2px;
	background: rgba(255, 255, 255, 0.2);
	transition: background 0.3s ease;
	cursor: pointer;
}

.plecat-photo-story__progress-segment.is-past,
.plecat-photo-story__progress-segment.is-active {
	background: rgba(255, 255, 255, 0.7);
}

/* === Close button === */

.plecat-photo-story__close {
	position: absolute;
	top: 20px;
	right: 12px;
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: none;
	background: none;
	color: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	transition: color 0.2s ease;
}

.plecat-photo-story__close:hover {
	color: #fff;
}

/* === Content area === */

.plecat-photo-story__content {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	padding: 40px 0 0;
}

/* === Navigation arrows === */

.plecat-photo-story__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	padding: 0;
	border: none;
	background: none;
	color: rgba(255, 255, 255, 0.3);
	cursor: pointer;
	transition: color 0.2s ease;
}

.plecat-photo-story__nav:hover {
	color: rgba(255, 255, 255, 0.8);
}

.plecat-photo-story__nav--prev {
	left: 12px;
}

.plecat-photo-story__nav--next {
	right: 12px;
}

/* === Figure === */

.plecat-photo-story__figure {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	max-width: calc(100% - 140px);
	max-height: 100%;
	overflow: hidden;
	min-height: 0;
}

.plecat-photo-story__image {
	max-width: 100%;
	max-height: calc(100vh - 160px);
	max-height: calc(100dvh - 160px);
	object-fit: contain;
	display: block;
	flex-shrink: 1;
	min-height: 0;
}

.plecat-photo-story__caption {
	color: rgba(255, 255, 255, 0.7);
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--xx-small);
	font-style: normal;
	font-weight: 400;
	line-height: 1.5;
	text-align: center;
	max-width: 480px;
	margin: 14px 0 0;
	padding: 0;
	flex-shrink: 0;
}

/* === Gallery grid: hide captions (visible in lightbox/story) === */

.wp-block-gallery .wp-block-image figcaption {
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	white-space: nowrap;
}

/* === Focus styles === */

.plecat-photo-story button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* === Mobile === */

@media (max-width: 782px) {
	.plecat-photo-story__nav {
		display: none;
	}

	.plecat-photo-story__figure {
		max-width: 100%;
		padding: 0 16px;
	}

	.plecat-photo-story__image {
		max-height: calc(100vh - 140px);
		max-height: calc(100dvh - 140px);
	}

	.plecat-photo-story__content {
		padding: 32px 0 0;
	}

	.plecat-photo-story__caption {
		font-size: var(--wp--preset--font-size--xx-small);
		padding: 0 12px;
	}
}
