/*
 * Rarity Section — ported from previews/_build_rarity_section_v6.py (Wynd + Cosmic Crab, 2026-05-15).
 * Inserted between Ask section and footer on page-hero-v3.php.
 * All selectors namespaced under .rarity-section to avoid bleed into Ask / hero.
 */

.rarity-section {
	--rs-rs-bg-top:    #110015;
	--rs-rs-bg-mid:    #3B003A;
	--rs-rs-bg-bottom: #310031;
	--rs-rs-text:      #ffffff;
	--rs-rs-muted:     rgba(255, 255, 255, 0.78);
	--rs-rs-gold:      #FFBD59;
	--rs-rs-gold-deep: #310031;

	position: relative;
	width: 100%;
	color: var(--rs-rs-text);
	font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
	background: linear-gradient(
		180deg,
		var(--rs-rs-bg-top)    0%,
		var(--rs-rs-bg-mid)   50%,
		var(--rs-rs-bg-bottom) 100%
	);
	overflow: hidden;
	isolation: isolate;
}

.rarity-section *,
.rarity-section *::before,
.rarity-section *::after {
	box-sizing: border-box;
}

/* Soft radial glow behind content */
.rarity-section::before {
	content: '';
	position: absolute;
	inset: 0;
	background: radial-gradient(
		ellipse at center,
		rgba(91, 0, 91, 0.4) 0%,
		rgba(91, 0, 91, 0.1) 40%,
		transparent 70%
	);
	pointer-events: none;
	z-index: 1;
}

.rarity-starfield {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 2;
}

.rarity-starfield .rs-rarity-star {
	position: absolute;
	background: #ffffff;
	border-radius: 50%;
}

.rarity-inner {
	position: relative;
	z-index: 3;
	max-width: 1180px;
	margin: 0 auto;
	padding: 88px 32px 96px;
}

.rarity-grid {
	display: grid;
	grid-template-columns: 1.15fr 1fr;
	gap: 56px;
	align-items: start;
}

.rarity-headline {
	font-family: 'Montserrat', sans-serif;
	font-size: clamp(34px, 4.2vw, 56px);
	line-height: 1.05;
	margin: 0 0 22px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--rs-rs-text);
}

.rarity-headline em.really {
	font-family: 'Cormorant Garamond', Georgia, serif;
	font-style: italic;
	font-weight: 700;
	color: var(--rs-rs-gold);
	font-size: 1.08em;
	letter-spacing: 0;
}

.rarity-subhead {
	color: #ffffff;
	font-weight: 700;
	font-size: 17px;
	line-height: 1.5;
	margin: 0 0 14px;
	max-width: 560px;
}

.rarity-body {
	color: #ffffff;
	font-weight: 400;
	font-size: 15px;
	line-height: 1.6;
	margin: 0 0 32px;
	max-width: 560px;
	opacity: 0.88;
}

.rarity-pill-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	column-gap: 14px;
	row-gap: 7px;
	margin-bottom: 32px;
}

.rarity-pill {
	height: 88px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.rarity-pill img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.rarity-closing {
	color: #ffffff;
	font-size: 15px;
	line-height: 1.6;
	margin: 8px 0 28px;
	max-width: 560px;
}

.rarity-cta-row {
	display: flex;
	gap: 16px;
	flex-wrap: wrap;
	align-items: center;
}

/* Gold-glass primary CTA (brand-locked spec) */
.rarity-cta-primary {
	display: inline-block;
	background: var(--rs-rs-gold);
	color: var(--rs-rs-gold-deep);
	font-family: 'Montserrat', sans-serif;
	font-weight: 700;
	font-size: 16px;
	letter-spacing: 0.02em;
	padding: 16px 32px;
	border-radius: 12px;
	border: none;
	position: relative;
	overflow: hidden;
	cursor: pointer;
	text-decoration: none;
	box-shadow:
		inset 0 1px 1px rgba(255, 255, 255, 0.4),
		0 0 20px rgba(255, 189, 89, 0.3);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.rarity-cta-primary::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	padding: 1.4px;
	background: linear-gradient(
		180deg,
		rgba(255, 255, 255, 0.5) 0%,
		rgba(255, 255, 255, 0.1) 30%,
		rgba(255, 189, 89, 0.3) 50%,
		rgba(255, 255, 255, 0.1) 70%,
		rgba(255, 255, 255, 0.5) 100%
	);
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	        mask-composite: exclude;
	pointer-events: none;
}

.rarity-cta-primary:hover {
	transform: scale(1.02);
	box-shadow:
		inset 0 1px 1px rgba(255, 255, 255, 0.4),
		0 0 30px rgba(255, 189, 89, 0.5);
}

.rarity-cta-primary:focus-visible {
	outline: 2px solid var(--rs-rs-gold);
	outline-offset: 3px;
}

/* Right column — video card replacing the v6 dashed animation slot */
.rarity-col-right {
	display: flex;
	justify-content: flex-end;
}

.rarity-card {
	position: sticky;
	top: 40px;
	aspect-ratio: 1 / 1;
	width: 100%;
	max-width: 460px;
	border-radius: 28px;
	overflow: hidden;
	background:
		radial-gradient(circle at 50% 35%, rgba(198,157,255,0.18), transparent 60%),
		rgba(255,255,255,0.03);
	box-shadow:
		0 30px 60px rgba(0, 0, 0, 0.35),
		inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.rarity-card .rarity-loop {
	width: 100%;
	height: 100%;
	display: block;
	object-fit: cover;
	border-radius: inherit;
}

/* Reveal animation — runs once when section enters viewport */
.rarity-section .reveal {
	opacity: 0;
	transform: translateY(12px);
}

@keyframes rs-rarity-rise {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}

.rarity-section.in-view .reveal {
	animation: rs-rarity-rise 700ms ease both;
}

.rarity-section.in-view .reveal.d1 { animation-delay: 80ms; }
.rarity-section.in-view .reveal.d2 { animation-delay: 160ms; }
.rarity-section.in-view .reveal.d3 { animation-delay: 240ms; }
.rarity-section.in-view .reveal.d4 { animation-delay: 320ms; }

/* Mobile: stack and reorder per v6 — headline -> intro -> pills -> card -> closing -> cta */
@media (max-width: 760px) {
	.rarity-inner { padding: 56px 20px 72px; }

	.rarity-grid {
		grid-template-columns: 1fr;
		gap: 0;
	}

	.rarity-pill-grid { grid-template-columns: repeat(2, 1fr); }

	.rarity-col-left  { display: contents; }
	.rarity-col-right { display: contents; }

	.rarity-card {
		position: static;
		margin: 8px auto 32px;
		max-width: 360px;
	}

	.m-headline { order: 1; }
	.m-intro    { order: 2; }
	.m-pills    { order: 3; }
	.m-card     { order: 4; }
	.m-closing  { order: 5; }
	.m-cta      { order: 6; }
}

@media (prefers-reduced-motion: reduce) {
	.rarity-section .reveal,
	.rarity-section.in-view .reveal {
		opacity: 1;
		transform: none;
		animation: none;
	}
}
