/*
 * Kontradiktion — styling for Divi-free edition content.
 * Scoped to .k-piece / .k-edition so it never touches legacy Divi pages.
 * "Custom CSS is fine for now" — this is a tasteful starting point, easy to refine.
 */

.k-piece,
.k-edition {
	max-width: 46rem;
	margin-inline: auto;
	padding-inline: 1.25rem;
}

/* --- A single piece --- */
.k-piece__byline {
	font-style: italic;
	opacity: 0.75;
	margin-bottom: 1.5rem;
}

.k-piece__lead {
	font-size: 1.25rem;
	line-height: 1.6;
	margin-bottom: 1.75rem;
}

.k-piece p {
	line-height: 1.8;
}

/* --- Edition landing page --- */
.k-edition__title {
	margin-bottom: 0.25em;
	line-height: 1.1;
}

.k-edition__intro {
	font-size: 1.15rem;
	opacity: 0.85;
	margin-bottom: 2.5rem;
}

.k-edition__pieces .wp-block-post-template {
	display: flex;
	flex-direction: column;
	gap: 1.75rem;
	list-style: none;
	padding: 0;
}

.k-edition__pieces .wp-block-post-title {
	margin: 0 0 0.25rem;
}

.k-edition__pieces .wp-block-post-excerpt {
	opacity: 0.8;
	margin: 0;
}

/* --- Image piece --- */
.k-piece__image {
	margin: 1.5rem 0;
}
.k-piece__image figcaption {
	font-size: 0.85rem;
	opacity: 0.7;
}

/* --- Preview piece: a poster that links to a full-screen work --- */
.k-preview__poster img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}
.k-preview__cta {
	margin-top: 1rem;
}

/* --- Video piece: inline responsive embed (vimeo/youtube) or self-hosted video --- */
.k-video {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	margin: 1.5rem auto;
}
.k-video iframe,
.k-video video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
/* Native block video (new-edition wp:video pattern): full-width, centred in the column. */
.k-piece .wp-block-video video,
.k-piece__video video {
	display: block;
	width: 100%;
	height: auto;
}

/* --- Embedded interactive (custom HTML/JS/CSS) piece --- */
.k-embed__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 10;
	margin: 1.5rem 0;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 4px;
	overflow: hidden;
	background: #0b0b0c;
}
.k-embed__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}
.k-embed__caption {
	font-size: 0.85rem;
	opacity: 0.7;
}

/* =====================================================================
 * Plugin-rendered surfaces (body.k-site only — never touches Divi pages)
 * Brand: fixed black background, white text, Kepler Std (light) serif.
 * Identity cues from the current site: a big tracked KONTRADIKTION wordmark,
 * down chevrons between sections, /// slash motifs (content-driven), outlined
 * buttons, an airy centred rhythm. Tokens keep richer theming a wiring change
 * (references/adr/0001).
 * ===================================================================== */
