/* ==========================================================================
   Cleandosis — pages.css
   Loaded on is_page() || is_404(), after theme.css.

   1. Decorative primitives — two-tone capsules and scored tablets
   2. The page header band (page.php)
   3. The reading column and .cd-prose polish
   4. The 404 dispensary panel (404.php)
   5. Reduced motion

   Everything here is decoration on top of theme.css; where it overrides a
   theme.css rule it does so by loading later, not by editing that file.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Decorative primitives
   -------------------------------------------------------------------------- */

/*
 * A capsule: two halves split down the middle with a hairline seam and a small
 * gloss. Position and size come from the modifier; --cd-rot holds the rotation
 * so the float keyframes can compose on top of it.
 */
.cd-pill,
.cd-tab {
	position: absolute;
	display: block;
	border-radius: 999px;
	transform: var(--cd-rot, rotate(0deg));
	--cd-a: var(--color-accent-300);
	--cd-b: var(--color-accent-2-300);
}

.cd-pill {
	background: linear-gradient(
		90deg,
		var(--cd-a) 0 49.2%,
		rgba(255, 255, 255, 0.62) 49.2% 50.8%,
		var(--cd-b) 50.8% 100%
	);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-text) 5%, transparent);
}

.cd-pill::after {
	content: "";
	position: absolute;
	left: 11%;
	top: 22%;
	width: 20%;
	height: 16%;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.5);
}

.cd-tab {
	background: radial-gradient(circle at 32% 26%, #ffffff 0%, var(--cd-a) 42%, var(--cd-b) 100%);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-text) 7%, transparent);
}

/* The score line. */
.cd-tab::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 16%;
	width: 1.5px;
	height: 68%;
	margin-left: -0.75px;
	border-radius: 999px;
	background: color-mix(in srgb, var(--color-text) 18%, transparent);
}

@keyframes cd-float {
	0%,
	100% { transform: var(--cd-rot, rotate(0deg)) translateY(0); }
	50%  { transform: var(--cd-rot, rotate(0deg)) translateY(-12px); }
}

/* --------------------------------------------------------------------------
   2. The page header band
   -------------------------------------------------------------------------- */
