/* ==========================================================================================================
   Sección claridad: simulador «sin lentes / con lentes».
   Un panel de cielo claro con la escena (16:9, 4:5 en móvil) y los controles debajo. La escena tiene dos copias
   idénticas: la base, desenfocada según el problema visual, y la nítida, recortada con la forma de las micas.
   ========================================================================================================== */

.claridad__panel {
	padding: 10px;
	margin-inline: auto;
}
/* En escritorio, escena y controles caben juntos en la pantalla: el panel se angosta en pantallas bajas para
   conservar el 16:9 sin obligar a desplazarse mientras pruebas. */
@media (min-width: 641px) {
	.claridad__panel { max-width: max(720px, calc((100svh - 330px) * 16 / 9 + 20px)); }
}
#claridad .nota { text-align: center; margin-inline: auto; }

/* ---------- Escena ------------------------------------------------------------------------------------------ */
.claridad__visor {
	position: relative;
	aspect-ratio: 16 / 9;
	border-radius: calc(var(--radio-xl) - 10px);
	/* clip y no hidden: con hidden, enfocar los lentes cuando están fuera del visor lo desplazaría */
	overflow: hidden;
	overflow: clip;
	container-type: size;
	isolation: isolate;
	background: #dfe7f1;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
	user-select: none;
	-webkit-user-select: none;
}
/* Canto interior del visor: una línea de luz arriba y un filo sutil, como vidrio montado */
.claridad__visor::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 6;
	border-radius: inherit;
	pointer-events: none;
	box-shadow: inset 0 0 0 1px rgba(10, 23, 51, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.claridad__escena,
.claridad__capa {
	position: absolute;
	inset: 0;
}
.claridad__capa { transform: translateZ(0); }
.claridad__lejos,
.claridad__cerca {
	position: absolute;
	inset: 0;
}
.claridad__capa--nitida { z-index: 1; }
/* La ventana viaja con los lentes y lleva el recorte con la forma de las micas (en unidades del SVG de los lentes);
   la copia nítida, del tamaño del visor, lleva la transformación inversa y el aumento de la mica. */
.claridad__ventana {
	position: absolute;
	left: 0;
	top: 0;
	width: 0;
	height: 0;
	transform-origin: 0 0;
	clip-path: path("M0 0Z");
}
.claridad__zoom {
	position: absolute;
	left: 0;
	top: 0;
	width: 100cqw;
	height: 100cqh;
	transform-origin: 0 0;
	filter: contrast(1.04) saturate(1.06);
}
/* Capas del compositor solo mientras algo se mueve o cambia (el módulo pone y quita estas clases) */
.claridad__ventana--viva,
.claridad__ventana--viva > .claridad__zoom { will-change: transform; }
.claridad__ventana--enfoca > .claridad__zoom { will-change: transform, filter; }
.claridad__capa--ajuste .claridad__lejos,
.claridad__capa--ajuste .claridad__cerca { will-change: filter; }
.claridad__capa--ajuste .claridad__neblina { will-change: opacity; }

/* El mundo lejano conserva la proporción de la foto y cubre la escena con margen, para que el desenfoque y el
   aumento de la mica nunca dejen ver un borde. */
.claridad__mundo {
	position: absolute;
	left: 50%;
	top: 50%;
	width: max(110cqw, 165cqh);
	aspect-ratio: 3 / 2;
	transform: translate(-50%, -50%);
}
.claridad__mundo img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	-webkit-user-drag: none;
	filter: brightness(1.05) saturate(0.94);
}