body.k-site {
	--k-bg: #000;
	--k-fg: #fff;
	--k-muted: rgba(255, 255, 255, 0.66);
	--k-rule: rgba(255, 255, 255, 0.16);
	--k-measure: 42rem;
	--k-header-h: 4rem;
	margin: 0;
	background: var(--k-bg) !important;
	color: var(--k-fg);
	font-family: kepler-std, Georgia, "Times New Roman", serif;
	font-weight: 300;
	font-size: 1.0625rem;
	line-height: 1.75;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
body.k-site a {
	color: inherit;
}
body.k-site img,
body.k-site video {
	max-width: 100%;
	height: auto;
}
/* Own the bare elements so any residual Divi base typography can't leak in. */
.k-site h1,
.k-site h2,
.k-site h3,
.k-site h4,
.k-site h5,
.k-site h6,
.k-site p,
.k-site li,
.k-site a,
.k-site figcaption,
.k-site blockquote {
	font-family: inherit;
	color: inherit;
}
.k-site h1,
.k-site h2,
.k-site h3,
.k-site h4 {
	font-weight: 300;
	line-height: 1.15;
}

.k-site .k-site__inner {
	max-width: 66rem;
	margin-inline: auto;
	padding: 3rem 1.5rem 5rem;
}

/* --- Chrome: a sticky top bar — brand (left) + menu (right) --- */
.k-header {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1.5rem;
	min-height: var(--k-header-h);
	padding: 0 1.5rem;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--k-rule);
}
/* Compact stacked wordmark used as the logo mark in the bar. */
.k-brand {
	flex: 0 0 auto;
	text-decoration: none;
	text-transform: uppercase;
	font-weight: 300;
	font-size: 0.55rem;
	letter-spacing: 0.28em;
	padding: 0.5rem 0;
}
.k-brand .k-wordmark__row {
	line-height: 1.1;
}
.k-nav {
	flex: 0 1 auto;
}
.k-nav__list,
.k-footer__list {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 1.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.8rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.k-footer__list {
	justify-content: center;
}
.k-nav__list a,
.k-footer__list a,
.k-nav .sub-menu a {
	text-decoration: none;
	opacity: 0.85;
}
.k-nav__list a:hover,
.k-footer__list a:hover {
	opacity: 1;
}

/* Arkiv dropdown */
.k-nav .menu-item-has-children {
	position: relative;
}
.k-nav .menu-item-has-children > a::after {
	content: " \25BE";
	font-size: 0.7em;
	opacity: 0.6;
}
.k-nav .sub-menu {
	display: none;
	position: absolute;
	top: 100%; /* flush with the parent — no gap, so hover doesn't drop */
	right: 0; /* #ARKIV is the rightmost item: anchor right so the panel opens
	             leftward and never overflows the viewport (no h-scrollbar) */
	left: auto;
	transform: none;
	margin: 0;
	padding: 1rem 0;
	min-width: 13rem;
	list-style: none;
	background: var(--k-bg);
	border: 1px solid var(--k-rule);
	z-index: 30;
}
/* Desktop opens on hover/focus; touch opens on tap via .is-open (toggled by the
   nav script in footer.php). Either way it stays a floating panel, so the slim
   sticky bar never grows to swallow the whole archive list. */
.k-nav .menu-item-has-children:hover > .sub-menu,
.k-nav .menu-item-has-children:focus-within > .sub-menu,
.k-nav .menu-item-has-children.is-open > .sub-menu {
	display: block;
}
.k-nav .sub-menu li {
	padding: 0.4rem 1.5rem;
	white-space: nowrap;
	text-align: center;
	letter-spacing: 0.12em;
}

/* Signature stacked wordmark — KONT / R AD / I K T / I O N, a spaced grid-like
   stack (DESIGN.md visual profile), used as the compact .k-brand logo in the bar.
   Rows are centred so the trailing letter-spacing can't drag them off-axis. */
.k-wordmark__stack {
	display: inline-block;
}
.k-wordmark__row {
	display: block;
	text-align: center;
	line-height: 1.25;
}

/* --- Down-chevron motif between sections --- */
.k-chevron {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.3rem;
	margin: 2.5rem 0;
	opacity: 0.5;
}
.k-chevron i {
	display: block;
	width: 0.7rem;
	height: 0.7rem;
	border-right: 1px solid var(--k-fg);
	border-bottom: 1px solid var(--k-fg);
	transform: rotate(45deg);
}

/* --- Outlined buttons (e.g. Förord / link-out) --- */
.k-site .wp-block-button__link,
.k-site .wp-element-button,
.k-btn {
	display: inline-block;
	background: transparent;
	color: inherit;
	border: 1px solid currentColor;
	border-radius: 0;
	padding: 0.7em 1.8em;
	text-decoration: none;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-size: 0.8rem;
	transition: background-color 0.15s ease, color 0.15s ease;
}
.k-site .wp-block-button__link:hover,
.k-site .wp-element-button:hover,
.k-btn:hover {
	background: var(--k-fg);
	color: var(--k-bg);
}

/* --- Footer --- */
.k-footer {
	border-top: 1px solid var(--k-rule);
	margin-top: 4rem;
	padding: 3rem 1.5rem 3.5rem;
	text-align: center;
	color: var(--k-muted);
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
	align-items: center;
}
.k-footer__colophon {
	margin: 0;
	font-size: 0.85rem;
	letter-spacing: 0.04em;
}
.k-footer__text {
	margin: 0;
	max-width: 42rem;
	font-size: 0.85rem;
	line-height: 1.7;
}
.k-footer__social {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1.75rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.75rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
}
.k-footer__social a {
	text-decoration: none;
	opacity: 0.85;
}
.k-footer__social a:hover {
	opacity: 1;
}

/* --- Edition landing: an immersive, full-viewport index --- */
.k-index-layout {
	max-width: none;
	margin: 0;
	padding: 0;
}

/* Hero: the active piece's media fills the screen; caption + filmstrip at the base. */
.k-index {
	position: relative;
	height: calc(100vh - var(--k-header-h));
	height: calc(100dvh - var(--k-header-h)); /* dvh: track the mobile URL bar so the
	                                             hero always fills the viewport (no black
	                                             gap below the image until you scroll) */
	min-height: 30rem;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	background: #000;
}
.k-index__stage {
	position: absolute;
	inset: 0;
	z-index: 0;
	background: #000;
}
/* One background cell per piece — all in the DOM up front so images are preloaded.
   Cells crossfade on opacity (no src swapping = no flicker); a black cell background
   is the fallback while a still/clip is still loading. */
.k-index__cell {
	position: absolute;
	inset: 0;
	opacity: 0;
	background: #000;
	transition: opacity 0.55s ease;
}
.k-index__cell.is-active {
	opacity: 1;
}
/* Descendant selector (two classes) so it beats the global `body.k-site img/video {
   height: auto }` reset — otherwise the media collapses to natural height and
   object-fit has nothing to cover (black shows below, worst in portrait). */
.k-index__cell .k-index__cell-img,
.k-index__cell .k-index__cell-video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}
/* The still is the immediate base; the clip fades in over it only once it can play,
   so switching to a video piece never flickers image→video. */
