/*
 * Plenum theme stylesheet
 *
 * Baseline grid: 24px (--wp--custom--baseline)
 * Half baseline: 12px (--wp--custom--half-baseline)
 * Vertical rhythm and spacing all derive from these.
 */

:root {
	color-scheme: dark;
}

/* Cross-document View Transitions: opt the whole site into flash-free
   navigation. Matched view-transition-names below morph the strip thumb
   into the detail image and back. */
@view-transition { navigation: auto; }

.plenum-strip__item img,
.plenum-detail__media img {
	view-transition-name: var(--vt-name, none);
}

::view-transition-group(*),
::view-transition-old(*),
::view-transition-new(*) {
	animation-duration: 520ms;
	animation-timing-function: cubic-bezier(0.34, 1.18, 0.55, 1);
}

::view-transition-old(root),
::view-transition-new(root) {
	animation-duration: 280ms;
	animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html, body {
	background: var(--wp--preset--color--ground);
	color: var(--wp--preset--color--ink);
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-feature-settings: "kern", "liga", "tnum";
	text-rendering: optimizeLegibility;
}

/* Lock the viewport on any page that contains a photostrip:
   no vertical page scroll, the strip owns horizontal motion. */
html:has(.plenum-strip),
body:has(.plenum-strip) {
	height: 100%;
	overflow: hidden;
}

body:has(.plenum-strip) .plenum-main {
	position: fixed;
	inset: 0;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: stretch;
}

body:has(.plenum-strip) .plenum-main > * {
	width: 100%;
	max-width: none;
}

img, video { display: block; max-width: 100%; height: auto; }

/* HEADER
   Compact site title row aligned to baseline.
*/
.plenum-site-header,
.plenum-site-footer {
	padding: var(--wp--custom--baseline) var(--wp--custom--edge);
}

body:has(.plenum-strip) .plenum-site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 10;
	background: transparent;
	pointer-events: none;
}

body:has(.plenum-strip) .plenum-site-header a,
body:has(.plenum-strip) .plenum-site-header button {
	pointer-events: auto;
}

.plenum-site-header__inner {
	display: flex !important;
	flex-direction: row !important;
	justify-content: flex-start !important;
	align-items: baseline;
	gap: var(--wp--custom--baseline);
}

.plenum-header-close,
.plenum-header-about {
	appearance: none;
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0;
	font-family: var(--wp--preset--font-family--wetzlar);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: inherit;
	cursor: pointer;
	transition: color 180ms ease;
}

.plenum-header-about { color: var(--wp--preset--color--ink-muted); order: 1; }
.plenum-header-about:hover { color: var(--wp--preset--color--ink); }

.plenum-header-close { color: var(--wp--preset--color--ink-muted); order: 2; margin-left: auto !important; }
.plenum-header-close:hover { color: var(--wp--preset--color--ink); }

@media (min-width: 1100px) {
	.plenum-header-close { display: none; }
}

.plenum-about-overlay {
	position: fixed;
	inset: 0;
	z-index: 60;
	background: rgba(10, 10, 10, 0.92);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--wp--custom--baseline);
	cursor: zoom-out;
	animation: plenum-about-fade 240ms ease-out;
}

@keyframes plenum-about-fade {
	from { opacity: 0; }
	to { opacity: 1; }
}

.plenum-about {
	max-width: 32rem;
	width: 100%;
	cursor: default;
	font-family: var(--wp--preset--font-family--wetzlar);
	font-size: 0.9375rem;
	line-height: 1.55;
	color: var(--wp--preset--color--ink);
}

.plenum-about p {
	margin: 0;
}

.plenum-about p + p,
.plenum-about__content > * + * {
	margin-top: var(--wp--custom--baseline);
}

.plenum-about__content > :first-child {
	margin-top: 0;
}

.plenum-about__credit {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-muted);
}

.plenum-about a {
	color: var(--wp--preset--color--ink);
	text-decoration: underline;
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
	text-decoration-color: var(--wp--preset--color--ink-muted);
}

.plenum-about a:hover {
	text-decoration-color: var(--wp--preset--color--ink);
}

.plenum-site-header .wp-block-site-title a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	font-weight: 500;
}

