/*--------------------------------------------------
	Kardashev — manual fixed-pin video scrub (mechanics)

	No ScrollTrigger. Section height is set in JS.
	.kardashev-pin is position:absolute inside the section,
	and only position:fixed (+ high z-index) while scrubbing.
---------------------------------------------------*/

.kardashev,
section.kardashev.content-row {
	position: relative;
	z-index: auto;
	display: block !important;
	flex-wrap: nowrap;
	align-items: stretch;
	justify-content: flex-start;
	gap: 0;
	left: auto !important;
	width: 100% !important;
	max-width: none !important;
	margin-left: 0 !important;
	/* height set by js/kardashev.js — do not use 400vh here */
	height: auto;
	min-height: 100vh;
	overflow: hidden; /* clip anything that tries to paint out of this band */
	color: #f5f5f5;
	background: #050505;
	isolation: isolate;
}

.kardashev-pin {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
	width: 100%;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	background: #050505;
}

/* Fixed full-viewport cover (top may be offset while entering or exiting) */
.kardashev.is-scrubbing .kardashev-pin {
	position: fixed;
	top: 0;
	bottom: auto;
	left: 0;
	right: 0;
	width: 100%;
	max-width: none;
	height: 100vh;
	height: 100dvh;
	z-index: 850;
}

/* Fully past: dock to section bottom (off-screen / scroll-back only) */
.kardashev.is-after:not(.is-scrubbing) .kardashev-pin {
	position: absolute;
	top: auto;
	bottom: 0;
	left: 0;
	right: 0;
	width: 100%;
}

.kardashev-video {
	position: absolute;
	inset: 0;
	z-index: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	pointer-events: none;
	will-change: opacity;
	transition: opacity 220ms ease-out;
}

.kardashev-video.is-active {
	opacity: 1;
}

.kardashev-pin::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background:
		linear-gradient(180deg, rgba(5, 5, 5, 0.55) 0%, rgba(5, 5, 5, 0.1) 30%, rgba(5, 5, 5, 0.1) 60%, rgba(5, 5, 5, 0.7) 100%),
		linear-gradient(90deg, rgba(5, 5, 5, 0.65) 0%, rgba(5, 5, 5, 0.15) 45%, rgba(5, 5, 5, 0) 70%);
}

.kardashev-overlay {
	--kardashev-accent: #fbc474; /* phpremium */
	position: absolute;
	left: var(--horizontal-gutter, 50px);
	right: auto;
	bottom: clamp(4rem, 10vh, 8rem);
	z-index: 4;
	max-width: min(56rem, calc(100% - (var(--horizontal-gutter, 50px) * 2)));
	pointer-events: none;
}

.kardashev-overlay .kardashev-heading {
	/* Wrap to the same column width as the tier tabs */
	max-width: 100%;
	white-space: normal;
}

.kardashev-tiers {
	pointer-events: auto;
}

.kardashev-tier-btn {
	all: unset;
	box-sizing: border-box;
	position: relative;
	display: flex;
	align-items: baseline;
	flex-wrap: nowrap;
	gap: clamp(1rem, 2vw, 2rem);
	width: 100%;
	padding: 0.85rem 0 0.85rem 0.9rem;
	cursor: pointer;
	transition: background-color 220ms ease, padding-left 220ms ease;
}

.kardashev-tier-btn::before {
	content: "";
	position: absolute;
	left: 0;
	top: 50%;
	width: 2px;
	height: 0;
	background: var(--kardashev-accent, #fbc474);
	opacity: 0;
	transform: translateY(-50%);
	transition: height 220ms ease, opacity 220ms ease;
	pointer-events: none;
}

.kardashev-tier-btn:focus-visible {
	outline: 1px solid var(--kardashev-accent, #fbc474);
	outline-offset: 4px;
}

.kardashev-tier-label {
	/* Fixed column so descriptions share one left edge (fits EFFICIENCY + active tracking) */
	flex: 0 0 8.5rem;
	width: 8.5rem;
	white-space: nowrap;
	transition: color 220ms ease, letter-spacing 220ms ease;
}

.kardashev-tier-desc {
	flex: 1 1 auto;
	white-space: nowrap;
	transition: color 220ms ease, opacity 220ms ease;
}

/* Hover — phpremium wash + bar */
.kardashev-tier:not(.is-active) .kardashev-tier-btn:hover {
	background-color: rgba(251, 196, 116, 0.08);
}

.kardashev-tier:not(.is-active) .kardashev-tier-btn:hover::before {
	height: 42%;
	opacity: 0.55;
}

.kardashev-tier:not(.is-active) .kardashev-tier-btn:hover .kardashev-tier-label {
	color: rgba(245, 245, 245, 0.92) !important;
}

.kardashev-tier:not(.is-active) .kardashev-tier-btn:hover .kardashev-tier-desc {
	color: rgba(245, 245, 245, 0.78) !important;
}

/* Active — phpremium marker + label */
.kardashev-tier.is-active .kardashev-tier-btn {
	background-color: rgba(251, 196, 116, 0.12);
}

.kardashev-tier.is-active .kardashev-tier-btn::before {
	height: 68%;
	opacity: 1;
}

.kardashev-tier.is-active .kardashev-tier-label {
	color: var(--kardashev-accent, #fbc474) !important;
	letter-spacing: 0.08em;
}

.kardashev-tier.is-active .kardashev-tier-desc {
	color: #f5f5f5 !important;
}

.kardashev-tier.is-active .kardashev-tier-btn:hover {
	background-color: rgba(251, 196, 116, 0.16);
}

.kardashev-tier.is-active .kardashev-tier-btn:hover .kardashev-tier-desc {
	color: #ffffff !important;
}

.kardashev-hud {
	position: absolute;
	right: var(--horizontal-gutter, 50px);
	bottom: clamp(1.25rem, 3vw, 2.5rem);
	z-index: 4;
	pointer-events: none;
}

.kardashev-hud-time {
	font-variant-numeric: tabular-nums slashed-zero;
	font-feature-settings: "zero" 1, "tnum" 1;
}

@media (prefers-reduced-motion: reduce) {
	.kardashev,
	section.kardashev.content-row {
		height: auto !important;
		min-height: 0;
		overflow: visible;
	}

	.kardashev-pin,
	.kardashev.is-scrubbing .kardashev-pin,
	.kardashev.is-after .kardashev-pin,
	.kardashev.is-after:not(.is-scrubbing) .kardashev-pin {
		position: relative;
		top: auto !important;
		bottom: auto !important;
		height: auto;
		aspect-ratio: 16 / 9;
		z-index: 1;
	}

	.kardashev-video {
		position: relative;
		opacity: 1;
	}

	.kardashev-video:not(.is-active) {
		display: none;
	}

	.kardashev-overlay {
		position: static;
		max-width: none;
		margin: 1.5rem var(--horizontal-gutter, 20px);
	}
}

@media only screen and (max-width: 767px) {
	.kardashev-overlay {
		left: var(--horizontal-gutter, 20px);
		right: var(--horizontal-gutter, 20px);
		bottom: 3.5rem;
		max-width: none;
	}

	.kardashev-tier-desc {
		white-space: normal;
	}

	.kardashev-tier-label {
		flex-basis: auto;
		width: auto;
	}

	.kardashev-tier-btn {
		flex-wrap: wrap;
		padding: 0.7rem 0.75rem;
	}
}
