/* ===========================================================================
   Mode: CINEMATIC — full-bleed image, frosted collapsible text panel
   =========================================================================== */

body.m-cinematic { overflow: hidden; }

.stage {
	position: fixed;
	inset: 0;
	overflow: hidden;
	cursor: default;
}
.stage.is-idle { cursor: none; }
.stage.is-idle .navzone .chev { opacity: 0; }

.stage__image {
	position: absolute;
	inset: 0;
	z-index: 1;
	background: var(--night);
}
.stage__image img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	will-change: transform, opacity;
	opacity: 0;
	animation: fade-in 1.2s var(--ease) forwards;
}
@keyframes fade-in { to { opacity: 1; } }

/* Ken Burns drift — variant applied by JS (kb--a … kb--d) */
.kenburns { transform-origin: center; }
.stage__image img.kb--a { animation: fade-in 1.2s var(--ease) forwards, kb-a 26s ease-out forwards; }
.stage__image img.kb--b { animation: fade-in 1.2s var(--ease) forwards, kb-b 26s ease-out forwards; }
.stage__image img.kb--c { animation: fade-in 1.2s var(--ease) forwards, kb-c 30s ease-out forwards; }
.stage__image img.kb--d { animation: fade-in 1.2s var(--ease) forwards, kb-d 30s ease-out forwards; }

@keyframes kb-a { from { transform: scale(1.06) translate(0, 0); }      to { transform: scale(1.16) translate(-2%, -1.5%); } }
@keyframes kb-b { from { transform: scale(1.14) translate(-1.5%, 1%); } to { transform: scale(1.04) translate(1.5%, -1%); } }
@keyframes kb-c { from { transform: scale(1.05) translate(1.5%, 0); }   to { transform: scale(1.15) translate(-1.5%, -2%); } }
@keyframes kb-d { from { transform: scale(1.15) translate(1%, -1.5%); } to { transform: scale(1.06) translate(-1.5%, 1.5%); } }

/* Scrim: vignette + legibility gradient */
.stage__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background:
		radial-gradient(120% 90% at 50% 40%, transparent 45%, rgba(6, 12, 20, 0.55) 100%),
		linear-gradient(to top, rgba(6, 12, 20, 0.78) 0%, rgba(6, 12, 20, 0.30) 26%, transparent 52%),
		linear-gradient(to right, rgba(6, 12, 20, 0.55) 0%, transparent 42%);
}

/* Film grain */
.stage__grain {
	position: absolute;
	inset: -50%;
	z-index: 3;
	pointer-events: none;
	opacity: 0.05;
	mix-blend-mode: overlay;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Corner chrome */
.stage__home,
.stage__meta {
	position: absolute;
	z-index: 6;
	top: max(64px, calc(env(safe-area-inset-top) + 56px));
	opacity: 0.85;
	transition: opacity 0.4s var(--ease);
}
.stage.is-idle .stage__home,
.stage.is-idle .stage__meta { opacity: 0; }

.stage__home {
	left: max(18px, env(safe-area-inset-left));
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	color: var(--ink);
	background: var(--panel);
	border: 1px solid var(--panel-line);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	text-decoration: none;
	transition: opacity 0.4s var(--ease), transform 0.2s var(--ease), background 0.2s;
}
.stage__home:hover { transform: scale(1.08); background: rgba(20, 40, 55, 0.6); }

.stage__meta {
	right: max(20px, env(safe-area-inset-right));
	font-family: var(--display);
	font-size: 20px;
	letter-spacing: 0.06em;
	color: var(--ink);
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}
.stage__count .sep { opacity: 0.5; margin: 0 0.15em; }

/* Click / tap navigation zones */
.navzone {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 26%;
	max-width: 320px;
	z-index: 4;
	display: flex;
	align-items: center;
	text-decoration: none;
	color: var(--ink);
	-webkit-tap-highlight-color: transparent;
}
.navzone--prev { left: 0; justify-content: flex-start; padding-left: clamp(10px, 3vw, 34px); }
.navzone--next { right: 0; justify-content: flex-end; padding-right: clamp(10px, 3vw, 34px); }

.navzone .chev {
	font-family: var(--display);
	font-size: clamp(38px, 6vw, 64px);
	line-height: 1;
	opacity: 0;
	transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
	text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}
.navzone:hover .chev { opacity: 0.9; }
.navzone--prev:hover .chev { transform: translateX(-3px); }
.navzone--next:hover .chev { transform: translateX(3px); }

/* Caption panel */
.caption {
	position: absolute;
	z-index: 7;
	left: max(20px, env(safe-area-inset-left));
	bottom: max(26px, env(safe-area-inset-bottom));
	width: min(440px, calc(100vw - 40px));
	background: var(--panel);
	border: 1px solid var(--panel-line);
	border-radius: 16px;
	backdrop-filter: blur(20px) saturate(1.3);
	-webkit-backdrop-filter: blur(20px) saturate(1.3);
	box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.7);
	transition: transform 0.5s var(--ease), background 0.3s;
}

