/**
 * Culture Racing — CSS Global
 *
 * Variables CSS del proyecto, resets mínimos, y comportamiento del smart
 * header (scroll-aware sticky header). Carga en todas las páginas.
 *
 * ─────────────────────────────────────────────────────────────────────────
 * ÍNDICE
 *   §1  Tokens (:root)     → colores, tipografía, dimensiones, transiciones, z
 *   §2  Reset base         → body, html/body overflow-x, img, :focus-visible
 *   §3  Botones            → reset del fondo "rosado" del tema padre
 *   §4  Utilidades tipo    → .cr-font-display / .cr-font-body
 *   §5  Textura            → .cr-has-texture
 *   §6  Smart header       → #cr-site-header + estados + padding de contenido
 *   §7  Accesibilidad      → focus de #content + skip-link
 *   §8  Scrollbar          → scrollbar global CR
 *   §9  Animación global   → @property --cr-cta-angle + @keyframes
 *   §10 Responsive         → @media de tamaño + prefers-reduced-motion
 * ─────────────────────────────────────────────────────────────────────────
 * BREAKPOINTS usados acá:  1024 (tablet) · 480 (mobile-small)
 *   Ambos solo reescalan tokens del header/container. + 1 media de
 *   accesibilidad (prefers-reduced-motion). Todo en §10.
 *
 * El comportamiento del header se controla con clases en <body> (header.js):
 *   .cr-header-is-transparent  → header sobre fondo oscuro (hero del home)
 *   .cr-header-is-hidden       → header oculto (scrolleando hacia abajo)
 *   .cr-header-is-compact      → header con fondo sólido (scrolleado arriba)
 * ─────────────────────────────────────────────────────────────────────────
 */


/* ═══════════════════════════════════════════════════════════════════════
   §1 · TOKENS (:root)
   ═══════════════════════════════════════════════════════════════════════ */

:root {
	/* Colores marca */
	--cr-color-primary: #c00000;
	--cr-color-primary-dark: #8b0000;
	--cr-color-primary-hover: #e60000;
	--cr-color-dark: #1a1a1a;
	--cr-color-darker: #0f0f0f;
	--cr-color-black: #000000;
	--cr-color-gray-900: #1a1a1a;
	--cr-color-gray-800: #2a2a2a;
	--cr-color-gray-700: #3a3a3a;
	--cr-color-gray-600: #4a4a4a;
	--cr-color-gray-500: #81817f;
	--cr-color-gray-400: #999999;
	--cr-color-gray-200: #e5e5e5;
	--cr-color-gray-100: #f5f5f5;
	--cr-color-white: #ffffff;

	/* Aliases semánticos de texto.
	   Usar estos en componentes en lugar de los grays directos para que
	   un eventual cambio de paleta se propague desde un solo lugar. */
	--cr-color-text: var(--cr-color-white);
	--cr-color-text-muted: var(--cr-color-gray-500);   /* #81817f — body secundario sobre dark */
	--cr-color-text-dim: rgba(255, 255, 255, 0.78);    /* body principal levemente atenuado */

	/* Tipografía */
	--cr-font-body: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--cr-font-heading: 'Super Brigade', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	--cr-font-display: 'Super Brigade', 'Montserrat', Impact, sans-serif;

	/* Dimensiones del header */
	--cr-header-height: 80px;
	--cr-topbar-height: 30px;
	--cr-header-total-height: calc(var(--cr-header-height) + var(--cr-topbar-height));

	/* Contenedor */
	--cr-container-max: 1440px;
	--cr-container-pad: 32px;

	/* Grosor único del outline (-webkit-text-stroke) de los títulos display.
	   Single source of truth: cambiar acá propaga a todo el proyecto. Los
	   widgets del plugin lo consumen como var(--cr-outline-width, 1.5px). */
	--cr-outline-width: 1.5px;

	/* Transiciones */
	--cr-transition-fast: 150ms ease;
	--cr-transition-base: 250ms ease;
	--cr-transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
	--cr-transition-header: 350ms cubic-bezier(0.4, 0, 0.2, 1);

	/* z-indexes */
	--cr-z-header: 9999;
	--cr-z-dropdown: 10000;
	--cr-z-drawer: 999999;

	/* Textura (consolidado acá; antes vivía en un segundo :root más abajo) */
	--cr-texture-url: url('../img/texture-concrete.webp');
	--cr-texture-size: 256px 256px;
	--cr-texture-size-small: 180px 180px; /* para elementos pequeños */

	/* Overlay unificado para TODOS los backdrops del proyecto
	   (megamenu drawer, minicart, search modal, shop filters drawer,
	   auth modal). El plugin lo referencia desde sus módulos como
	   var(--zenth-mm-overlay) con fallback al mismo valor. */
	--zenth-mm-overlay: rgba(0, 0, 0, 0.7);
}