.claridad__neblina {
	position: absolute;
	inset: 0;
	pointer-events: none;
	background: linear-gradient(180deg, #ffffff, #eef5fd);
	opacity: 0.1;
}

/* Cartilla de agudeza visual en la pared del fondo */
.claridad__cartilla {
	position: absolute;
	left: 38.6%;
	top: 24%;
	width: 11.2%;
	aspect-ratio: 180 / 280;
	filter: drop-shadow(0 0.5cqw 0.9cqw rgba(12, 20, 40, 0.35));
}
.claridad__cartilla svg { width: 100%; height: 100%; }
.claridad__letras text {
	font-family: var(--f-sans);
	font-weight: 700;
	fill: #0d1424;
}
.claridad__raya { fill: var(--rojo); }

/* ---------- Teléfono de primer plano ------------------------------------------------------------------------ */
.claridad__telefono,
.claridad__hueco-tel {
	/* El ancho vive en una variable porque el propio teléfono es contenedor: sus medidas de caja deben
	   resolverse contra el visor, y las de su pantalla contra el teléfono. */
	--tel: 19cqw;
	position: absolute;
	right: 7cqw;
	bottom: -24cqh;
	width: var(--tel);
	aspect-ratio: 9 / 19;
	transform: rotate(-4deg);
	transform-origin: 50% 100%;
}
.claridad__telefono {
	container-type: inline-size;
	padding: calc(var(--tel) * 0.026);
	border-radius: calc(var(--tel) * 0.15);
	background: linear-gradient(145deg, #fbfdff 0%, #dfe6f0 48%, #f4f7fb 100%);
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, 0.9),
		inset 0 -1px 2px rgba(10, 23, 51, 0.12),
		0 1.4cqw 2.6cqw -0.6cqw rgba(10, 23, 51, 0.45),
		0 4cqw 7cqw -2cqw rgba(10, 23, 51, 0.35);
}
.claridad__pantalla {
	position: relative;
	height: 100%;
	overflow: hidden;
	border-radius: 12.4cqw;
	padding: 13cqw 6cqw 6cqw;
	background: linear-gradient(180deg, #e9f3ff 0%, #ffffff 34%);
	color: var(--texto);
	font-size: 4.4cqw;
	line-height: 1.45;
	box-shadow: inset 0 0 0 1px rgba(10, 23, 51, 0.08);
}
.claridad__pantalla p { text-wrap: pretty; }
.claridad__isla {
	position: absolute;
	top: 3.4cqw;
	left: 50%;
	width: 28cqw;
	height: 8cqw;
	margin-left: -14cqw;
	border-radius: 99px;
	background: #0b1220;
}
.claridad__estado {
	position: absolute;
	top: 4.2cqw;
	left: 9cqw;
	right: 8cqw;
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 4.2cqw;
	font-weight: 700;
	letter-spacing: -0.01em;
}
.claridad__iconos { display: flex; gap: 1.6cqw; align-items: center; }
.claridad__iconos i { display: block; background: var(--texto); border-radius: 1cqw; }
.claridad__iconos i:nth-child(1) { width: 4.5cqw; height: 3cqw; clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.claridad__iconos i:nth-child(2) { width: 4.2cqw; height: 3cqw; border-radius: 4cqw 4cqw 0.6cqw 0.6cqw; }
.claridad__iconos i:nth-child(3) { width: 7cqw; height: 3.2cqw; border-radius: 1cqw; }

.claridad__aviso {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 3cqw;
	margin-top: 3cqw;
	padding: 3.6cqw;
	border-radius: 6cqw;
	background: rgba(255, 255, 255, 0.92);
	box-shadow: 0 0.6cqw 2.4cqw rgba(20, 50, 120, 0.14), inset 0 0 0 1px rgba(10, 23, 51, 0.06);
}
.claridad__app-icono {
	width: 10cqw;
	height: 10cqw;
	border-radius: 3cqw;
	background: radial-gradient(circle at 50% 40%, #fff 0 22%, transparent 24%), linear-gradient(180deg, #5b8cff, var(--azul-marca));
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.claridad__aviso-cabeza {
	display: flex;
	justify-content: space-between;
	font-size: 3.6cqw;
	color: var(--texto-3);
}
.claridad__aviso-cabeza b { color: var(--texto-2); font-weight: 700; }
.claridad__aviso-titulo { font-weight: 700; font-size: 4.3cqw; line-height: 1.3; margin-top: 0.6cqw; }
.claridad__aviso-texto { font-size: 4cqw; color: var(--texto-2); }
.claridad__lectura-titulo {
	margin-top: 7cqw;
	font-size: 6.2cqw;
	font-weight: 700;
	letter-spacing: -0.02em;
	line-height: 1.15;
}
.claridad__lectura { margin-top: 2.4cqw; color: var(--texto-2); }

/* ---------- Etiquetas y onda ------------------------------------------------------------------------------- */
.claridad__marcas { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.claridad__marcas .claridad__mundo { overflow: visible; }
.claridad__tag {
	position: absolute;
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 5px 11px 5px 9px;
	border-radius: 999px;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--texto-2);
	white-space: nowrap;
	background: rgba(255, 255, 255, 0.84);
	border: 1px solid rgba(255, 255, 255, 0.9);
	box-shadow: var(--sombra-s);
	-webkit-backdrop-filter: blur(10px) saturate(160%);
	backdrop-filter: blur(10px) saturate(160%);
}
.claridad__tag--lejos,
.claridad__tag--cerca { transition: opacity 0.35s var(--ease-out), filter 0.35s var(--ease-out); }
.claridad__tag--tapada { opacity: 0; filter: blur(4px); }
.claridad__tag::before {
	content: "";
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--cielo-500);
	box-shadow: 0 0 0 3px rgba(46, 155, 255, 0.18);
}
.claridad__tag--lejos {
	left: 44.2%;
	top: 24%;
	transform: translate(-50%, calc(-100% - 8px));
}
.claridad__tag--cerca {
	left: 0;
	top: 4cqw;
	transform: translateX(calc(-100% - 10px)) rotate(4deg);
}
.claridad__tag--estado {
	left: 14px;
	top: 14px;
	color: var(--texto);
}
.claridad__tag--estado::before {
	background: #9aa5ba;
	box-shadow: 0 0 0 3px rgba(154, 165, 186, 0.25);
	filter: blur(0.6px);
}
.claridad__visor--con .claridad__tag--estado::before {
	background: var(--exito);
	box-shadow: 0 0 0 3px rgba(18, 168, 119, 0.2);
	filter: none;
}

/* La «gota» de vidrio que crece desde los lentes al ponértelos: solo el canto brillante */
.claridad__onda {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 1;
	width: 0;
	height: 0;
	border-radius: 50%;
	opacity: 0;
	pointer-events: none;
	box-shadow:
		inset 0 0 0 1.5px rgba(255, 255, 255, 0.95),
		inset 0 0 0 4px rgba(127, 207, 255, 0.35),
		inset 0 0 36px rgba(127, 207, 255, 0.45),
		0 0 0 1px rgba(20, 55, 230, 0.12),
		0 0 30px rgba(127, 207, 255, 0.35);
}

/* ---------- Lentes ------------------------------------------------------------------------------------------ */
.claridad__lentes {
	position: absolute;
	left: 0;
	top: 0;
	z-index: 3;
	touch-action: none; /* solo aquí: tocar la escena fuera de los lentes sigue desplazando la página */
	cursor: grab;
	border-radius: 999px;
	will-change: transform;
	-webkit-tap-highlight-color: transparent;
}
.claridad__lentes svg {
	width: 100%;
	height: 100%;
	overflow: visible;
	filter: drop-shadow(0 2px 2px rgba(10, 23, 51, 0.28)) drop-shadow(0 14px 18px rgba(20, 50, 130, 0.3));
	transition: filter 0.3s var(--ease-out);
}
.claridad__lentes--arrastre { cursor: grabbing; }
.claridad__lentes--arrastre svg {
	filter: drop-shadow(0 3px 3px rgba(10, 23, 51, 0.25)) drop-shadow(0 24px 26px rgba(20, 50, 130, 0.32));
}
.claridad__lentes:focus-visible {
	outline: 2px solid transparent; /* visible en modo de alto contraste */
	outline-offset: 4px;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95), 0 0 0 5px var(--azul-marca);
}
.claridad__lentes[aria-hidden="true"] { pointer-events: none; }

.claridad__destello { transform: translateX(-120px); }
.claridad--vivo .claridad__visor--asentado .claridad__destello {
	animation: claridad-destello 7s var(--ease-in-out) 0.4s infinite;
}
@keyframes claridad-destello {
	0% { transform: translateX(-120px); }
	16%, 100% { transform: translateX(120px); }
}

/* Pista: cómo usar los lentes (se va con la primera interacción) */
.claridad__pista {
	position: absolute;
	left: 50%;
	bottom: 16px;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 16px 8px 10px;
	border-radius: 999px;
	font-size: var(--t-chico);
	font-weight: 650;
	color: var(--texto);
	white-space: nowrap;
	pointer-events: none;
	transform: translateX(-50%);
	background: rgba(255, 255, 255, 0.86);
	border: 1px solid rgba(255, 255, 255, 0.95);
	box-shadow: var(--brillo-vidrio), var(--sombra);
	-webkit-backdrop-filter: blur(14px) saturate(170%);
	backdrop-filter: blur(14px) saturate(170%);
	transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out), filter 0.5s var(--ease-out);
}
.claridad__pista-icono {
	position: relative;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: radial-gradient(circle at 35% 30%, #fff 0 16%, #9ad9ff 38%, var(--cielo-500) 76%, var(--azul-marca) 100%);
	box-shadow: 0 2px 6px rgba(20, 55, 230, 0.35), inset 0 -2px 3px rgba(11, 37, 176, 0.3);
}
.claridad__pista-icono::before,
.claridad__pista-icono::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 5px;
	height: 5px;
	margin-top: -2.5px;
	border: solid #fff;
	border-width: 0 0 2px 2px;
}
.claridad__pista-icono::before { left: 5px; transform: rotate(45deg); }
.claridad__pista-icono::after { right: 5px; transform: rotate(-135deg); }
.claridad__pista--oculta {
	opacity: 0;
	filter: blur(6px);
	transform: translate(-50%, 8px);
}

/* ---------- Resultado (leyenda viva) ------------------------------------------------------------------------ */
.claridad__resultado {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 20px 18px 18px;
	border-bottom: 1px solid var(--borde);
}
.claridad__gota {
	flex: none;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	background: radial-gradient(circle at 34% 28%, #fff 0 16%, #bfe6ff 34%, #6cc4ff 62%, var(--cielo-500) 86%, var(--azul-marca) 100%);
	box-shadow: 0 4px 10px -2px rgba(20, 55, 230, 0.4), inset 0 -3px 5px rgba(11, 37, 176, 0.25);
}
.claridad__leyenda {
	font-size: clamp(1rem, 0.95rem + 0.3vw, 1.18rem);
	font-weight: 600;
	line-height: 1.45;
	letter-spacing: -0.01em;
	color: var(--texto);
}
.claridad__leyenda-con { color: var(--azul-marca); }

/* ---------- Controles --------------------------------------------------------------------------------------- */
.claridad__controles {
	display: grid;
	grid-template-columns: auto minmax(180px, 1fr) auto;
	gap: 24px clamp(24px, 3vw, 44px);
	align-items: start;
	padding: 20px 18px 16px;
}
.claridad__grupo { display: grid; gap: 10px; align-content: start; min-width: 0; }
.claridad__rotulo {
	font-size: var(--t-chico);
	font-weight: 700;
	color: var(--texto-2);
	letter-spacing: -0.005em;
}
.claridad__explica { font-size: var(--t-chico); color: var(--texto-2); line-height: 1.5; min-height: 1.5em; }
.claridad__fila { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.claridad__valor {
	font-size: 1.25rem;
	font-weight: 750;
	letter-spacing: -0.02em;
	color: var(--azul-marca);
}
.claridad__grupo--graduacion .deslizador { margin-block: -4px -6px; }
.claridad__escala {
	display: flex;
	justify-content: space-between;
	font-size: var(--t-mini);
	font-weight: 600;
	color: var(--texto-3);
}
.claridad__grupo--lentes { justify-items: start; }
.claridad__interruptor { font-size: 1.02rem; }
.claridad__ayuda { font-size: var(--t-mini); color: var(--texto-3); max-width: 19ch; }

/* ---------- Responsivo -------------------------------------------------------------------------------------- */
@media (max-width: 1000px) {
	.claridad__controles { grid-template-columns: minmax(0, 1fr) auto; }
	.claridad__grupo--problema { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
	.claridad__panel { padding: 6px; border-radius: var(--radio-l); }
	.claridad__visor { aspect-ratio: 4 / 5; border-radius: calc(var(--radio-l) - 6px); }
	.claridad__mundo { width: max(110cqw, 165cqh); }
	.claridad__cartilla { left: 39%; }
	.claridad__telefono,
	.claridad__hueco-tel { --tel: 38cqw; right: 5cqw; bottom: -17cqh; }
	.claridad__tag { font-size: 0.6875rem; padding: 4px 9px 4px 7px; }
	.claridad__tag--cerca { top: 10cqw; transform: translateX(calc(-100% - 6px)) rotate(4deg); }
	.claridad__pista { left: 12px; bottom: 12px; transform: none; font-size: var(--t-mini); padding: 6px 12px 6px 7px; gap: 8px; }
	.claridad__pista-icono { width: 22px; height: 22px; }
	.claridad__pista--oculta { transform: translateY(8px); }
	.claridad__resultado { padding: 16px 12px 14px; gap: 12px; align-items: flex-start; }
	.claridad__gota { width: 24px; height: 24px; margin-top: 2px; }
	.claridad__controles { grid-template-columns: minmax(0, 1fr); gap: 22px; padding: 16px 12px 12px; }
	.claridad__chips { display: grid; grid-template-columns: 1fr 1fr; }
	.claridad__chips .chip { justify-content: center; padding: 0 10px; }
	.claridad__grupo--lentes { grid-template-columns: auto 1fr; align-items: center; gap: 4px 16px; }
	.claridad__grupo--lentes .claridad__rotulo { grid-column: 1 / -1; }
	.claridad__ayuda { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
	.claridad__destello { animation: none !important; }
}