.plenum-site-header .plenum-nav a {
	color: var(--wp--preset--color--ink-muted);
	text-decoration: none;
	font-size: var(--wp--preset--font-size--small);
	margin-left: var(--wp--custom--baseline);
}

.plenum-site-header .plenum-nav a:hover { color: var(--wp--preset--color--ink); }

/* STRIP
   Horizontal photostrip. Single row of photographs at a fixed strip height,
   vertically centered in the viewport, bleeding off the horizontal edges,
   each preserving its own aspect ratio. Scrolls horizontally.
*/
:root {
	--plenum-header-h: calc(var(--wp--custom--baseline) * 2 + 1.25rem);
	--plenum-strip-h: clamp(180px, min(56vw, 42svh), 560px);
}

.plenum-strip {
	position: relative;
	height: var(--plenum-strip-h);
	width: 100%;
	overflow: hidden;
	cursor: grab;
	user-select: none;
	-webkit-user-select: none;
	touch-action: pan-y;
}

.plenum-strip__viewport {
	position: relative;
	height: 100%;
	width: 100%;
	transform: scale(var(--plenum-strip-scale, 1));
	transform-origin: center center;
	will-change: transform;
	transition: transform 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.plenum-strip.is-dragging .plenum-strip__viewport,
.plenum-strip.is-flinging .plenum-strip__viewport {
	transition: none;
}

.plenum-strip__track {
	display: flex;
	flex-wrap: nowrap;
	gap: var(--wp--custom--baseline);
	height: 100%;
	padding-left: var(--wp--custom--edge);
	padding-right: var(--wp--custom--edge);
	will-change: transform;
}

.plenum-strip.is-dragging { cursor: grabbing; }
.plenum-strip.is-dragging a { pointer-events: none; }
.plenum-strip a,
.plenum-strip img { -webkit-user-drag: none; user-drag: none; }
.plenum-strip img { pointer-events: none; }

.plenum-strip::-webkit-scrollbar { height: 6px; }
.plenum-strip::-webkit-scrollbar-thumb {
	background: var(--wp--preset--color--hairline);
	border-radius: 999px;
}

.plenum-strip__item {
	position: relative;
	flex: 0 0 auto;
	height: 100%;
	background: rgba(255, 255, 255, 0.04);
	overflow: hidden;
	border-radius: 2px;
}

.plenum-strip__item a {
	display: block;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.plenum-strip__item img {
	height: 100%;
	width: auto;
	max-width: none;
	object-fit: cover;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.plenum-strip__item[data-loaded="true"] img {
	opacity: 1;
}

.plenum-strip__caption {
	position: absolute;
	left: var(--wp--custom--baseline);
	bottom: var(--wp--custom--baseline);
	right: var(--wp--custom--baseline);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-family: var(--wp--preset--font-family--wetzlar);
	opacity: 0;
	transform: translateY(0.5rem);
	transition: opacity 240ms ease, transform 240ms ease;
	pointer-events: none;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}

@media (hover: hover) {
	.plenum-strip__item:hover .plenum-strip__caption {
		opacity: 1;
		transform: translateY(0);
	}
}

.plenum-strip__caption .date { display: block; }
.plenum-strip__caption .place { color: var(--wp--preset--color--ink-muted); display: block; }

/* DETAIL OVERLAY
   In-document detail view rendered by the Preact app. Sits above the strip
   as a full-viewport overlay with a dim ground. The image morphs in from
   the clicked thumb's rect via Motion spring (in plenum-app.js).
*/
.plenum-detail-overlay {
	position: fixed;
	inset: 0;
	z-index: 50;
	background: rgba(10, 10, 10, 0.92);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: auto;
	cursor: zoom-out;
}

.plenum-detail-overlay .plenum-detail {
	min-height: auto;
	cursor: default;
}

/* DETAIL
   Single photograph view. Image centered, EXIF rail to the right on wide screens,
   stacked underneath on narrow.
*/
.plenum-detail {
	min-height: 100vh;
	min-height: 100svh;
	padding-top: var(--wp--custom--baseline);
	padding-bottom: calc(var(--wp--custom--baseline) * 2);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--wp--custom--baseline);
	max-width: 900px;
	margin: 0 auto;
}

@media (min-width: 1100px) {
	.plenum-detail {
		display: grid;
		grid-template-columns: 1fr 220px;
		gap: calc(var(--wp--custom--baseline) * 2);
		align-items: start;
		justify-items: stretch;
		max-width: none;
		padding: calc(var(--wp--custom--baseline) * 2) calc(var(--wp--custom--baseline) * 2);
	}
	.plenum-detail__media { justify-self: center; }
}

.plenum-detail__toggle {
	appearance: none;
	background: transparent;
	border: 0;
	color: var(--wp--preset--color--ink-muted);
	font-family: var(--wp--preset--font-family--wetzlar);
	font-size: var(--wp--preset--font-size--small);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: var(--wp--custom--half-baseline) var(--wp--custom--baseline);
	cursor: pointer;
	transition: color 180ms ease;
}

.plenum-detail__toggle:hover { color: var(--wp--preset--color--ink); }
.plenum-detail__toggle:focus-visible { outline: 1px solid var(--wp--preset--color--hairline); outline-offset: 4px; }

.plenum-detail__meta[data-show="false"] { display: none; }

@media (min-width: 1100px) {
	.plenum-detail__toggle { display: none; }
	.plenum-detail__meta[data-show="false"] { display: grid; }
}

.plenum-detail__media {
	max-width: min(900px, 100%);
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	touch-action: auto;
	cursor: default;
	user-select: none;
	-webkit-user-select: none;
}

.plenum-detail__media img {
	max-width: 100%;
	max-height: calc(100svh - 8rem);
	width: auto;
	height: auto;
	object-fit: contain;
	-webkit-user-drag: none;
	user-drag: none;
}

@media (max-width: 767px), (pointer: coarse) {
	.plenum-detail__media {
		touch-action: none;
		cursor: grab;
	}

	.plenum-detail.is-gesture-dragging .plenum-detail__media { cursor: grabbing; }
}

@media (min-width: 1100px) {
	.plenum-detail__media {
		max-width: 80%;
	}
	.plenum-detail__media img {
		max-height: 72svh;
	}
}

.plenum-detail__meta {
	font-family: var(--wp--preset--font-family--wetzlar);
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--baseline);
	display: grid;
	grid-template-columns: max-content 1fr;
	column-gap: 0;
	row-gap: 0;
	align-content: start;
	width: 100%;
	max-width: 28rem;
	margin: 0 auto;
}

.plenum-detail__meta dt,
.plenum-detail__meta dd {
	padding: calc(var(--wp--custom--half-baseline) / 2) 0;
	border-top: 1px solid var(--wp--preset--color--hairline);
}

.plenum-detail__meta dt {
	color: var(--wp--preset--color--ink-muted);
	padding-right: var(--wp--custom--baseline);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.plenum-detail__meta dd {
	margin: 0;
	color: var(--wp--preset--color--ink);
	text-align: right;
	min-width: 0;
	overflow-wrap: anywhere;
}

/* BUTTONS
   Pill, low key, used for Flow / Grid / Map and the close button.
*/
.plenum-pill {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	height: calc(var(--wp--custom--baseline) * 1.5);
	padding: 0 0.875rem;
	border-radius: 999px;
	background: var(--wp--preset--color--ground-raised);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--wetzlar);
	font-size: var(--wp--preset--font-size--small);
	text-decoration: none;
	border: 1px solid var(--wp--preset--color--hairline);
	transition: background 180ms ease, color 180ms ease;
}

.plenum-pill:hover { background: var(--wp--preset--color--hairline); }
.plenum-pill[aria-current="true"] { background: var(--wp--preset--color--hairline); color: var(--wp--preset--color--ink); }

/* PROSE
   Body copy in single posts and pages. Capped at a comfortable measure,
   line-height locked to baseline.
*/
.plenum-prose {
	max-width: 38rem;
	margin: 0 auto;
}

.plenum-prose p {
	margin: 0 0 var(--wp--custom--baseline) 0;
	line-height: var(--wp--custom--baseline);
}

.plenum-prose p:last-child { margin-bottom: 0; }
