/* Celppro Premium pricing — the homepage's pricing sheet and the /pricing page.
 *
 * Loaded after celppro-home.css and built only from its :root tokens and cp- conventions
 * (hairlines, 14px cards, 10px controls, Archivo + IBM Plex Mono for figures). The markup is
 * celpipedu/templates/includes/celppro/pricing_*.html; behaviour is public/js/celppro-pricing.js.
 */

.cp-pr-visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The page under an open sheet does not scroll (a modal <dialog> alone doesn't stop it). */
html.cp-lock {
	overflow: hidden;
}

.cp-sub .cp-after {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.cp-badge--success {
	background: var(--success-100);
	color: var(--success-500);
}

/* ---------- Sheet (homepage) ---------- */
.cp-sheet {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 24px 0 0;
	border: 0;
	background: transparent;
	/* clip, not hidden: a hidden box can still be scrolled, and moving focus into the sheet as it
	   opens scrolled it by the panel's whole height, cancelling the rise (it read as top-down). */
	overflow: clip;
	overflow-anchor: none;
}
.cp-sheet::backdrop {
	background: rgba(17, 0, 33, 0.5);
}
.cp-sheet__panel {
	position: relative;
	height: 100%;
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--surface-page);
	border-radius: 18px 18px 0 0;
	box-shadow: var(--shadow-md);
}
.cp-sheet[open] .cp-sheet__panel {
	/* Rises from the bottom edge of the screen, as a bottom sheet does. Closing stays instant. */
	animation: cp-sheet-rise 520ms cubic-bezier(0.32, 0.72, 0, 1);
}
.cp-sheet[open]::backdrop {
	animation: cp-fade 520ms var(--ease-out);
}
/* Closing: the panel slides back down and the dim fades out. */
.cp-sheet.is-closing .cp-sheet__panel {
	animation: cp-sheet-drop 320ms cubic-bezier(0.4, 0, 1, 1) forwards;
}
.cp-sheet.is-closing::backdrop {
	animation: cp-fade-out 320ms var(--ease-out) forwards;
}
@keyframes cp-sheet-drop {
	from {
		transform: none;
	}
	to {
		transform: translateY(100%);
	}
}
@keyframes cp-fade-out {
	from {
		opacity: 1;
	}
	to {
		opacity: 0;
	}
}
@keyframes cp-sheet-rise {
	from {
		transform: translateY(100%);
	}
	to {
		transform: none;
	}
}
@keyframes cp-fade {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}
@keyframes cp-sheet-up {
	from {
		transform: translateY(48px);
		opacity: 0;
	}
	to {
		transform: none;
		opacity: 1;
	}
}
.cp-sheet__close {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--border-default);
	border-radius: 50%;
	background: var(--surface-card);
	color: var(--text-primary);
	cursor: pointer;
	transition: var(--transition-control);
}
.cp-sheet__close:hover {
	background: var(--surface-sunken);
	border-color: var(--border-strong);
}
.cp-sheet__close:focus-visible,
.cp-plan__input:focus-visible + .cp-plan__body {
	outline: none;
	box-shadow: var(--ring-focus);
}
/* Stays in reach while the sheet scrolls. */
.cp-sheet__panel > .cp-sheet__close {
	position: sticky;
	top: 16px;
	float: right;
	margin: 16px 16px -56px 0;
	z-index: 3;
}

/* ---------- Hero ---------- */
.cp-pr-hero {
	padding: 56px 0 44px;
	background: var(--grey-25);
	border-bottom: 1px solid var(--border-subtle);
}
.cp-pr-brand {
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-weight: var(--weight-bold);
	letter-spacing: -0.01em;
}
.cp-pr-title {
	margin-top: 20px;
	max-width: 760px;
	font-size: clamp(32px, 4.4vw, 52px);
	font-weight: var(--weight-black);
	letter-spacing: -0.03em;
	line-height: 1.05;
}
.cp-pr-title:focus {
	outline: none;
}
.cp-pr-sub {
	margin-top: 16px;
	max-width: 640px;
	font-size: 18px;
	line-height: 1.6;
	color: var(--text-secondary);
}

/* ---------- Plans + unlocks + guarantee ---------- */
.cp-pr-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
	grid-template-areas:
		"unlocks buy"
		"guarantee buy";
	gap: 32px 64px;
	align-items: start;
	padding-top: 48px;
	padding-bottom: 56px;
}
.cp-pr-buy {
	grid-area: buy;
	position: sticky;
	top: 24px;
}
.cp-pricing-page .cp-pr-buy {
	top: calc(var(--nav-h) + 24px);
}
.cp-pr-unlocks {
	grid-area: unlocks;
}
.cp-guarantee {
	grid-area: guarantee;
}