/* ═══════════════════════════════════════════════════════════════════════
   §2 · RESET BASE
   ═══════════════════════════════════════════════════════════════════════ */

body {
	font-family: var(--cr-font-body);
	color: var(--cr-color-gray-900);
	background-color: var(--cr-color-black);
}

/* Prevenir scroll horizontal a nivel global.
   - `overflow-x: hidden` es el fix universal compatible con todos los browsers.
   - `overflow-x: clip` (la segunda declaración) lo override en browsers que lo
     soportan: NO crea scroll container, así `position: sticky` sigue funcionando
     en descendientes (algo que `hidden` rompe).
   Combinados: máxima compatibilidad sin sacrificar sticky. */
html,
body {
	overflow-x: hidden;
	overflow-x: clip;
	max-width: 100vw;
}

img {
	max-width: 100%;
	height: auto;
}

:focus-visible {
	outline: 2px solid var(--cr-color-primary);
	outline-offset: 2px;
}


/* ═══════════════════════════════════════════════════════════════════════
   §3 · BOTONES — neutralizar el fondo "rosado" del tema padre
   ───────────────────────────────────────────────────────────────────────
   El tema padre define un fondo en
     [type=button]:hover/:focus, [type=submit]:hover/:focus, button:hover/:focus
   que sobre la paleta CR se ve rosado. Lo limpiamos en DOS niveles, ambos
   SEGUROS (no tocan botones con fondo propio):

   1) Red de seguridad GLOBAL para <button> "pelados" (sin clase con fondo):
      mismo selector `button:hover/:focus` que el padre → misma especificidad
      (0,1,1); como este archivo carga DESPUÉS del padre, gana el empate y el
      fondo queda transparente. Cualquier botón con :hover propio basado en clase
      (.elementor-button, Woo .button, .cr-btn-*, .zenth-*__nav…, todos ≥0,2,0)
      GANA y conserva su color → checkout/Woo/CTAs intactos.

   2) Utilidad `.cr-btn-flat` para botones "planos" (swatch/dot/chip) que llevan
      type="button": ahí la regla del padre es [type=button]:hover (0,2,0), así
      que un reset genérico no alcanza. `button.cr-btn-flat` da (0,2,1) y le gana.
      Es la generalización del fix puntual de los dots de razones; aplicá la clase
      al <button> en vez de escribir un reset por widget.

   La a11y de teclado la cubre :focus-visible (outline rojo, §2). */
button:hover,
button:focus {
	background-color: transparent;
}

button.cr-btn-flat:hover,
button.cr-btn-flat:focus {
	background-color: transparent;
}


/* ═══════════════════════════════════════════════════════════════════════
   §4 · UTILIDADES TIPOGRÁFICAS
   ═══════════════════════════════════════════════════════════════════════ */

