/**
 * Rueda de Valores — The Home Depot México
 * Autor: CERTERO Estudio
 *
 * Hoja de estilos del componente. Tipografía Helvetica con respaldo
 * Nimbus Sans autoalojado (clon métrico libre de Helvetica) para
 * garantizar la misma apariencia en cualquier sistema operativo.
 */

/* ---------------------------------------------------------------
 * Tipografía autoalojada (sin CDNs ni peticiones a terceros)
 * --------------------------------------------------------------- */
@font-face {
	font-family: 'Nimbus Sans THD';
	src: url('../fonts/NimbusSans-Regular.woff2') format('woff2');
	font-weight: 400;
	font-style: normal;
	font-display: swap;
}

@font-face {
	font-family: 'Nimbus Sans THD';
	src: url('../fonts/NimbusSans-Bold.woff2') format('woff2');
	font-weight: 700;
	font-style: normal;
	font-display: swap;
}

/* ---------------------------------------------------------------
 * Variables de marca
 * --------------------------------------------------------------- */
.thd-rueda {
	/* Paleta oficial tomada del newsroom de The Home Depot México. */
	--thd-naranja: #f96302;
	--thd-naranja-intenso: #ee6123;
	--thd-durazno: #f9cbb2;
	--thd-gris: #54565a;
	--thd-blanco: #ffffff;
	--thd-fuente: 'Nimbus Sans THD', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	--thd-transicion: 320ms cubic-bezier(0.33, 1, 0.68, 1);

	font-family: var(--thd-fuente);
	display: grid;
	grid-template-columns: minmax(0, 11fr) minmax(0, 9fr);
	align-items: center;
	gap: clamp(1.5rem, 4vw, 4rem);
	/* Ancho determinista: el componente nunca depende del texto activo,
	 * lo que garantiza una experiencia sin saltos entre valores. */
	width: 100%;
	max-width: 1080px;
	margin-inline: auto;
	padding: clamp(1rem, 3vw, 2rem);
	box-sizing: border-box;
}

.thd-rueda *,
.thd-rueda *::before,
.thd-rueda *::after {
	box-sizing: inherit;
}

/* ---------------------------------------------------------------
 * Gráfico (SVG)
 * --------------------------------------------------------------- */
.thd-rueda__grafico {
	position: relative;
	width: 100%;
}

/* Solo el SVG principal de la rueda (hijo directo); los íconos del
 * botón de control tienen sus propias reglas. */
.thd-rueda__grafico > svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

/* Cada sector es interactivo: cursor, foco y animación de énfasis. */
.thd-rueda__sector {
	cursor: pointer;
	outline: none;
	transition: transform var(--thd-transicion);
	will-change: transform;
}

.thd-rueda__gajo {
	fill: var(--thd-durazno);
	stroke: var(--thd-blanco);
	stroke-width: 9;
	stroke-linejoin: round;
	transition: fill var(--thd-transicion);
}

/* Estado activo: el sector se enciende en naranja institucional y se
 * desplaza suavemente hacia afuera sobre su propio eje radial. */
.thd-rueda__sector.is-activa {
	transform: translate(var(--tx), var(--ty));
}

.thd-rueda__sector.is-activa .thd-rueda__gajo {
	fill: var(--thd-naranja);
}

/* Refuerzo visual al pasar el puntero, aun sin estado activo. */
.thd-rueda__sector:hover .thd-rueda__gajo {
	fill: var(--thd-naranja);
}

/* Anillo de foco accesible al navegar con teclado. */
.thd-rueda__sector:focus-visible .thd-rueda__gajo {
	stroke: var(--thd-gris);
	stroke-width: 5;
}

.thd-rueda__etiqueta {
	fill: var(--thd-blanco);
	font-family: var(--thd-fuente);
	font-size: 36px;
	font-weight: 700;
	letter-spacing: 0.2px;
	pointer-events: none;
	user-select: none;
}

/* Textura grunge sutil sobre la corona. */
.thd-rueda__textura {
	fill: var(--thd-blanco);
	fill-rule: evenodd;
	opacity: 0.38;
}