.cp-plans {
	display: grid;
	gap: 12px;
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}
.cp-plan {
	position: relative;
	display: block;
	cursor: pointer;
}
.cp-plan__input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}
.cp-plan__body {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 14px;
	padding: 18px;
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	background: var(--surface-card);
	transition: var(--transition-control);
}
.cp-plan:hover .cp-plan__body {
	border-color: var(--border-strong);
}
.cp-plan__input:checked + .cp-plan__body {
	border-color: var(--border-brand);
	background: var(--surface-brand-tint);
	box-shadow: 0 0 0 1px var(--border-brand);
}
.cp-plan__radio {
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	border: 1.5px solid var(--border-strong);
	border-radius: 50%;
	background: var(--surface-card);
}
.cp-plan__input:checked + .cp-plan__body .cp-plan__radio {
	border-color: var(--border-brand);
}
.cp-plan__input:checked + .cp-plan__body .cp-plan__radio::after {
	content: "";
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--surface-brand);
}
.cp-plan__tag {
	position: absolute;
	top: -10px;
	right: 16px;
	padding: 2px 10px;
	border-radius: var(--radius-pill);
	background: var(--surface-brand);
	color: var(--text-on-brand);
	font-family: var(--font-display);
	font-size: 11px;
	font-weight: var(--weight-semibold);
	letter-spacing: 0.01em;
}
.cp-plan__name {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-family: var(--font-display);
	font-size: 17px;
	font-weight: var(--weight-bold);
	letter-spacing: -0.01em;
	color: var(--text-primary);
}
.cp-plan__billed {
	display: block;
	margin-top: 4px;
	font-size: 13px;
	color: var(--text-secondary);
}
.cp-plan__billed s,
.cp-pr-hub s {
	color: var(--text-muted);
}
.cp-plan__price {
	text-align: right;
}
.cp-plan__num {
	font-family: var(--font-mono);
	font-size: 24px;
	font-weight: var(--weight-medium);
	color: var(--text-primary);
	white-space: nowrap;
}
.cp-plan__cur {
	margin-right: 2px;
	font-size: 11px;
	color: var(--text-muted);
	vertical-align: 0.6em;
}
.cp-plan__per {
	display: block;
	font-size: 12px;
	color: var(--text-muted);
}

.cp-pr-continue {
	width: 100%;
	margin-top: 16px;
	justify-content: space-between;
}
.cp-pr-continue strong {
	font-weight: var(--weight-bold);
}
.cp-pr-continue__price {
	font-family: var(--font-mono);
	font-weight: var(--weight-medium);
}
.cp-pr-assure {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px 18px;
	margin-top: 12px;
	font-size: 13px;
	color: var(--text-secondary);
}
.cp-pr-assure span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
.cp-pr-assure .cp-icon {
	color: var(--success-500);
}
.cp-pr-hub {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 20px;
	padding: 14px 16px;
	border: 1px solid var(--border-default);
	border-radius: var(--radius-md);
	font-size: var(--text-body-sm);
	color: var(--text-secondary);
}
.cp-pr-hub strong {
	color: var(--text-primary);
}
.cp-pr-hub .cp-pr-hub__free {
	color: var(--success-500);
}

.cp-pr-h3 {
	font-family: var(--font-display);
	font-size: 22px;
	font-weight: var(--weight-bold);
	letter-spacing: -0.02em;
}
.cp-unlocks {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 20px 24px;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}
.cp-unlocks li {
	display: flex;
	gap: 12px;
}
.cp-unlocks li > span:last-child {
	flex: 1;
	min-width: 0;
}
.cp-unlocks__icon {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 36px;
	height: 36px;
	border-radius: var(--radius-md);
	background: var(--surface-brand-tint);
	color: var(--purple-600);
}
.cp-unlocks strong {
	display: block;
	font-size: 15px;
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}
.cp-unlocks li > span > span {
	display: block;
	margin-top: 2px;
	font-size: 13px;
	color: var(--text-secondary);
}

.cp-guarantee {
	display: flex;
	gap: 16px;
	padding: 24px;
	border: 1px solid var(--border-default);
	border-radius: var(--radius-lg);
	background: var(--surface-card);
}
.cp-guarantee__icon {
	display: flex;
	color: var(--success-500);
}
.cp-guarantee .cp-pr-h3 {
	font-size: 18px;
}
.cp-guarantee p {
	margin: 8px 0;
	font-size: var(--text-body-sm);
	line-height: var(--leading-body);
	color: var(--text-secondary);
}