.k-index__cell-video {
	opacity: 0;
	transition: opacity 0.55s ease;
}
.k-index__cell-video.is-ready {
	opacity: 1;
}
/* Keeps white chrome legible over media of ANY brightness (a near-white clip would
   otherwise wash out the caption/strip): a strong dark wash at the base, a lighter one
   under the top bar. */
.k-index__scrim {
	position: absolute;
	inset: 0;
	z-index: 2;
	pointer-events: none;
	background:
		linear-gradient(to top, rgba(0, 0, 0, 0.88) 0%, rgba(0, 0, 0, 0.5) 16%, rgba(0, 0, 0, 0) 42%),
		linear-gradient(to bottom, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0) 16%);
}

/* Active-piece caption, just above the strip. */
.k-index__caption {
	position: relative;
	z-index: 3;
	margin: 0;
	padding: 0 2rem 0.4rem;
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}
.k-index__caption-title {
	font-size: clamp(1.4rem, 3.5vw, 2.6rem);
	line-height: 1.1;
}
.k-index__caption-by {
	font-style: italic;
	color: var(--k-muted);
}

/* Filmstrip = the navigation. The rail holds the scroller + left/right arrows; the
   native scrollbar is hidden (arrows + swipe/trackpad drive it instead). */
.k-index__rail {
	position: relative;
	z-index: 3;
}
.k-index__strip {
	display: flex;
	gap: clamp(0.9rem, 7vw, 8.5rem); /* airier on wide screens, tight enough on phones */
	margin: 0;
	padding: 0.75rem 2rem 3rem;
	list-style: none;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* old Edge */
}
.k-index__strip::-webkit-scrollbar {
	display: none; /* WebKit/Blink */
}
.k-index__arrow {
	position: absolute;
	top: calc(50% - 1.25rem); /* centre on the thumbnails, above the bottom padding */
	transform: translateY(-50%);
	z-index: 4;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.4rem;
	height: 2.4rem;
	padding: 0;
	background: rgba(0, 0, 0, 0.55);
	color: var(--k-fg);
	border: 1px solid var(--k-rule);
	border-radius: 50%;
	font-size: 1.1rem;
	line-height: 1;
	cursor: pointer;
	opacity: 0.85;
	transition: opacity 0.2s ease;
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
.k-index__arrow:hover {
	opacity: 1;
}
.k-index__arrow[hidden] {
	display: none;
}
.k-index__arrow--prev {
	left: 0.5rem;
}
.k-index__arrow--next {
	right: 0.5rem;
}
.k-strip__item {
	flex: 0 0 auto;
}
.k-strip__link {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	max-width: 22rem;
	text-decoration: none;
	opacity: 0.55;
	transition: opacity 0.25s ease;
}
.k-strip__link:hover,
.k-strip__item.is-active .k-strip__link {
	opacity: 1;
}
.k-strip__thumb {
	flex: 0 0 auto;
	width: 5rem;
	overflow: hidden;
}
.k-strip__thumb img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}
.k-strip__meta {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	min-width: 0;
}
.k-strip__title {
	font-size: 0.78rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}
.k-strip__by {
	font-size: 0.75rem;
	font-style: italic;
	color: var(--k-muted);
}

