/* =========================================================
   Journey: story-player.css (ours)
   The video-story player built by story-player.js, played like
   Instagram stories: a bar per chapter across the top, the
   person and the chapter under it, the video below; a tap on
   either side of the video moves a chapter. Arrows sit beside
   it on wide screens; on phones it fills the screen.
   Tokens from global.css.
   ========================================================= */

html.jsp-lock, html.jsp-lock body { overflow: hidden; }

.jsp {
	--jsp-ease: cubic-bezier(.16, 1, .3, 1);
	--jsp-top: 82px;
	/* the video is 16:9 and as large as fits, with room for the arrows beside it */
	--jsp-w: min(1100px, calc(100vw - 224px), calc((100vh - 64px - var(--jsp-top)) * 16 / 9));
	position: fixed; inset: 0; z-index: 10000;
	display: flex; align-items: center; justify-content: center; gap: 28px;
	padding: 32px;
	font-family: var(--sans, 'Inter', system-ui, sans-serif);
	-webkit-tap-highlight-color: transparent;
}
.jsp[hidden] { display: none; }
.jsp-backdrop {
	position: absolute; inset: 0;
	background: rgba(14, 13, 11, .86);
	-webkit-backdrop-filter: blur(14px) saturate(.9); backdrop-filter: blur(14px) saturate(.9);
	opacity: 0; transition: opacity .38s ease;
}
.jsp-dialog {
	position: relative; display: flex; flex-direction: column;
	width: var(--jsp-w); max-width: 100%;
	background: #121211; border-radius: 20px; overflow: hidden;
	box-shadow: 0 40px 120px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
	opacity: 0; transform: translateY(18px) scale(.975);
	transition: opacity .42s var(--jsp-ease), transform .55s var(--jsp-ease);
}
.jsp.is-open .jsp-backdrop { opacity: 1; }
.jsp.is-open .jsp-dialog { opacity: 1; transform: none; }
.jsp.is-closing .jsp-backdrop { opacity: 0; transition-duration: .28s; }
.jsp.is-closing .jsp-dialog { opacity: 0; transform: translateY(10px) scale(.985); transition-duration: .26s; }
/* moving to the next or previous person: the card slides out a little and back */
.jsp.is-open .jsp-dialog.is-swap-next { opacity: 0; transform: translateX(-24px) scale(.985); transition-duration: .18s; }
.jsp.is-open .jsp-dialog.is-swap-prev { opacity: 0; transform: translateX(24px) scale(.985); transition-duration: .18s; }