/* ---------- Reviews, compare, FAQ ---------- */
.cp-pr-section {
	padding: 56px 0;
	border-top: 1px solid var(--border-subtle);
}
.cp-pr-h2 {
	font-family: var(--font-display);
	font-size: clamp(24px, 2.6vw, 32px);
	font-weight: var(--weight-bold);
	letter-spacing: -0.025em;
	line-height: 1.15;
}
.cp-pr-section .cp-pr-sub {
	margin-top: 8px;
	font-size: var(--text-body);
}
.cp-pr-section .cp-reviews {
	margin-top: 28px;
}
.cp-compare th:not(:first-child),
.cp-compare td:not(:first-child) {
	text-align: center;
}
.cp-compare .cp-compare__yes {
	font-weight: var(--weight-semibold);
	color: var(--text-primary);
}
.cp-compare__no {
	display: inline-flex;
	color: var(--text-muted);
}

/* ---------- Sign in to continue ---------- */
.cp-auth {
	width: calc(100% - 32px);
	max-width: 420px;
	padding: 40px 32px 28px;
	border: 0;
	border-radius: var(--radius-lg);
	background: var(--surface-card);
	color: var(--text-primary);
	box-shadow: var(--shadow-md);
	text-align: center;
}
.cp-auth::backdrop {
	background: rgba(17, 0, 33, 0.5);
}
.cp-auth[open] {
	animation: cp-sheet-up var(--duration-base) var(--ease-out);
}
.cp-auth__close {
	position: absolute;
	top: 12px;
	right: 12px;
}
.cp-auth__icon {
	display: inline-flex;
	color: var(--purple-600);
}
.cp-auth__title {
	margin-top: 12px;
	font-family: var(--font-display);
	font-size: 22px;
	font-weight: var(--weight-bold);
	letter-spacing: -0.02em;
}
.cp-auth__body {
	margin-top: 8px;
	font-size: var(--text-body-sm);
	line-height: var(--leading-body);
	color: var(--text-secondary);
}
.cp-auth__cta {
	width: 100%;
	margin-top: 20px;
}
.cp-auth__alt {
	margin-top: 14px;
	font-size: var(--text-body-sm);
	color: var(--text-secondary);
}
.cp-auth__alt a {
	font-weight: var(--weight-semibold);
}

/* ---------- Phones: the Continue bar ---------- */
.cp-pr-bar {
	display: none;
}

@media (max-width: 900px) {
	.cp-pr-grid {
		grid-template-columns: minmax(0, 1fr);
		grid-template-areas:
			"buy"
			"unlocks"
			"guarantee";
		gap: 40px;
	}
	.cp-pr-buy,
	.cp-pricing-page .cp-pr-buy {
		position: static;
	}
}

@media (max-width: 640px) {
	.cp-sheet {
		padding-top: 12px;
	}
	.cp-sheet__panel > .cp-sheet__close {
		margin: 12px 12px -52px 0;
		top: 12px;
	}
	.cp-pr-hero {
		padding: 40px 0 32px;
	}
	.cp-pr-sub {
		font-size: 16px;
	}
	.cp-pr-grid {
		padding-top: 32px;
		padding-bottom: 40px;
	}
	.cp-plan__body {
		gap: 12px;
		padding: 16px 14px;
	}
	.cp-plan__num {
		font-size: 20px;
	}
	.cp-unlocks {
		grid-template-columns: minmax(0, 1fr);
	}
	.cp-guarantee {
		padding: 20px;
	}
	.cp-pr-section {
		padding: 44px 0;
	}
	/* The bar carries Continue on phones; the one under the plans would only repeat it. */
	.cp-pr-buy .cp-pr-continue,
	.cp-pr-buy .cp-pr-assure {
		display: none;
	}
	.cp-pr-bar {
		display: block;
		position: sticky;
		bottom: 0;
		z-index: 5;
		padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
		background: rgba(255, 255, 255, 0.96);
		-webkit-backdrop-filter: blur(8px);
		backdrop-filter: blur(8px);
		border-top: 1px solid var(--border-subtle);
	}
	.cp-pr-bar .cp-pr-continue {
		margin-top: 0;
	}
	.cp-pr-bar .cp-pr-assure {
		margin-top: 8px;
		font-size: 12px;
	}
	.cp-pricing-page .cp-pr-bar {
		position: fixed;
		left: 0;
		right: 0;
	}
	.cp-pricing-page {
		padding-bottom: 112px;
	}
}

@media (prefers-reduced-motion: reduce) {
	/* Less motion asked for: no slide, just a fade. */
	.cp-sheet[open] .cp-sheet__panel,
	.cp-sheet[open]::backdrop,
	.cp-auth[open] {
		animation: cp-fade var(--duration-base) var(--ease-out);
	}
	.cp-sheet.is-closing .cp-sheet__panel,
	.cp-sheet.is-closing::backdrop {
		animation: cp-fade-out var(--duration-base) var(--ease-out) forwards;
	}
}