.caption__toggle {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 30px;
	height: 30px;
	border: 1px solid var(--panel-line);
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.06);
	color: var(--ink);
	cursor: pointer;
	display: grid;
	place-items: center;
	transition: background 0.2s;
}
.caption__toggle:hover { background: rgba(255, 255, 255, 0.14); }
.caption__toggle-icon {
	display: block;
	width: 12px;
	height: 2px;
	background: currentColor;
	position: relative;
}
.caption__toggle-icon::before {
	content: "";
	position: absolute;
	inset: 0;
	background: currentColor;
	transform: rotate(90deg);
	opacity: 0;                 /* open state shows a minus */
	transition: opacity 0.3s var(--ease);
}

.caption__body {
	padding: clamp(18px, 3vw, 28px);
	max-height: 56vh;
	overflow-y: auto;
	overscroll-behavior: contain;
}
.caption__body::-webkit-scrollbar { width: 6px; }
.caption__body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 3px; }

.caption__text {
	margin: 0;
	font-size: clamp(1.02rem, 0.9rem + 0.5vw, 1.28rem);
	line-height: 1.62;
	color: var(--ink);
	text-wrap: pretty;
}

.caption__actions {
	margin-top: 16px;
	padding-top: 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.1);
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.caption__link {
	font-family: var(--display);
	font-size: 1.06rem;
	letter-spacing: 0.02em;
	color: var(--sea-light);
	text-decoration: none;
	width: fit-content;
}
.caption__link:hover { text-decoration: underline; }
.caption__link--muted { color: var(--ink-dim); font-size: 0.98rem; }

/* Collapsed state */
.caption[data-open="false"] { width: auto; }
.caption[data-open="false"] .caption__body {
	max-height: 0;
	padding-top: 0;
	padding-bottom: 0;
	overflow: hidden;
}
.caption[data-open="false"] .caption__toggle { position: static; margin: 8px; }
.caption[data-open="false"] .caption__toggle-icon::before { opacity: 1; }  /* collapsed shows a plus */

/* Tideline (progress) */
.tideline {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 3px;
	z-index: 5;
	background: rgba(255, 255, 255, 0.08);
}
.tideline__fill {
	display: block;
	height: 100%;
	width: calc(var(--progress, 0) * 100%);
	background: linear-gradient(to right, var(--sea), var(--sea-light));
	box-shadow: 0 0 12px 1px rgba(127, 198, 216, 0.5);
	transition: width 0.8s var(--ease);
}

@media (max-width: 640px) {
	.caption {
		left: 0;
		right: 0;
		bottom: 0;
		width: 100%;
		border-radius: 18px 18px 0 0;
		border-bottom: none;
	}
	.caption__body { max-height: 42vh; }
	.navzone { width: 20%; }
	.navzone .chev { opacity: 0.55; }
	.stage__meta { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
	.stage__image img { animation: fade-in 0.3s ease forwards !important; }
	.tideline__fill { transition: none; }
}