/* Sombra suave del logotipo central. */
.thd-rueda__logo {
	filter: drop-shadow(0 6px 18px rgba(84, 86, 90, 0.35));
}

/* ---------------------------------------------------------------
 * Botón de reproducción del recorrido
 * --------------------------------------------------------------- */
.thd-rueda__control {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	margin: 1.25rem auto 0;
	padding: 0.55rem 1.2rem;
	border: 2px solid var(--thd-naranja);
	border-radius: 999px;
	background: var(--thd-blanco);
	color: var(--thd-naranja);
	font-family: var(--thd-fuente);
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	transition: background var(--thd-transicion), color var(--thd-transicion);
}

.thd-rueda__control:hover,
.thd-rueda__control.es-reproduciendo {
	background: var(--thd-naranja);
	color: var(--thd-blanco);
}

.thd-rueda__control:focus-visible {
	outline: 3px solid var(--thd-durazno);
	outline-offset: 2px;
}

.thd-rueda__control svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

/* El ícono visible depende del estado: play detenido, stop en curso. */
.thd-rueda__icono-stop {
	display: none;
}

.thd-rueda__control.es-reproduciendo .thd-rueda__icono-play {
	display: none;
}

.thd-rueda__control.es-reproduciendo .thd-rueda__icono-stop {
	display: block;
}

/* El botón se centra bajo el gráfico. */
.thd-rueda__grafico {
	text-align: center;
}

/* ---------------------------------------------------------------
 * Panel de detalle
 * --------------------------------------------------------------- */
/* El panel reserva su espacio completo desde el inicio: las alturas
 * mínimas de número, título y descripción están fijadas para que el
 * cambio entre valores sea totalmente estable (sin saltos de tamaño). */
.thd-rueda__panel {
	min-height: 21rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
}

.thd-rueda__panel-inner {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity var(--thd-transicion), transform var(--thd-transicion);
}

.thd-rueda__panel-inner.es-visible {
	opacity: 1;
	transform: translateY(0);
}

/* Número fantasma como acento tipográfico. */
.thd-rueda__numero {
	display: block;
	font-size: clamp(3.2rem, 7vw, 5.4rem);
	font-weight: 700;
	line-height: 1;
	color: transparent;
	-webkit-text-stroke: 2px var(--thd-durazno);
	margin-bottom: 0.4rem;
}

.thd-rueda__titulo {
	margin: 0 0 0.75rem;
	font-family: var(--thd-fuente);
	font-size: clamp(1.55rem, 3.4vw, 2.4rem);
	font-weight: 700;
	line-height: 1.12;
	color: var(--thd-naranja);
	text-wrap: balance;
	/* Espacio reservado para títulos de hasta dos líneas. */
	min-height: 2.35em;
}

.thd-rueda__descripcion {
	margin: 0;
	font-size: clamp(1rem, 1.6vw, 1.2rem);
	line-height: 1.6;
	color: var(--thd-gris);
	max-width: 34ch;
	/* Espacio reservado para descripciones de hasta cuatro líneas. */
	min-height: 6.4em;
}

/* Índice completo oculto visualmente: accesible para lectores de
 * pantalla y disponible cuando JavaScript no está presente. */
.thd-rueda__indice-oculto {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* ---------------------------------------------------------------
 * Diseño responsivo
 * --------------------------------------------------------------- */
@media (max-width: 820px) {
	.thd-rueda {
		grid-template-columns: 1fr;
		gap: 1.25rem;
	}

	.thd-rueda__grafico {
		max-width: 34rem;
		margin-inline: auto;
	}

	.thd-rueda__panel {
		min-height: 15rem;
		text-align: center;
		align-items: center;
	}

	.thd-rueda__descripcion {
		max-width: 46ch;
	}
}

/* En pantallas muy pequeñas la etiqueta interna del SVG escala junto
 * con el gráfico; no se requieren ajustes adicionales gracias al viewBox. */

/* ---------------------------------------------------------------
 * Accesibilidad: movimiento reducido
 * --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.thd-rueda__sector,
	.thd-rueda__gajo,
	.thd-rueda__panel-inner,
	.thd-rueda__control {
		transition: none;
	}
}