.cr-font-display,
.cr-font-display .elementor-heading-title,
.cr-font-display h1,
.cr-font-display h2,
.cr-font-display h3,
.cr-font-display p,
.cr-font-display span {
	font-family: var(--cr-font-display) !important;
	letter-spacing: 0.5px;
	font-weight: 400 !important; /* Super Brigade no tiene varios pesos */
}

.cr-font-body,
.cr-font-body .elementor-heading-title,
.cr-font-body p,
.cr-font-body span {
	font-family: var(--cr-font-body) !important;
}


/* ═══════════════════════════════════════════════════════════════════════
   §5 · TEXTURA — .cr-has-texture
   ───────────────────────────────────────────────────────────────────────
   Mixin class: cualquier elemento con fondo rojo puede usar esta clase.
   Requiere que el elemento tenga position: relative y overflow: hidden.
   ═══════════════════════════════════════════════════════════════════════ */

.cr-has-texture {
	position: relative;
	overflow: hidden;
}

.cr-has-texture::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image: var(--cr-texture-url);
	background-size: var(--cr-texture-size);
	background-repeat: repeat;
	mix-blend-mode: multiply;
	opacity: var(--cr-texture-opacity, 0.5);
	pointer-events: none;
	z-index: 0;
	border-radius: inherit;
}

/* Los hijos directos deben quedar encima de la textura */
.cr-has-texture > * {
	position: relative;
	z-index: 1;
}


/* ═══════════════════════════════════════════════════════════════════════
   §6 · SMART HEADER — #cr-site-header
   ───────────────────────────────────────────────────────────────────────
   El header es fixed en la parte superior y se comporta según clases
   aplicadas al body por JS:

     (sin clase)               → estado normal: sólido, visible, con top bar
     .cr-header-is-transparent → sobre hero del home: fondo transparente
     .cr-header-is-hidden      → scrolleando hacia abajo: se oculta (translate -100%)

   Al volver a scrollear hacia arriba, simplemente se quita .cr-header-is-hidden
   y el header vuelve a su estado normal (con top bar visible).

   El header de Elementor se renderiza con id="cr-site-header"
   (esto se configura en Elementor → Avanzado → ID del contenedor).
   ═══════════════════════════════════════════════════════════════════════ */

#cr-site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: var(--cr-z-header);
	transition: transform var(--cr-transition-header),
				background-color var(--cr-transition-header),
				backdrop-filter var(--cr-transition-header);
	background-color: var(--cr-color-black);
}

/* Estado oculto (scrolleando hacia abajo) */
body.cr-header-is-hidden #cr-site-header {
	transform: translateY(-100%);
}

/* Estado transparente (home, al inicio) */
body.cr-header-is-transparent #cr-site-header {
	background-color: transparent;
}

/* Como el header es fixed, el contenido de cada página queda tapado por el
   header. Añadimos padding-top al wrapper de contenido.
   EXCEPCIÓN: en la home (body.home o body.page-home con hero full-screen),
   el hero se monta debajo del header transparente — NO queremos padding. */
body:not(.home):not(.page-home) #content,
body:not(.home):not(.page-home) .site-main {
	padding-top: var(--cr-header-total-height);
}

/* En home, si el primer elemento del main es el hero, no hay padding */
body.home .site-main > :first-child,
body.page-home .site-main > :first-child {
	margin-top: 0;
}


/* ═══════════════════════════════════════════════════════════════════════
   §7 · ACCESIBILIDAD — focus de #content + skip-link
   ═══════════════════════════════════════════════════════════════════════ */

main#content {
	/* Al recibir foco programático (por skip link), no mostrar outline
	   tipo "click", solo el de teclado real. */
	outline: none;
}

main#content:focus-visible {
	/* Outline visible solo en navegación por teclado real. */
	outline: 3px solid var(--cr-red, #E8001D);
	outline-offset: -3px;
}

/* El skip link "Saltar al contenido" sigue siendo screen-reader-only
   pero debe volverse visible cuando recibe foco con Tab. Mismo
   patrón que .screen-reader-text de WordPress core. */
