/**
 * CA UPK Pre-K Options Block Styles
 * Version: 2.0.1
 */

.ca-upk-prek-options {
	font-family: inherit;
}

/* Alignwide support - match theme's 1200px max-width */
.ca-upk-prek-options.alignwide {
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	width: 100%;
}

/* Alignfull support - full viewport width */
.ca-upk-prek-options.alignfull {
	max-width: none;
	width: 100%;
}

/* When alignwide block is inside Cover Block, override Cover's inner container constraint */
.wp-block-cover__inner-container:has(.ca-upk-prek-options.alignwide) {
	max-width: 1200px !important;
}

/* When alignfull block is inside Cover Block, remove Cover's inner container constraint */
.wp-block-cover__inner-container:has(.ca-upk-prek-options.alignfull) {
	max-width: none !important;
}

.ca-upk-prek-inner {
	padding: 2.5rem 1rem;
}

.ca-upk-prek-header {
	text-align: center;
	margin-bottom: 1.5rem;
}

.ca-upk-prek-header h2 {
	margin: 0;
	color: var(--upk-dark-blue);
	font-size: clamp(1.75rem, 3vw, 2.5rem);
	line-height: 1.2;
}

/* Info-level selector */
.ca-upk-prek-filters {
	background: var(--white);
	padding: 1.25rem 1.75rem;
	margin-bottom: 2rem;
	border-radius: 12px;
	border: 2px solid rgba(0, 117, 169, 0.15);
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
	flex-wrap: wrap;
}

/* When selector is hidden, center the text */
.ca-upk-prek-filters:not(:has(.ca-upk-prek-selector)) {
	justify-content: center;
}

.ca-upk-prek-filters-text {
	flex: 1 1 auto;
	max-width: 65%;
	text-align: left;
}

/* When selector is hidden, allow text to be full width */
.ca-upk-prek-filters:not(:has(.ca-upk-prek-selector)) .ca-upk-prek-filters-text {
	max-width: 100%;
	text-align: center;
}

.ca-upk-prek-filters-text p {
	margin: 0;
	color: var(--upk-dark-blue);
	font-size: 1rem;
	line-height: 1.5;
	font-weight: 500;
}

.ca-upk-prek-selector {
	border: none;
	padding: 0;
	margin: 0;
	display: inline-flex;
	gap: 0.5rem;
	flex-wrap: nowrap;
	justify-content: flex-end;
	flex: 0 1 auto;
	white-space: nowrap;
}

.ca-upk-prek-selector-option {
	display: inline-block;
	cursor: pointer;
}

.ca-upk-prek-selector-option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.ca-upk-prek-selector-option span {
	display: inline-block;
	padding: 0.5rem 1.25rem;
	background: var(--upk-light-gray);
	border: 2px solid transparent;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--upk-dark-blue);
	transition: all 0.2s ease;
}

.ca-upk-prek-selector-option input:checked + span {
	background: var(--upk-medium-blue);
	border-color: var(--upk-medium-blue);
	color: var(--white);
	box-shadow: 0 2px 8px rgba(0, 117, 169, 0.25);
}

.ca-upk-prek-selector-option:hover span {
	border-color: var(--upk-medium-blue);
	background: rgba(234, 243, 250, 1);
}

.ca-upk-prek-selector-option input:focus-visible + span {
	outline: 2px solid var(--upk-medium-blue);
	outline-offset: 2px;
}

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

/* Program cards grid */
.ca-upk-prek-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 1.5rem;
}

.ca-upk-prek-card {
	background: var(--white);
	border-radius: 20px;
	border: 2px solid rgba(0, 57, 93, 0.1);
	overflow: hidden;
	transition: transform 0.3s ease, box-shadow 0.3s ease;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
	position: relative;
}

.ca-upk-prek-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 12px 24px rgba(0, 57, 93, 0.15);
	border-color: rgba(0, 57, 93, 0.2);
}