/* Phones: compact tiles capped near a third of the width so at least ~3 pieces are
   visible, stacked vertically — thumbnail on top, title (clamped to 2 lines) below.
   The artist stays in the caption above to keep the tiles small. Tighter side
   padding gives them room. */
@media (max-width: 600px) {
	.k-index__strip {
		padding-inline: 1rem;
		align-items: flex-start;
	}
	.k-strip__item {
		width: min(20rem, 24vw);
	}
	.k-strip__link {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
		gap: 0.45rem;
	}
	.k-strip__thumb {
		width: 100%;
	}
	.k-strip__title {
		font-size: 0.7rem;
		letter-spacing: 0.06em;
		line-height: 1.25;
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
	}
	.k-strip__by {
		display: none;
	}
}

/* Scroll-down affordance to the reading content below the hero. */
.k-index__more {
	position: absolute;
	z-index: 3;
	top: 1.25rem;
	right: 2rem;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	text-decoration: none;
	color: var(--k-muted);
	font-size: 0.62rem;
	letter-spacing: 0.24em;
	text-transform: uppercase;
}
.k-index__more:hover {
	color: var(--k-fg);
}
.k-index__more .k-chevron {
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {
	.k-index__cell,
	.k-index__cell-video {
		transition: none;
	}
}

/* --- Below the fold: the edition's reading content --- */
.k-edition__body {
	padding-top: 4rem;
}
.k-edition__head {
	text-align: center;
	margin-bottom: 3.5rem;
}
.k-edition__title {
	text-transform: uppercase;
	letter-spacing: 0.14em;
	font-size: clamp(1.3rem, 3vw, 1.9rem);
	margin: 0 0 0.75rem;
}
.k-edition__intro {
	color: var(--k-muted);
	max-width: var(--k-measure);
	margin-inline: auto;
}

/* --- Artists (aggregate on landing + inline on piece) --- */
.k-edition__artists {
	margin-top: 5rem;
	border-top: 1px solid var(--k-rule);
	padding-top: 3rem;
}
.k-edition__artists-title,
.k-about__title {
	text-align: center;
	font-weight: 300;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	font-size: 0.8rem;
	color: var(--k-fg);
	margin: 0 0 2rem;
}
.k-artists {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
	gap: 2.5rem;
}
.k-artist__portrait img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: cover;
	margin-bottom: 0.75rem;
}
.k-artist__name {
	font-weight: 400;
	font-size: 1.05rem;
	margin: 0 0 0.5rem;
}
.k-artist__handle {
	font-style: italic;
	font-weight: 300;
	color: var(--k-muted);
}
.k-artist__bio {
	color: var(--k-muted);
	font-size: 0.92rem;
	line-height: 1.6;
}
.k-artist__links {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 1.1rem;
	padding: 0;
	margin: 0.75rem 0 0;
	font-size: 0.78rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

/* --- Single piece --- */
.k-site .k-piece__head {
	text-align: center;
	margin-bottom: 3rem;
}
.k-piece__title {
	font-weight: 300;
	font-size: clamp(1.8rem, 4.5vw, 3rem);
	margin: 0 0 0.75rem;
}
.k-site .k-piece__byline {
	font-style: italic;
	color: var(--k-muted);
	opacity: 1;
	margin: 0;
}
.k-piece__body {
	max-width: var(--k-measure);
	margin-inline: auto;
}
.k-piece__body > * + * {
	margin-top: 1.4rem;
}
.k-piece__about {
	max-width: var(--k-measure);
	margin: 4rem auto 0;
	border-top: 1px solid var(--k-rule);
	padding-top: 2.5rem;
}
.k-piece__about .k-about__title {
	text-align: left;
}
.k-about__text {
	color: var(--k-muted);
}
.k-about__artists {
	margin-top: 2.5rem;
}
.k-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.85rem;
	margin-top: 2rem;
	font-size: 0.72rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--k-muted);
}
.k-meta > * + *::before {
	content: "/";
	opacity: 0.5;
	margin-right: 0.85rem;
}
.k-piecenav {
	display: flex;
	justify-content: space-between;
	gap: 1.5rem;
	max-width: var(--k-measure);
	margin: 4rem auto 0;
	font-style: italic;
	color: var(--k-muted);
}
.k-piecenav a {
	text-decoration: none;
}
.k-piecenav a:hover {
	color: var(--k-fg);
}
.k-piecenav__next {
	margin-inline-start: auto;
	text-align: right;
}
