/* Then and now (hsp/then-now) and its list (hsp/then-now-list). */

.hsp-then-now {
	--tn-ink: var(--c-navy-dark, #10233f);
	--tn-accent: var(--c-sun, #f2b632);
	margin-block: 1.75rem;
	font-family: var(--hsp-sans, system-ui, sans-serif);
}

/* Side by side: without JavaScript, or when the editor chose it. */
.hsp-then-now__stage {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
	gap: 0.5rem;
}
.hsp-then-now__pane { position: relative; margin: 0; overflow: hidden; border-radius: 4px; background: var(--tn-ink); }
.hsp-then-now__img { display: block; width: 100%; height: 100%; aspect-ratio: var(--ratio, 1.5); object-fit: cover; }
.hsp-then-now__label {
	position: absolute;
	top: 0.6rem;
	left: 0.6rem;
	padding: 0.25rem 0.6rem;
	border-radius: 3px;
	background: rgb(16 35 63 / 0.82);
	color: #fff;
	font-size: 0.85rem;
	font-weight: 650;
	line-height: 1.25;
	letter-spacing: 0.01em;
	pointer-events: none;
}
.hsp-then-now__pane.is-then { order: -1; }
.hsp-then-now__pane.is-then .hsp-then-now__label { background: var(--tn-accent); color: var(--tn-ink); }

/* The slider, once then-now.js has started. */
.hsp-then-now.is-ready .hsp-then-now__stage {
	display: block;
	position: relative;
	aspect-ratio: var(--ratio, 1.5);
	overflow: hidden;
	border-radius: 4px;
	background: var(--tn-ink);
	touch-action: pan-y;
	user-select: none;
	-webkit-user-select: none;
	cursor: ew-resize;
}
.hsp-then-now.is-ready .hsp-then-now__pane { position: absolute; inset: 0; border-radius: 0; }
.hsp-then-now.is-ready .hsp-then-now__img { aspect-ratio: auto; -webkit-user-drag: none; }
.hsp-then-now.is-ready .hsp-then-now__pane.is-then { clip-path: inset(0 calc(100% - var(--pos, 50%)) 0 0); }
.hsp-then-now.is-ready .hsp-then-now__pane.is-now .hsp-then-now__label { left: auto; right: 0.6rem; }

.hsp-then-now__handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--pos, 50%);
	width: 3px;
	margin-left: -1.5px;
	background: #fff;
	box-shadow: 0 0 0 1px rgb(16 35 63 / 0.35);
	pointer-events: none;
}
.hsp-then-now__grip {
	position: absolute;
	top: 50%;
	left: 50%;
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	margin: -1.375rem 0 0 -1.375rem;
	border-radius: 50%;
	background: #fff;
	color: var(--tn-ink);
	box-shadow: 0 1px 6px rgb(0 0 0 / 0.35);
}
.hsp-then-now:not(.is-ready) .hsp-then-now__handle { display: none; }

/* The range input does the keyboard and screen-reader work; the photo takes the pointer. */
.hsp-then-now__range {
	position: absolute;
	inset: auto 0 0 0;
	width: 100%;
	height: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}
.hsp-then-now:has(.hsp-then-now__range:focus-visible) .hsp-then-now__grip { outline: 3px solid var(--tn-accent); outline-offset: 2px; }
.hsp-then-now.is-dragging .hsp-then-now__grip { transform: scale(1.08); }

.hsp-then-now__caption { display: grid; gap: 0.2rem; margin-top: 0.55rem; font-size: 0.95rem; line-height: 1.45; text-align: left; }
.hsp-then-now__credit { color: var(--hsp-muted, #5b6472); font-size: 0.85rem; }

@media (prefers-reduced-motion: no-preference) {
	.hsp-then-now.is-gliding .hsp-then-now__pane.is-then { transition: clip-path 0.35s ease; }
	.hsp-then-now.is-gliding .hsp-then-now__handle { transition: left 0.35s ease; }
}

/* ------------------------------------------------------------------ The list */

.hsp-then-now-list { margin-block: 2rem; font-family: var(--hsp-sans, system-ui, sans-serif); }
.hsp-then-now-list__heading { margin: 0 0 0.9rem; }
.hsp-then-now-list__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	gap: 1.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.hsp-then-now-list__link { display: grid; gap: 0.3rem; color: inherit; text-decoration: none; }
.hsp-then-now-list__pair {
	position: relative;
	display: grid;
	grid-template-columns: 1fr 1fr;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	border-radius: 4px;
	background: var(--c-navy-dark, #10233f);
}
.hsp-then-now-list__pair::after {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 3px;
	margin-left: -1.5px;
	background: #fff;
}
.hsp-then-now-list__img { width: 100%; height: 100%; object-fit: cover; }
.hsp-then-now-list__title { font-weight: 650; line-height: 1.3; color: var(--c-navy, #1b365d); }
.hsp-then-now-list__link:hover .hsp-then-now-list__title { color: var(--c-orange, #c44116); text-decoration: underline; }
.hsp-then-now-list__link:focus-visible { outline: 3px solid var(--c-orange, #c44116); outline-offset: 3px; border-radius: 4px; }
.hsp-then-now-list__years { font-size: 0.88rem; color: var(--hsp-muted, #5b6472); }

/* ------------------------------------------------------------ In the editor */

.hsp-tn-placeholder { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; width: 100%; }
.hsp-tn-placeholder__col { display: grid; gap: 0.5rem; align-content: start; }
.hsp-tn-picker { display: grid; gap: 0.5rem; justify-items: start; }
.hsp-tn-picker__thumb { display: block; max-width: 100%; max-height: 9rem; border-radius: 3px; }
.editor-styles-wrapper .hsp-then-now .hsp-then-now__stage { cursor: default; }
