/**
 * Portfolio Displays — page sheets.
 *
 * Shared by both viewers: the Rack flips these, the Desk scrolls them.
 * Every sheet is a paper/ink pair set per page from post meta.
 */

.pfd-page {
	--pfd-paper: #f9fbf2;
	--pfd-ink: #0e1c36;
	position: relative;
	overflow: hidden;
	font-family: inherit;
}

/* The paper itself is a child layer, not the page's own background: PageFlip
   rewrites .pfd-page's style attribute, so anything set there is lost. */
.pfd-sheet {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: var(--pfd-paper);
}

/* Texture and sheen sit UNDER the content. If they sit over it the sheen
   washes the type out and nothing is readable. */
.pfd-page > .pfd-texture,
.pfd-cover > .pfd-texture {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	opacity: var(--pfd-paper-op, 0.42);
	background-image: repeating-linear-gradient(41deg, rgba(14, 28, 54, 0.05) 0 1px, transparent 1px 3px);
}

.pfd-page > .pfd-glare {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	mix-blend-mode: soft-light;
	opacity: var(--pfd-glare-op, 0.16);
	background: linear-gradient(114deg, transparent 26%, rgba(255, 255, 255, 0.55) 44%, transparent 66%);
}

.pfd-page-inner {
	color: var(--pfd-ink);
	position: absolute;
	inset: 0;
	z-index: 3;
	display: flex;
	flex-direction: column;
}

/* --- Running head ------------------------------------------------- */

.pfd-page-head {
	display: flex;
	justify-content: space-between;
	padding: 14px clamp(16px, 2.2vw, 34px) 0;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.22em;
	text-transform: uppercase;
}

.pfd-page-head span:first-child { opacity: 0.62; }
.pfd-page-head span:last-child { opacity: 0.38; }

/* --- Type --------------------------------------------------------- */

.pfd-h {
	margin: 0 0 0.5em;
	font-size: clamp(21px, 2.9vw, 40px);
	font-weight: 900;
	line-height: 0.99;
	letter-spacing: -0.042em;
	text-transform: uppercase;
	text-wrap: balance;
	color: inherit;
}

.pfd-page p {
	margin: 0 0 0.7em;
	max-width: 48ch;
	font-size: clamp(12px, 1.05vw, 14px);
	line-height: 1.64;
	opacity: 0.84;
	text-wrap: pretty;
}

.pfd-page-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: clamp(10px, 1.4vw, 18px);
	padding: clamp(16px, 2.2vw, 34px);
	min-height: 0;
}

/* --- Media -------------------------------------------------------- */

.pfd-media {
	position: relative;
	overflow: hidden;
	background: rgba(14, 28, 54, 0.08);
}

.pfd-media img,
.pfd-video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.pfd-media--fill { width: 100%; height: 100%; }

.pfd-media--ratio { height: 0; }
.pfd-media--ratio img {
	position: absolute;
	inset: 0;
}

.pfd-video {
	background: #0e1c36;
	object-fit: cover;
}

/* --- Layouts ------------------------------------------------------ */

.pfd-bleed {
	position: absolute;
	inset: 0;
}
.pfd-bleed .pfd-media,
.pfd-bleed .pfd-video { width: 100%; height: 100%; }

.pfd-bleed-cap {
	position: relative;
	margin-top: auto;
	padding: clamp(16px, 2.2vw, 34px);
	color: #f9fbf2;
	background: linear-gradient(0deg, rgba(14, 28, 54, 0.86), rgba(14, 28, 54, 0.4) 60%, transparent);
}
.pfd-bleed-cap .pfd-h { color: #f9fbf2; }
.pfd-bleed-cap p { color: rgba(249, 251, 242, 0.9); opacity: 1; }

.pfd-split {
	flex: 1;
	display: grid;
	grid-template-columns: 1fr 1fr;
	min-height: 0;
}
.pfd-split-media { position: relative; overflow: hidden; }
/* Without the overflow guard a long body pushes past the sheet edge instead of
   being clipped by it — a page is a fixed box, not a scrolling column. */
.pfd-split-text {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 10px;
	padding: clamp(16px, 2.2vw, 34px);
	min-width: 0;
	min-height: 0;
	overflow: hidden;
}

.pfd-twocol {
	columns: 2;
	column-gap: clamp(16px, 2vw, 30px);
}
.pfd-twocol p { max-width: none; }

.pfd-grid {
	display: grid;
	grid-template-columns: repeat(var(--pfd-cols, 2), 1fr);
	gap: 8px;
	flex: 1;
	min-height: 0;
}
.pfd-tile { min-height: 80px; }

.pfd-vstack {
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
	min-height: 0;
}
.pfd-vstack-item { flex: 1; min-height: 60px; overflow: hidden; }

.pfd-quote-wrap { justify-content: center; }
.pfd-quote {
	margin: 0;
	font-size: clamp(19px, 2.4vw, 34px);
	font-weight: 700;
	line-height: 1.16;
	letter-spacing: -0.03em;
	text-wrap: balance;
}
.pfd-quote::before { content: "\201C"; }
.pfd-quote::after { content: "\201D"; }
.pfd-cite {
	font-size: 10px;
	font-weight: 600;
	font-style: normal;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	opacity: 0.6;
}

.pfd-metrics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
	gap: clamp(10px, 1.6vw, 22px);
	border-top: 2px solid currentColor;
	padding-top: 14px;
}
.pfd-metric { display: flex; flex-direction: column; gap: 4px; }
.pfd-metric-v {
	font-size: clamp(22px, 2.8vw, 40px);
	font-weight: 900;
	line-height: 0.9;
	letter-spacing: -0.04em;
}
.pfd-metric-l {
	font-size: 9.5px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	opacity: 0.62;
}