.cd-pagehero {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	border-bottom: 1px solid var(--color-divider);
	background:
		radial-gradient(88% 120% at 6% -14%, color-mix(in srgb, var(--color-accent-2-100) 90%, #ffffff) 0%, transparent 58%),
		radial-gradient(76% 128% at 97% 4%, color-mix(in srgb, var(--color-accent-100) 94%, #ffffff) 0%, transparent 60%),
		linear-gradient(180deg, color-mix(in srgb, var(--color-accent-100) 52%, var(--color-bg)) 0%, var(--color-bg) 100%);
}

/* Fine dot grid, ~8% ink, fading out toward the body. */
.cd-pagehero__grain {
	position: absolute;
	inset: -1px;
	z-index: 0;
	pointer-events: none;
	background-image: radial-gradient(
		circle at 1px 1px,
		color-mix(in srgb, var(--color-accent-900) 24%, transparent) 1px,
		transparent 1.5px
	);
	background-size: 13px 13px;
	-webkit-mask-image: linear-gradient(184deg, #000 4%, transparent 80%);
	mask-image: linear-gradient(184deg, #000 4%, transparent 80%);
	opacity: 0.36;
}

.cd-pagehero__deco {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	display: block;
}

.cd-pagehero .cd-pill--1 {
	left: -70px;
	top: 16%;
	width: 208px;
	height: 68px;
	opacity: 0.42;
	--cd-rot: rotate(-22deg);
	--cd-a: var(--color-accent-300);
	--cd-b: var(--color-accent-2-300);
	animation: cd-float 17s ease-in-out infinite;
}

.cd-pagehero .cd-pill--2 {
	right: -46px;
	top: -34px;
	width: 246px;
	height: 80px;
	opacity: 0.34;
	--cd-rot: rotate(15deg);
	--cd-a: var(--color-accent-2-300);
	--cd-b: var(--color-accent-200);
	animation: cd-float 23s ease-in-out -6s infinite;
}

.cd-pagehero .cd-pill--3 {
	right: 7%;
	bottom: -26px;
	width: 148px;
	height: 49px;
	opacity: 0.44;
	--cd-rot: rotate(-9deg);
	--cd-a: var(--color-accent-200);
	--cd-b: var(--color-accent-2-400);
	animation: cd-float 20s ease-in-out -11s infinite;
}

.cd-pagehero .cd-pill--4 {
	left: 27%;
	bottom: -32px;
	width: 118px;
	height: 39px;
	opacity: 0.26;
	--cd-rot: rotate(28deg);
	--cd-a: var(--color-accent-200);
	--cd-b: var(--color-accent-2-200);
}

.cd-pagehero .cd-pill--5 {
	right: 31%;
	top: -18px;
	width: 94px;
	height: 31px;
	opacity: 0.26;
	--cd-rot: rotate(-34deg);
	--cd-a: var(--color-accent-2-200);
	--cd-b: var(--color-accent-200);
	animation: cd-float 26s ease-in-out -3s infinite;
}

.cd-pagehero .cd-tab--1 {
	right: 19%;
	bottom: 21%;
	width: 44px;
	height: 44px;
	opacity: 0.34;
	--cd-rot: rotate(-14deg);
	--cd-a: var(--color-accent-200);
	--cd-b: var(--color-accent-300);
	animation: cd-float 19s ease-in-out -8s infinite;
}

.cd-pagehero .cd-tab--2 {
	left: 11%;
	bottom: 8px;
	width: 28px;
	height: 28px;
	opacity: 0.3;
	--cd-rot: rotate(20deg);
	--cd-a: var(--color-accent-2-200);
	--cd-b: var(--color-accent-2-300);
}

.cd-pagehero__inner {
	position: relative;
	z-index: 2;
	max-width: 760px;
	margin: 0 auto;
	padding: clamp(46px, 6.5vw, 88px) 0 clamp(34px, 4.5vw, 54px);
}

.cd-pagehero__kicker {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 16px;
	color: var(--color-accent-700);
}

/* A capsule tick before the kicker — the band's smallest tablet. */
.cd-pagehero__kicker::before {
	content: "";
	flex: none;
	width: 22px;
	height: 9px;
	border-radius: 999px;
	background: linear-gradient(
		90deg,
		var(--color-accent) 0 48.5%,
		rgba(255, 255, 255, 0.6) 48.5% 51.5%,
		var(--color-accent-2-400) 51.5% 100%
	);
}

.cd-pagehero__title {
	margin: 0;
	font-size: clamp(34px, 5vw, 52px);
	line-height: 1.06;
}

.cd-pagehero__rule {
	display: none; /* off by default — Customizer → Page header → "Show the bar below the heading" */
	height: 2px;
	margin-top: clamp(20px, 3vw, 28px);
	background: linear-gradient(
		90deg,
		var(--color-accent) 0 56px,
		color-mix(in srgb, var(--color-text) 10%, transparent) 56px 100%
	);
}

/* --------------------------------------------------------------------------
   3. The reading column and .cd-prose
   -------------------------------------------------------------------------- */
.cd-page {
	position: relative;
	isolation: isolate;
	overflow: clip;
	padding: clamp(34px, 4vw, 52px) 0 clamp(56px, 7vw, 84px);
}

/* Ghost capsule watermark, clipped to the column so it can never overflow. */
.cd-page::before {
	content: "";
	position: absolute;
	z-index: -1;
	right: -104px;
	top: 34px;
	width: 250px;
	height: 84px;
	border-radius: 999px;
	transform: rotate(-24deg);
	opacity: 0.22;
	background: linear-gradient(
		90deg,
		var(--color-accent-200) 0 50%,
		var(--color-accent-2-200) 50% 100%
	);
}

.cd-page__body.cd-prose {
	font-size: 16.5px;
	line-height: 1.72;
}

/* Lead paragraph, when the page opens on prose rather than a subheading. */
.cd-page__body.cd-prose > p:first-child {
	font-size: 19px;
	line-height: 1.6;
	color: var(--color-neutral-900);
}

.cd-page__body.cd-prose h2 {
	position: relative;
	margin: 52px 0 var(--space-3);
	padding-top: 20px;
	font-size: 27px;
}

.cd-page__body.cd-prose h2::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0;
	width: 34px;
	height: 3px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--color-accent) 0 55%, var(--color-accent-2-400) 55% 100%);
}

.cd-page__body.cd-prose > *:first-child { margin-top: 0; }

.cd-page__body.cd-prose h3 {
	margin: 36px 0 var(--space-2);
	font-size: 21px;
	color: var(--color-accent-800);
}

.cd-page__body.cd-prose h4 {
	margin: 28px 0 var(--space-2);
	font-size: 17px;
	letter-spacing: 0.01em;
}

.cd-page__body.cd-prose p { margin: 0 0 var(--space-4); }

.cd-page__body.cd-prose li { margin-bottom: 10px; }

.cd-page__body.cd-prose ul {
	list-style: none;
	padding-left: 26px;
}

.cd-page__body.cd-prose ul > li { position: relative; }

/* Tiny capsule bullets. */
.cd-page__body.cd-prose ul > li::before {
	content: "";
	position: absolute;
	left: -22px;
	top: 0.68em;
	width: 12px;
	height: 5px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--color-accent) 0 50%, var(--color-accent-2-400) 50% 100%);
}

.cd-page__body.cd-prose ol { padding-left: 26px; }

.cd-page__body.cd-prose ol > li::marker {
	color: var(--color-accent-600);
	font-weight: 600;
}

.cd-page__body.cd-prose blockquote {
	position: relative;
	margin: var(--space-6) 0;
	padding: 22px 24px;
	border: 1px solid var(--color-divider);
	border-left: 3px solid var(--color-accent);
	border-radius: var(--radius-lg);
	background: color-mix(in srgb, var(--color-accent-100) 50%, var(--color-bg));
	font-style: normal;
	font-size: 17px;
	line-height: 1.6;
}

.cd-page__body.cd-prose blockquote > *:last-child { margin-bottom: 0; }

.cd-page__body.cd-prose strong {
	color: var(--color-accent-900);
	font-weight: 600;
}

.cd-page__body.cd-prose a {
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
	text-decoration-color: color-mix(in srgb, var(--color-accent) 45%, transparent);
}

.cd-page__body.cd-prose a:hover { text-decoration-color: var(--color-accent); }

.cd-page__body.cd-prose table {
	border: 1px solid var(--color-divider);
	border-radius: var(--radius-lg);
	background: color-mix(in srgb, var(--color-neutral-100) 60%, transparent);
}

.cd-page__body.cd-prose th {
	background: color-mix(in srgb, var(--color-accent-100) 72%, transparent);
	color: var(--color-accent-800);
	padding: 12px var(--space-3);
}

.cd-page__body.cd-prose td { padding: 12px var(--space-3); }

.cd-page__body.cd-prose tr:last-child td { border-bottom: 0; }

/*
 * WooCommerce pages (cart, checkout, my account) render through page.php as
 * well. Their block output is not prose, so the decorations above are switched
 * back off inside any WooCommerce container.
 */
.cd-page__body.cd-prose :is(.woocommerce, [class*="wc-block-"], [class*="wp-block-woocommerce"]) h2 {
	padding-top: 0;
	margin-top: var(--space-6);
}

.cd-page__body.cd-prose :is(.woocommerce, [class*="wc-block-"], [class*="wp-block-woocommerce"]) h2::before,
.cd-page__body.cd-prose :is(.woocommerce, [class*="wc-block-"], [class*="wp-block-woocommerce"]) li::before {
	content: none;
}

.cd-page__body.cd-prose :is(.woocommerce, [class*="wc-block-"], [class*="wp-block-woocommerce"]) ul {
	list-style: revert;
	padding-left: revert;
}

.cd-page__body.cd-prose :is(.woocommerce, [class*="wc-block-"], [class*="wp-block-woocommerce"]) table {
	border: 0;
	background: none;
}

/* A dotted rule instead of a hard line. */
.cd-page__body.cd-prose hr,
.cd-page__body.cd-prose .wp-block-separator {
	border: 0;
	height: 7px;
	width: 100%;
	margin: 46px 0;
	background: radial-gradient(
			circle at center,
			color-mix(in srgb, var(--color-accent) 42%, transparent) 2.5px,
			transparent 3px
		)
		0 0 / 22px 7px repeat-x;
}

/* --------------------------------------------------------------------------
   4. The 404 dispensary panel
   -------------------------------------------------------------------------- */
.cd-404x { padding-bottom: 0; }

.cd-404x__panel {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding: clamp(36px, 5vw, 64px) 0 clamp(44px, 6vw, 80px);
	border-bottom: 1px solid var(--color-divider);
	background:
		radial-gradient(66% 88% at 20% 6%, color-mix(in srgb, var(--color-accent-2-100) 94%, #ffffff) 0%, transparent 62%),
		radial-gradient(66% 90% at 86% 10%, color-mix(in srgb, var(--color-accent-100) 96%, #ffffff) 0%, transparent 64%),
		linear-gradient(
			168deg,
			color-mix(in srgb, var(--color-accent-100) 70%, var(--color-neutral-100)) 0%,
			color-mix(in srgb, var(--color-accent-2-100) 48%, var(--color-bg)) 100%
		);
}

.cd-404x__grain {
	position: absolute;
	inset: -1px;
	z-index: 0;
	pointer-events: none;
	background-image: radial-gradient(
		circle at 1px 1px,
		color-mix(in srgb, var(--color-accent-900) 24%, transparent) 1px,
		transparent 1.5px
	);
	background-size: 13px 13px;
	-webkit-mask-image: radial-gradient(120% 90% at 50% 20%, #000 10%, transparent 82%);
	mask-image: radial-gradient(120% 90% at 50% 20%, #000 10%, transparent 82%);
	opacity: 0.34;
}

/* The stage holds the digits, the bottle and the scatter; the card sits below
   it but still inside the pastel panel, so no panel edge cuts through it. */
.cd-404x__stage {
	position: relative;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: clamp(250px, 30vw, 340px);
	padding: 0 var(--cd-pad) clamp(24px, 3vw, 40px);
}

.cd-404x__deco {
	position: absolute;
	inset: -26px 0;
	z-index: 1;
	pointer-events: none;
	display: block;
}

.cd-404x .cd-pill--s1 {
	left: 6%;
	top: 13%;
	width: 118px;
	height: 39px;
	opacity: 0.85;
	--cd-rot: rotate(-28deg);
	--cd-a: var(--color-accent);
	--cd-b: var(--color-accent-2-400);
	animation: cd-float 16s ease-in-out infinite;
}

.cd-404x .cd-pill--s2 {
	right: 8%;
	top: 15%;
	width: 96px;
	height: 32px;
	opacity: 0.8;
	--cd-rot: rotate(22deg);
	--cd-a: var(--color-accent-2-400);
	--cd-b: var(--color-accent-500);
	animation: cd-float 21s ease-in-out -7s infinite;
}

.cd-404x .cd-pill--s3 {
	right: 13%;
	bottom: 27%;
	width: 78px;
	height: 26px;
	opacity: 0.72;
	--cd-rot: rotate(-14deg);
	--cd-a: var(--color-accent-500);
	--cd-b: var(--color-accent-2-300);
	animation: cd-float 24s ease-in-out -13s infinite;
}

.cd-404x .cd-pill--s4 {
	left: 35%;
	bottom: 9%;
	width: 64px;
	height: 22px;
	opacity: 0.62;
	--cd-rot: rotate(36deg);
	--cd-a: var(--color-accent-300);
	--cd-b: var(--color-accent-2-200);
}

.cd-404x .cd-pill--s5 {
	left: 45%;
	top: 5%;
	width: 70px;
	height: 24px;
	opacity: 0.5;
	--cd-rot: rotate(-8deg);
	--cd-a: var(--color-accent-200);
	--cd-b: var(--color-accent-2-300);
	animation: cd-float 27s ease-in-out -4s infinite;
}

.cd-404x .cd-pill--s6 {
	right: 2%;
	bottom: 10%;
	width: 104px;
	height: 34px;
	opacity: 0.55;
	--cd-rot: rotate(48deg);
	--cd-a: var(--color-accent-2-300);
	--cd-b: var(--color-accent-200);
	animation: cd-float 18s ease-in-out -9s infinite;
}

.cd-404x .cd-tab--s1 {
	left: 21%;
	top: 36%;
	width: 34px;
	height: 34px;
	opacity: 0.7;
	--cd-rot: rotate(-12deg);
	--cd-a: var(--color-accent-200);
	--cd-b: var(--color-accent-300);
	animation: cd-float 22s ease-in-out -15s infinite;
}

.cd-404x .cd-tab--s2 {
	right: 22%;
	bottom: 40%;
	width: 26px;
	height: 26px;
	opacity: 0.62;
	--cd-rot: rotate(18deg);
	--cd-a: var(--color-accent-2-200);
	--cd-b: var(--color-accent-2-300);
}

.cd-404x__digits {
	position: relative;
	z-index: 2;
	display: block;
	width: min(600px, 80vw);
	height: auto;
	filter: drop-shadow(0 10px 18px color-mix(in srgb, var(--color-text) 10%, transparent));
}

.cd-404x__bottle {
	position: absolute;
	z-index: 3;
	left: clamp(-20px, 2.5vw, 52px);
	bottom: clamp(-16px, 0.5vw, 8px);
	width: clamp(150px, 17vw, 232px);
	height: auto;
	filter: drop-shadow(0 12px 22px color-mix(in srgb, var(--color-text) 13%, transparent));
}

.cd-404x__card {
	position: relative;
	z-index: 4;
	max-width: 940px;
	margin: 0 auto;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: clamp(20px, 3vw, 48px);
	align-items: center;
	padding: clamp(24px, 3.2vw, 40px) clamp(22px, 3.2vw, 44px);
	background: #ffffff;
	border: 1px solid var(--color-divider);
	border-radius: var(--radius-lg);
	box-shadow: 0 18px 44px color-mix(in srgb, var(--color-text) 10%, transparent);
}

.cd-404x__card .cd-kicker { margin-bottom: 12px; }

.cd-404x__title {
	margin: 0 0 10px;
	font-size: clamp(30px, 4.2vw, 44px);
	line-height: 1.06;
}

.cd-404x__text {
	margin: 0 0 22px;
	max-width: 42ch;
	font-size: 18px;
	line-height: 27px;
	color: var(--color-neutral-800);
}

.cd-404x__card .cd-404__form { margin-top: 0; }

.cd-404x__go {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 14px;
}

.cd-404x__back {
	min-height: 48px;
	padding-inline: 32px;
	border-radius: 999px;
	font-size: 16px;
}

.cd-404x__links {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var(--color-neutral-600);
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
	.cd-pagehero__inner {
		padding-top: 42px;
		padding-bottom: 30px;
	}

	.cd-pagehero .cd-pill--4,
	.cd-pagehero .cd-pill--5,
	.cd-pagehero .cd-tab--2 { display: none; }

	.cd-pagehero .cd-pill--1 {
		left: -56px;
		top: 8%;
		width: 148px;
		height: 49px;
	}

	.cd-pagehero .cd-pill--2 {
		right: -50px;
		top: -22px;
		width: 156px;
		height: 51px;
	}

	.cd-pagehero .cd-pill--3 {
		right: 4%;
		bottom: -16px;
		width: 100px;
		height: 33px;
	}

	.cd-pagehero .cd-tab--1 {
		right: 12%;
		bottom: 16%;
		width: 32px;
		height: 32px;
	}

	.cd-page::before {
		width: 180px;
		height: 60px;
		right: -78px;
	}
}

@media (max-width: 780px) {
	.cd-404x__stage {
		min-height: 0;
		padding-bottom: 62px;
	}

	.cd-404x__digits { width: min(400px, 84vw); }

	.cd-404x__bottle {
		left: -26px;
		bottom: 4px;
		width: 104px;
	}

	/* Keep the search on one line inside the card. */
	.cd-404x__card .cd-404__form .cd-input { flex: 1 1 120px; }

	.cd-404x .cd-pill--s2,
	.cd-404x .cd-pill--s3,
	.cd-404x .cd-pill--s5,
	.cd-404x .cd-pill--s6,
	.cd-404x .cd-tab--s1,
	.cd-404x .cd-tab--s2 { display: none; }

	.cd-404x .cd-pill--s1 {
		left: 3%;
		top: 8%;
		width: 84px;
		height: 28px;
	}

	.cd-404x .cd-pill--s4 {
		left: auto;
		right: 16%;
		bottom: 8%;
		width: 54px;
		height: 18px;
	}

	.cd-404x__card {
		grid-template-columns: minmax(0, 1fr);
	}

	.cd-404x__go {
		flex-direction: row;
		align-items: center;
		justify-content: flex-start;
		flex-wrap: wrap;
		gap: 18px;
	}
}

/* --------------------------------------------------------------------------
   5. Reduced motion
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.cd-pill,
	.cd-tab {
		animation: none !important;
	}
}