.skip-link.screen-reader-text:focus,
.skip-link.screen-reader-text:focus-visible {
	background-color: var(--cr-black, #0A0A0A);
	border-radius: 4px;
	box-shadow: 0 0 2px 2px rgba(0,0,0,0.6);
	clip: auto !important;
	clip-path: none;
	color: var(--cr-white, #FFFFFF);
	display: block;
	font-size: 14px;
	font-weight: 700;
	height: auto;
	left: 8px;
	line-height: normal;
	padding: 12px 18px;
	text-decoration: none;
	top: 8px;
	width: auto;
	z-index: 100000;
}


/* ═══════════════════════════════════════════════════════════════════════
   §8 · SCROLLBAR — scrollbar global CR
   ───────────────────────────────────────────────────────────────────────
   Aplica al <html> y a cualquier contenedor scrolleable que no defina su
   propio scrollbar. Drawers/menus/modales que definen scrollbar localmente
   mantienen su estilo (mayor especificidad contextual).
   ═══════════════════════════════════════════════════════════════════════ */

html {
	scrollbar-width: thin;
	scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

::-webkit-scrollbar {
	width: 10px;
	height: 10px;
}

::-webkit-scrollbar-track {
	background: transparent;
}

::-webkit-scrollbar-thumb {
	background: rgba(255, 255, 255, 0.14);
	border: 2px solid transparent;
	background-clip: padding-box;
	transition: background-color 200ms ease;
}

::-webkit-scrollbar-thumb:hover {
	background: var(--cr-color-primary, #c00000);
	background-clip: padding-box;
}

::-webkit-scrollbar-thumb:active {
	background: var(--cr-color-primary-hover, #e60000);
	background-clip: padding-box;
}

::-webkit-scrollbar-corner {
	background: transparent;
}


/* ═══════════════════════════════════════════════════════════════════════
   §9 · ANIMACIÓN GLOBAL — borde giratorio "Always On"
   ───────────────────────────────────────────────────────────────────────
   Ángulo animable + keyframe usados por varios componentes (CTA founder,
   hover de las cards .cr-steps, etc.). Viven en global.css para que estén
   disponibles en cualquier página sin depender del CSS de una página.

   @property requiere Chrome 85+/Safari 16.4+/Firefox 128+. Sin soporte el
   ángulo queda fijo y el efecto se ve estático — no rompe nada.
   ═══════════════════════════════════════════════════════════════════════ */

@property --cr-cta-angle {
	syntax: '<angle>';
	initial-value: 0deg;
	inherits: false;
}

@keyframes cr-cta-spin {
	to { --cr-cta-angle: 360deg; }
}


/* ═══════════════════════════════════════════════════════════════════════
   §10 · RESPONSIVE
   ───────────────────────────────────────────────────────────────────────
   Tablet (≤1024) → Mobile-small (≤480). Solo reescalan tokens del header.
   Al final, accesibilidad (prefers-reduced-motion), que NO es un breakpoint
   de tamaño y no se consolida con los de arriba.
   ═══════════════════════════════════════════════════════════════════════ */

/* ───────────────────────── TABLET · max-width: 1024px ─────────────────── */
@media (max-width: 1024px) {
	:root {
		--cr-header-height: 70px;
		--cr-topbar-height: 36px;
		--cr-container-pad: 24px;
	}
}

/* ─────────────────────── MOBILE-SMALL · max-width: 480px ──────────────── */
@media (max-width: 480px) {
	:root {
		--cr-header-height: 64px;
		--cr-topbar-height: 32px;
		--cr-container-pad: 16px;
	}
}

/* ─────────────────── ACCESIBILIDAD · prefers-reduced-motion ───────────── */
@media (prefers-reduced-motion: reduce) {
	#cr-site-header {
		transition-duration: 50ms !important;
	}
}
