/*
 * Sistema visual aislado del tema. Todas las reglas empiezan por cpd- para que
 * una actualización de este plugin no cambie otros artículos del periódico.
 */
.cpd-app {
	--cpd-ink: #172033;
	--cpd-muted: #556176;
	--cpd-border: #d7deea;
	--cpd-soft: #f5f7fb;
	--cpd-blue: #075985;
	--cpd-blue-dark: #0c3f5d;
	--cpd-gold: #f5b82e;
	--cpd-white: #ffffff;
	color: var(--cpd-ink);
	font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	margin-inline: auto;
	max-width: 1440px;
	padding: clamp(16px, 3vw, 44px);
}

.cpd-product-page .entry-content,
.cpd-product-page .wp-block-post-content {
	max-width: none;
}

.cpd-app *,
.cpd-app *::before,
.cpd-app *::after {
	box-sizing: border-box;
}

.cpd-hero {
	background:
		radial-gradient(circle at 92% 12%, rgba(245, 184, 46, 0.28), transparent 28%),
		linear-gradient(135deg, #052f48 0%, #075985 62%, #0f766e 100%);
	border-radius: 28px;
	color: var(--cpd-white);
	overflow: hidden;
	padding: clamp(28px, 6vw, 72px);
	position: relative;
}

.cpd-hero::after {
	border: 2px solid rgba(255, 255, 255, 0.18);
	border-radius: 50%;
	content: "";
	height: 220px;
	position: absolute;
	right: -58px;
	top: -92px;
	width: 220px;
}

.cpd-kicker {
	color: #fde9a9;
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.09em;
	margin: 0 0 12px;
	text-transform: uppercase;
}

.cpd-hero h1 {
	color: inherit;
	font-size: clamp(2rem, 5vw, 4.5rem);
	letter-spacing: -0.045em;
	line-height: 0.98;
	margin: 0;
	max-width: 850px;
}

.cpd-hero > p:last-child {
	color: rgba(255, 255, 255, 0.9);
	font-size: clamp(1rem, 1.8vw, 1.25rem);
	line-height: 1.65;
	margin: 24px 0 0;
	max-width: 790px;
}

.cpd-search-panel {
	background: var(--cpd-white);
	border: 1px solid var(--cpd-border);
	border-radius: 22px;
	box-shadow: 0 20px 55px rgba(24, 39, 75, 0.12);
	margin: clamp(-28px, -3vw, -18px) clamp(12px, 4vw, 64px) 28px;
	padding: clamp(18px, 3vw, 32px);
	position: relative;
	z-index: 500;
}

.cpd-search label {
	display: block;
	font-size: 0.92rem;
	font-weight: 800;
	margin-bottom: 9px;
}

.cpd-search-row {
	display: grid;
	gap: 10px;
	grid-template-columns: minmax(0, 1fr) auto;
}

.cpd-search-row input {
	background: var(--cpd-soft);
	border: 2px solid transparent;
	border-radius: 13px;
	color: var(--cpd-ink);
	font: inherit;
	font-size: 1.05rem;
	min-height: 52px;
	padding: 12px 16px;
	width: 100%;
}

.cpd-search-row input:focus {
	background: var(--cpd-white);
	border-color: var(--cpd-blue);
	box-shadow: 0 0 0 4px rgba(7, 89, 133, 0.15);
	outline: none;
}

.cpd-search-row button,
.cpd-detail-actions button,
.cpd-detail-actions a {
	align-items: center;
	background: var(--cpd-blue);
	border: 2px solid var(--cpd-blue);
	border-radius: 13px;
	color: var(--cpd-white);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 800;
	justify-content: center;
	min-height: 48px;
	padding: 11px 20px;
	text-decoration: none;
	transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.cpd-search-row button:hover,
.cpd-search-row button:focus-visible,
.cpd-detail-actions button:hover,
.cpd-detail-actions button:focus-visible {
	background: var(--cpd-blue-dark);
	border-color: var(--cpd-blue-dark);
	outline: 3px solid rgba(7, 89, 133, 0.24);
	outline-offset: 2px;
}

.cpd-help {
	color: var(--cpd-muted);
	font-size: 0.88rem;
	margin: 10px 0 0;
}

.cpd-status {
	border-radius: 10px;
	font-size: 0.92rem;
	font-weight: 700;
	margin-top: 12px;
}

.cpd-status:not(:empty) {
	background: #edf6fb;
	border-left: 4px solid var(--cpd-blue);
	padding: 10px 12px;
}

.cpd-status[data-kind="error"] {
	background: #fff1f2;
	border-left-color: #be123c;
	color: #881337;
}

.cpd-status[data-kind="success"] {
	background: #ecfdf5;
	border-left-color: #047857;
	color: #065f46;
}

.cpd-status[data-kind="notice"] {
	background: #fffbeb;
	border-left-color: #a16207;
	color: #713f12;
}

.cpd-results {
	display: grid;
	gap: 4px;
}

.cpd-results-section h3 {
	color: var(--cpd-ink);
	font-size: 1rem;
	margin: 18px 2px 0;
}

.cpd-results ul {
	display: grid;
	gap: 8px;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	list-style: none;
	margin: 8px 0 0;
	max-height: 280px;
	overflow: auto;
	padding: 2px;
}

.cpd-results li {
	margin: 0;
	padding: 0;
}

.cpd-result {
	align-items: center;
	background: var(--cpd-soft);
	border: 1px solid var(--cpd-border);
	border-radius: 12px;
	color: var(--cpd-ink);
	cursor: pointer;
	display: flex;
	font: inherit;
	gap: 12px;
	justify-content: space-between;
	min-height: 54px;
	padding: 10px 12px;
	text-align: left;
	width: 100%;
}

.cpd-result:hover,
.cpd-result:focus-visible {
	background: #e8f3f8;
	border-color: var(--cpd-blue);
	outline: 3px solid rgba(7, 89, 133, 0.17);
	outline-offset: 1px;
}

.cpd-result strong {
	background: #d7edf7;
	border-radius: 999px;
	color: #06415f;
	font-variant-numeric: tabular-nums;
	padding: 5px 9px;
}

/* Los resultados de calles llevan tres líneas porque una vía puede aparecer
 * en varios sectores. El nombre nunca comparte la píldora reservada al código. */
.cpd-street-result {
	align-items: flex-start;
	flex-direction: column;
	gap: 4px;
	justify-content: center;
}

.cpd-street-result strong {
	background: transparent;
	border-radius: 0;
	color: var(--cpd-ink);
	font-size: 1rem;
	padding: 0;
}

.cpd-street-location {
	color: var(--cpd-muted);
	font-size: 0.84rem;
	line-height: 1.45;
}

.cpd-street-action {
	color: var(--cpd-blue-dark);
	font-size: 0.82rem;
	font-weight: 800;
	margin-top: 4px;
	text-decoration: underline;
}

.cpd-workspace {
	display: grid;
	gap: 22px;
	grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.7fr);
}

.cpd-map-wrap,
.cpd-detail,
.cpd-method {
	background: var(--cpd-white);
	border: 1px solid var(--cpd-border);
	border-radius: 20px;
}

.cpd-map-wrap {
	overflow: hidden;
}

.cpd-map {
	background: #dce9ef;
	height: clamp(440px, 68vh, 760px);
	min-height: 440px;
	width: 100%;
}

.cpd-map--failed {
	align-items: center;
	color: #713f12;
	display: flex;
	justify-content: center;
	padding: 30px;
	text-align: center;
}

.cpd-map-note {
	color: var(--cpd-muted);
	font-size: 0.86rem;
	line-height: 1.55;
	margin: 0;
	padding: 12px 16px 14px;
}

.cpd-map-label {
	font-weight: 900;
	letter-spacing: 0.04em;
}

.cpd-detail {
	align-self: start;
	box-shadow: 0 15px 45px rgba(24, 39, 75, 0.08);
	padding: clamp(22px, 3vw, 34px);
	position: sticky;
	top: 24px;
}

.cpd-detail h2,
.cpd-method h2 {
	color: var(--cpd-ink);
	font-size: clamp(1.35rem, 2vw, 1.85rem);
	letter-spacing: -0.025em;
	margin: 0 0 12px;
}

.cpd-detail-location {
	color: var(--cpd-muted);
	line-height: 1.5;
	margin: 0 0 14px;
}

.cpd-code-label {
	color: var(--cpd-muted);
	font-size: 0.82rem;
	font-weight: 800;
	letter-spacing: 0.08em;
	margin: 24px 0 4px;
	text-transform: uppercase;
}

.cpd-code {
	color: var(--cpd-blue-dark);
	font-size: clamp(2.8rem, 7vw, 5.2rem);
	font-variant-numeric: tabular-nums;
	font-weight: 900;
	letter-spacing: 0.045em;
	line-height: 1;
	margin: 0;
}

.cpd-code:focus {
	outline: 3px solid var(--cpd-gold);
	outline-offset: 4px;
}

.cpd-confirmation {
	background: #ecfdf5;
	border-left: 4px solid #047857;
	border-radius: 8px;
	color: #065f46;
	font-size: 0.9rem;
	margin: 20px 0;
	padding: 10px 12px;
}

.cpd-confirmation--pending {
	background: #fffbeb;
	border-left-color: #a16207;
	color: #713f12;
}

.cpd-detail-actions {
	display: grid;
	gap: 10px;
}

.cpd-detail-actions a {
	background: var(--cpd-white);
	color: var(--cpd-blue-dark);
}

.cpd-detail-actions a:hover,
.cpd-detail-actions a:focus-visible {
	background: #e8f3f8;
	outline: 3px solid rgba(7, 89, 133, 0.17);
	outline-offset: 2px;
}

.cpd-method {
	line-height: 1.65;
	margin-top: 28px;
	padding: clamp(24px, 4vw, 44px);
}

.cpd-method a {
	color: var(--cpd-blue-dark);
	font-weight: 800;
}

.cpd-disclaimer {
	background: #fffbeb;
	border-left: 4px solid #a16207;
	border-radius: 8px;
	color: #713f12;
	padding: 12px 14px;
}

.cpd-ownership {
	color: var(--cpd-muted);
	font-size: 0.86rem;
	margin-bottom: 0;
}

.cpd-app .leaflet-control-attribution {
	background: rgba(255, 255, 255, 0.92);
	font-size: 11px;
}

@media (max-width: 900px) {
	.cpd-workspace {
		grid-template-columns: 1fr;
	}

	.cpd-detail {
		position: static;
	}

	.cpd-map {
		height: 58vh;
		min-height: 420px;
	}
}

@media (max-width: 560px) {
	.cpd-app {
		padding: 10px;
	}

	.cpd-hero {
		border-radius: 20px;
		padding: 28px 20px 48px;
	}

	.cpd-search-panel {
		margin: -24px 8px 20px;
		padding: 16px;
	}

	.cpd-search-row {
		grid-template-columns: 1fr;
	}

	.cpd-results ul {
		grid-template-columns: 1fr;
	}

	.cpd-map {
		height: 60vh;
		min-height: 380px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cpd-app *,
	.cpd-app *::before,
	.cpd-app *::after {
		scroll-behavior: auto !important;
		transition-duration: 0.01ms !important;
	}
}

@media (forced-colors: active) {
	.cpd-result,
	.cpd-search-row input,
	.cpd-map-wrap,
	.cpd-detail,
	.cpd-method {
		border: 2px solid CanvasText;
	}
}