/* ---- the top: bars, then who and which chapter ---- */
.jsp-top { position: relative; flex: none; padding: 10px 14px 12px; color: #fff; }
.jsp-bars { display: flex; gap: 5px; }
.jsp-seg {
	flex: 1; min-width: 0; height: 16px; padding: 0; margin: 0; border: 0; background: none; cursor: pointer;
	display: flex; align-items: center; border-radius: 4px;
}
.jsp-seg i { position: relative; display: block; width: 100%; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .26); overflow: hidden; transition: height .15s ease, background .15s ease; }
.jsp-seg b { position: absolute; inset: 0; background: #fff; transform-origin: 0 50%; transform: scaleX(0); border-radius: inherit; }
.jsp-seg:hover i, .jsp-seg:focus-visible i { height: 5px; background: rgba(255, 255, 255, .38); }
.jsp-dialog.no-chapters .jsp-seg { cursor: default; }
.jsp-tip {
	position: absolute; top: 30px; transform: translateX(-50%); white-space: nowrap; pointer-events: none; z-index: 3;
	background: rgba(250, 248, 243, .96); color: #111; border-radius: 8px; padding: 6px 10px;
	font: 500 12.5px/1.2 var(--sans, 'Inter', sans-serif); box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}
.jsp-tip[hidden] { display: none; }

.jsp-head { display: flex; align-items: center; gap: 12px; margin-top: 6px; min-height: 44px; }
.jsp-avatar {
	flex: none; width: 42px; height: 42px; border-radius: 50%; padding: 2px;
	background: conic-gradient(from 210deg, #cea96f, #f1e4c3, #b7913f, #cea96f);
}
.jsp-avatar[hidden] { display: none; }
.jsp-avatar img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid #121211; background: #2a2926; }
.jsp-who { flex: 1; min-width: 0; }
.jsp-line { margin: 0; font: 400 13.5px/1.3 var(--sans, 'Inter', sans-serif); color: rgba(255, 255, 255, .62); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.jsp-name { font-weight: 600; color: #fff; margin-right: 4px; }
.jsp-ch { position: relative; margin: 3px 0 0; height: 22px; overflow: hidden; font: 400 16px/22px var(--serif, 'Lora', Georgia, serif); color: #fff; }
.jsp-ch-in {
	position: absolute; left: 0; right: 0; top: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	transition: transform .42s var(--jsp-ease), opacity .3s ease;
}
.jsp-ch-in.is-enter { transform: translateY(100%); opacity: 0; transition: none; }
.jsp-ch-in.is-enter.is-back { transform: translateY(-100%); }
.jsp-ch-in.is-leave { transform: translateY(-100%); opacity: 0; }
.jsp-ch-in.is-leave.is-back { transform: translateY(100%); }
.jsp-ch-n { font: 600 11.5px/22px var(--sans, 'Inter', sans-serif); letter-spacing: .08em; color: #cea96f; margin-right: 6px; font-variant-numeric: tabular-nums; }
.jsp-ch-t { font: 500 12px/22px var(--sans, 'Inter', sans-serif); color: rgba(255, 255, 255, .45); margin-left: 6px; font-variant-numeric: tabular-nums; }

.jsp-tools { flex: none; display: flex; align-items: center; gap: 2px; }
.jsp-btn {
	flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: #fff;
	display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0;
	transition: background .18s ease;
}
.jsp-btn:hover { background: rgba(255, 255, 255, .12); }
.jsp-btn svg { width: 22px; height: 22px; }
.jsp-close { background: rgba(255, 255, 255, .1); margin-left: 4px; }
.jsp-close:hover { background: rgba(255, 255, 255, .2); }

/* ---- the video, and the two halves you tap ---- */
.jsp-stage { position: relative; flex: none; width: 100%; aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.jsp-stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; display: block; }
.jsp-tap {
	position: absolute; top: 0; bottom: 0; z-index: 1; margin: 0; padding: 0; border: 0; background: transparent;
	cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none;
}
.jsp-tap-prev { left: 0; width: 30%; cursor: w-resize; }
.jsp-tap-next { right: 0; width: 70%; cursor: e-resize; }
.jsp-tap:focus-visible { outline: none; box-shadow: inset 0 0 0 3px rgba(206, 169, 111, .8); }
/* held down: paused, and the top fades back so the picture is all there is */
.jsp-dialog.is-held .jsp-top { opacity: .35; transition: opacity .2s ease; }

.jsp-hint {
	position: absolute; right: 22px; bottom: 22px; z-index: 2; margin: 0; pointer-events: none;
	display: flex; align-items: center; gap: 10px;
	opacity: 0; transform: translateX(-10px); transition: opacity .35s ease, transform .5s var(--jsp-ease);
}
.jsp-hint span {
	background: rgba(250, 248, 243, .95); color: #111; border-radius: 999px; padding: 10px 16px 10px 14px;
	font: 600 13.5px/1.2 var(--sans, 'Inter', sans-serif); box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
.jsp-hint::after {
	content: ''; width: 34px; height: 34px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .85);
	animation: jsp-tap 1.3s ease-in-out infinite;
}
.jsp-hint.is-on { opacity: 1; transform: none; }
@keyframes jsp-tap { 0%, 100% { transform: scale(1); opacity: .9; } 50% { transform: scale(.72); opacity: .45; } }

.jsp-big {
	position: absolute; left: 50%; top: 50%; z-index: 2; width: 84px; height: 84px; margin: -42px 0 0 -42px;
	border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: #0F0F0F; cursor: pointer;
	display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 34px rgba(0, 0, 0, .35);
	transition: transform .2s var(--jsp-ease);
}
.jsp-big:hover { transform: scale(1.05); }
.jsp-big svg { width: 34px; height: 34px; margin-left: 4px; }
.jsp-big[hidden] { display: none; }

/* after the last frame: watch again, or the next story */
.jsp-end {
	position: absolute; inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; padding: 16px;
	background: rgba(12, 12, 10, .62); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
	animation: jsp-in .4s ease both;
}
@keyframes jsp-in { from { opacity: 0; } }
.jsp-end[hidden] { display: none; }
.jsp-end button {
	border: 1px solid rgba(255, 255, 255, .28); background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer;
	border-radius: 999px; padding: 12px 22px; display: inline-flex; align-items: center; gap: 10px;
	font: 600 15px/1.2 var(--sans, 'Inter', sans-serif); transition: background .18s;
}
.jsp-end button:hover { background: rgba(255, 255, 255, .18); }
.jsp-end svg { width: 20px; height: 20px; }
.jsp-end .jsp-next { gap: 12px; padding: 8px 20px 8px 8px; text-align: left; background: #fff; color: #0F0F0F; border-color: #fff; }
.jsp-end .jsp-next:hover { background: #f1ede4; }
.jsp-end .jsp-next img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.jsp-end .jsp-next > span { display: flex; flex-direction: column; gap: 2px; }
.jsp-next-k { font: 600 11px/1.2 var(--sans, 'Inter', sans-serif); letter-spacing: .14em; text-transform: uppercase; color: #a8864f; }

/* ---- the arrows beside the card (wide screens) ---- */
.jsp-arrow {
	position: relative; z-index: 1; flex: none; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%;
	background: rgba(255, 255, 255, .92); color: #111; cursor: pointer;
	display: flex; align-items: center; justify-content: center; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
	opacity: 0; transform: scale(.9); transition: opacity .4s ease .12s, transform .5s var(--jsp-ease) .12s, background .18s ease;
}
.jsp-arrow svg { width: 24px; height: 24px; }
.jsp-arrow:hover { background: #fff; transform: scale(1.06); }
.jsp.is-open .jsp-arrow { opacity: 1; transform: none; }
.jsp.is-closing .jsp-arrow { opacity: 0; transition-delay: 0s; transition-duration: .2s; }

.jsp button:focus-visible { outline: 2px solid #cea96f; outline-offset: 2px; }

/* ---- phones and narrow windows: the whole screen, black, like a phone's stories ---- */
@media (max-width: 760px), (max-aspect-ratio: 4 / 5) {
	.jsp { padding: 0; gap: 0; }
	.jsp-arrow { display: none; }
	.jsp-backdrop { background: #000; }
	.jsp-dialog {
		width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; background: #000; box-shadow: none;
		padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px);
	}
	.jsp-top { padding: 8px 10px 10px; }
	/* the video sits in the middle, and the whole screen below the top is tappable */
	.jsp-stage { flex: 1 1 auto; aspect-ratio: auto; min-height: 0; }
	.jsp-line { font-size: 13px; }
	.jsp-ch { font-size: 15px; }
	.jsp-btn { width: 38px; height: 38px; }
	.jsp-play { display: none; } /* hold to pause instead */
	.jsp-big { width: 72px; height: 72px; margin: -36px 0 0 -36px; }
	.jsp-hint { right: 50%; bottom: max(28px, env(safe-area-inset-bottom, 0px)); transform: translate(50%, 10px); }
	.jsp-hint.is-on { transform: translate(50%, 0); }
}

@media (prefers-reduced-motion: reduce) {
	.jsp-backdrop, .jsp-dialog, .jsp-arrow { transition: opacity .15s linear !important; transform: none !important; }
	.jsp-hint::after { animation: none; }
}