/* Card-level toggle button */
.ca-upk-prek-card-toggle {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 10;
	width: 32px;
	height: 32px;
	background: var(--card-color, var(--upk-medium-blue));
	border: 2px solid var(--card-color, var(--upk-medium-blue));
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: all 0.25s ease;
	padding: 0;
	color: var(--black);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.ca-upk-prek-card-toggle:hover {
	transform: scale(1.12);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	border-width: 3px;
}

.ca-upk-prek-card-toggle:focus {
	outline: 3px solid var(--upk-dark-blue);
	outline-offset: 2px;
}

.ca-upk-prek-card-toggle:focus:not(:focus-visible) {
	outline: none;
}

.ca-upk-prek-card-toggle:focus-visible {
	outline: 3px solid var(--upk-dark-blue);
	outline-offset: 2px;
}

.ca-upk-prek-card-toggle[aria-pressed="true"] {
	border-color: var(--upk-dark-blue);
}

.ca-upk-prek-card-toggle svg {
	transition: transform 0.3s ease;
	width: 16px;
	height: 16px;
}

.ca-upk-prek-card[data-card-level="deep"] .ca-upk-prek-card-toggle svg {
	transform: rotate(180deg);
}

/* Hide toggle button when level is locked */
.ca-upk-prek-grid[data-lock-level="true"] .ca-upk-prek-card-toggle {
	display: none;
}

/* Featured image with duotone */
.ca-upk-prek-card-image {
	position: relative;
	height: 160px;
	overflow: hidden;
	border-radius: 20px 20px 0 0;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

/* Disable image click cursor when level is locked */
.ca-upk-prek-grid[data-lock-level="true"] .ca-upk-prek-card-image {
	cursor: default;
}

.ca-upk-prek-card-image:hover {
	opacity: 0.9;
}

/* Disable hover effect when level is locked */
.ca-upk-prek-grid[data-lock-level="true"] .ca-upk-prek-card-image:hover {
	opacity: 1;
}

.ca-upk-prek-card-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	filter: grayscale(100%) contrast(1.2);
	mix-blend-mode: multiply;
	border-radius: 0 !important;
}

.ca-upk-prek-card-image::after {
	content: '';
	position: absolute;
	inset: 0;
	background: var(--duotone-color, var(--upk-dark-blue));
	opacity: 0.7;
	mix-blend-mode: screen;
	pointer-events: none;
}

/* Full color mode - disable duotone effect */
.ca-upk-prek-card-image--full-color::after {
	display: none;
}

.ca-upk-prek-card-image--full-color img {
	filter: none;
}

/* Card header */
.ca-upk-prek-card-header {
	padding: 1rem 1.25rem;
	color: var(--black);
	min-height: 120px;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	position: relative;
}

.ca-upk-prek-card-header h3 {
	margin: 0;
	font-size: 1.25rem;
	line-height: 1.3;
	font-weight: 700;
	position: relative;
	z-index: 1;
}

.ca-upk-prek-card-tag {
	margin: 0.35rem 0 0;
	font-size: 0.875rem;
	line-height: 1.3;
	position: relative;
	z-index: 1;
	opacity: 0.85;
}

/* Card body */
.ca-upk-prek-card-body {
	padding: 1.25rem;
	transition: all 0.3s ease;
}

.ca-upk-prek-tagline {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.4;
	color: var(--upk-dark-blue);
}

.ca-upk-prek-field {
	margin-bottom: 1rem;
	font-size: 0.9rem;
	line-height: 1.4;
	color: var(--upk-dark-blue);
}

.ca-upk-prek-field:last-of-type {
	margin-bottom: 0;
}

.ca-upk-prek-field strong {
	display: block;
	font-weight: 700;
	color: var(--upk-dark-blue);
	margin-bottom: 0.35rem;
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

/* Tier visibility - Global level */
.ca-upk-prek-tier {
	display: none;
	animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
	from {
		opacity: 0;
		transform: translateY(-5px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.ca-upk-prek-grid[data-info-level="skim"] .ca-upk-prek-tier[data-tier="skim"] {
	display: block;
}

.ca-upk-prek-grid[data-info-level="deep"] .ca-upk-prek-tier {
	display: block;
}

/* Tier visibility - Per-card override */
.ca-upk-prek-card[data-card-level="deep"] .ca-upk-prek-tier {
	display: block !important;
}

.ca-upk-prek-tier + .ca-upk-prek-tier {
	margin-top: 0.5rem;
}

/* CTA button */
.ca-upk-prek-cta {
	display: block;
	width: 100%;
	margin-top: 1.25rem;
	padding: 0.75rem 1.5rem;
	background: transparent;
	color: var(--upk-dark-blue);
	text-decoration: none;
	text-align: center;
	border: 2px solid var(--upk-medium-blue);
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.875rem;
	transition: all 0.2s ease;
}

.ca-upk-prek-cta:hover {
	background: var(--upk-medium-blue);
	color: var(--white);
	transform: translateY(-1px);
	box-shadow: 0 4px 12px rgba(0, 117, 169, 0.3);
}

.ca-upk-prek-cta:focus {
	outline: 2px solid var(--upk-medium-blue);
	outline-offset: 2px;
}

/* Expandable panel */
.ca-upk-prek-toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	margin-top: 1.25rem;
	padding: 0.75rem 1rem;
	background: var(--upk-light-gray);
	border: 2px solid transparent;
	border-radius: 8px;
	font-weight: 600;
	font-size: 0.875rem;
	color: var(--upk-dark-blue);
	cursor: pointer;
	transition: all 0.2s ease;
}

.ca-upk-prek-toggle:hover {
	background: #d5e7f5;
	border-color: var(--upk-light-blue);
}

.ca-upk-prek-toggle:focus {
	outline: 2px solid var(--upk-medium-blue);
	outline-offset: 2px;
}

.ca-upk-prek-toggle-icon {
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1;
	transition: transform 0.3s ease;
}

.ca-upk-prek-toggle[aria-expanded="true"] {
	background: var(--upk-medium-blue);
	color: var(--white);
	border-color: var(--upk-medium-blue);
}

.ca-upk-prek-toggle[aria-expanded="true"] .ca-upk-prek-toggle-icon {
	transform: rotate(45deg);
}

.ca-upk-prek-panel {
	margin-top: 0.75rem;
	padding: 1rem;
	background: var(--upk-light-gray);
	border-radius: 8px;
	border: 2px solid rgba(0, 117, 169, 0.1);
	font-size: 0.9rem;
	line-height: 1.5;
}

.ca-upk-prek-panel[hidden] {
	display: none;
}

.ca-upk-prek-panel h4 {
	margin: 0 0 0.5rem;
	font-size: 0.95rem;
	font-weight: 700;
	color: var(--upk-dark-blue);
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.ca-upk-prek-panel ul {
	margin: 0;
	padding-left: 1.25rem;
}

.ca-upk-prek-panel li {
	margin-bottom: 0.35rem;
	line-height: 1.5;
	color: var(--upk-dark-blue);
}

.ca-upk-prek-panel p {
	margin: 0 0 0.75rem;
	line-height: 1.5;
	color: var(--upk-dark-blue);
}

.ca-upk-prek-panel p:last-child {
	margin-bottom: 0;
}

/* Responsive */
@media (max-width: 1024px) {
	.ca-upk-prek-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 768px) {
	.ca-upk-prek-filters {
		flex-direction: column;
		align-items: stretch;
		padding: 1rem;
		gap: 1rem;
	}

	.ca-upk-prek-filters-text {
		max-width: 100%;
		text-align: left;
	}

	.ca-upk-prek-filters-text p {
		font-size: 0.95rem;
	}

	.ca-upk-prek-selector {
		justify-content: center;
		width: 100%;
		flex-wrap: wrap;
	}

	.ca-upk-prek-selector-option {
		flex: 1 1 auto;
		min-width: 45%;
	}

	.ca-upk-prek-selector-option span {
		display: block;
		text-align: center;
	}
}

@media (max-width: 640px) {
	.ca-upk-prek-grid {
		grid-template-columns: 1fr;
	}

	.ca-upk-prek-card-toggle {
		width: 36px;
		height: 36px;
		top: 12px;
		right: 12px;
	}

	.ca-upk-prek-card-toggle svg {
		width: 18px;
		height: 18px;
	}
}