.pfd-credits { display: flex; flex-direction: column; }
.pfd-credit {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid currentColor;
	font-size: 11px;
	letter-spacing: 0.04em;
}
.pfd-credit span:first-child {
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: 9.5px;
	opacity: 0.55;
	align-self: center;
}

/* Before / after */
.pfd-ba {
	position: relative;
	flex: 1;
	min-height: 0;
	overflow: hidden;
	--pfd-ba-pos: 50%;
}
.pfd-ba-before,
.pfd-ba-after { position: absolute; inset: 0; }
.pfd-ba-after { clip-path: inset(0 0 0 var(--pfd-ba-pos)); }
.pfd-ba-handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: var(--pfd-ba-pos);
	width: 2px;
	background: #f9fbf2;
	box-shadow: 0 0 0 1px rgba(14, 28, 54, 0.4);
	pointer-events: none;
}
.pfd-ba-range {
	position: absolute;
	inset: auto 0 0;
	width: 100%;
	margin: 0;
	opacity: 0;
	height: 100%;
	cursor: ew-resize;
}

.pfd-pdf {
	flex: 1;
	min-height: 0;
	border: 2px solid currentColor;
}
.pfd-pdf iframe { width: 100%; height: 100%; border: 0; display: block; }

.pfd-embed { flex: 1; min-height: 0; }
.pfd-embed iframe,
.pfd-embed video {
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* --- Buttons ------------------------------------------------------ */

.pfd-cta { gap: 14px; }

.pfd-btn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	align-self: flex-start;
	padding: 12px 16px;
	background: var(--pfd-ink);
	color: var(--pfd-paper);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	border: 0;
	cursor: pointer;
	transition: opacity 0.18s ease;
}
.pfd-btn::after { content: "\2192"; }
.pfd-btn:hover { opacity: 0.82; }
.pfd-btn:focus-visible {
	outline: 2px solid var(--pfd-ink);
	outline-offset: 2px;
}

.pfd-btn--ghost {
	background: transparent;
	color: var(--pfd-ink);
	box-shadow: inset 0 0 0 2px var(--pfd-ink);
}

/* --- Cover sheet -------------------------------------------------- */

.pfd-cover-inner { justify-content: space-between; padding: clamp(18px, 2.4vw, 38px); }
.pfd-cover-art { position: absolute; inset: 0; z-index: 0; }
.pfd-cover-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.pfd-cover-top,
.pfd-cover-bot {
	display: flex;
	justify-content: space-between;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.19em;
	text-transform: uppercase;
}
.pfd-cover-top { opacity: 0.84; }
.pfd-cover-bot { opacity: 0.7; }

.pfd-cover-mid { display: block; }
.pfd-cover-rule {
	display: block;
	height: 5px;
	width: 44%;
	margin-bottom: 13px;
}
.pfd-cover-title {
	display: block;
	font-size: clamp(30px, 4.7vw, 78px);
	font-weight: 900;
	line-height: 0.86;
	letter-spacing: -0.05em;
	text-transform: uppercase;
}
.pfd-cover-disc {
	display: block;
	margin-top: 13px;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 0.19em;
	text-transform: uppercase;
	opacity: 0.78;
}

/* --- Headline animations ------------------------------------------ */

.pfd-page.is-live .pfd-h[data-anim="rise"] { animation: pfd-rise 0.62s cubic-bezier(0.2, 0.9, 0.25, 1) both; }
.pfd-page.is-live .pfd-h[data-anim="wipe"] { animation: pfd-wipe 0.7s cubic-bezier(0.5, 0, 0.2, 1) both; }
.pfd-page.is-live .pfd-h[data-anim="pop"] { animation: pfd-pop 0.5s cubic-bezier(0.2, 1.4, 0.3, 1) both; }
.pfd-page.is-live .pfd-h[data-anim="stagger"] { animation: pfd-rise 0.62s cubic-bezier(0.2, 0.9, 0.25, 1) 0.08s both; }

@keyframes pfd-rise {
	from { opacity: 0; transform: translate3d(0, 14px, 0); }
	to { opacity: 1; transform: none; }
}
@keyframes pfd-wipe {
	from { clip-path: inset(0 100% 0 0); }
	to { clip-path: inset(0 0 0 0); }
}
@keyframes pfd-pop {
	from { opacity: 0; transform: scale(0.94); }
	to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.pfd-page .pfd-h { animation: none !important; }
}

/* --- Narrow ------------------------------------------------------- */

@media (max-width: 640px) {
	.pfd-split { grid-template-columns: 1fr; }
	.pfd-twocol { columns: 1; }
	.pfd-page p { font-size: 13px; }
	.pfd-h { font-size: clamp(19px, 5.6vw, 28px); }
}
