/*
 Theme Name:   Master Case Theme
 Theme URI:    https://imastercase.com/
 Description:  Tema de Master Case (iMasterCase) para la tienda de estuches y accesorios para celular en Guatemala. Child theme de Bricks con los estilos de la marca, WooCommerce, blog y páginas.
 Author:       Master Case
 Author URI:   https://imastercase.com/
 Template:     bricks
 Version:      1.2
 Text Domain:  bricks
*/
/* ── Base iMasterCase ── */
:root {
	--imc-ink: #000000;
	--imc-text: #434343;
	--imc-line: #efeded;

	/* Paleta de marca: solo estos tres colores (con sus versiones oscuras para gradientes) */
	--imc-naranja: #e07c1b;       /* fondos y detalles; no usar para texto sobre blanco (2.9:1) */
	--imc-rojo: #d51d20;          /* acento principal: enlaces, hover, etiquetas (5.2:1 sobre blanco) */
	--imc-rojo-oscuro: #b0171a;
	--imc-verde: #279a44;         /* uso eventual: fondos e íconos */
	--imc-verde-texto: #1e7a35;   /* verde para texto pequeño sobre blanco (5.4:1) */
	--imc-accent: var(--imc-naranja);
	--imc-green: var(--imc-verde);

	/* Colores globales heredados de GeneratePress (los usan bloques y estilos del sitio) */
	--background-color: #ffffff;
	--headline-color: #000000;
	--paragraph-color: #434343;
	--primary-color: #000000;
	--secondary-color: var(--imc-rojo);
	--success-color: var(--imc-verde);
	--error-color: var(--imc-rojo);
	--border-color: #efeded;
	--product-price: #787575;
	--product-discount-price: var(--imc-rojo);
	--base-3: #ffffff;
}

body {
	font-family: 'Lexend Deca', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	font-size: 15px;
	color: var(--imc-text);
}

h1, h2, h3, h4, h5, h6 {
	color: var(--imc-ink);
}

/* ── Encabezado ── */
#brx-header {
	position: sticky;
	top: 0;
	z-index: 100;
}

.imc-header .bricks-nav-menu > li > a {
	font-weight: 500;
}

.imc-header .bricks-nav-menu > li > a:hover,
.imc-header .bricks-nav-menu .sub-menu a:hover {
	color: var(--imc-accent);
}

.imc-header .bricks-nav-menu .sub-menu {
	min-width: 230px;
	border: 1px solid var(--imc-line);
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
	overflow: hidden;
}

/* ── Footer ── */
.imc-footer a {
	color: rgba(255, 255, 255, 0.78);
	transition: color 0.15s ease;
}

.imc-footer a:hover {
	color: #fff;
}

.imc-header .brxe-search .toggle,
.imc-header .mini-cart-link {
	display: inline-flex;
	align-items: center;
	color: var(--imc-ink);
	font-size: 22px;
	line-height: 1;
}

.imc-header .brxe-logo {
	flex-shrink: 0;
}

.imc-header .bricks-nav-menu {
	align-items: center;
	gap: 28px;
}

.imc-header .bricks-nav-menu > li > a {
	font-size: 15px;
}

.imc-header .bricks-nav-menu > li > a,
.imc-header .bricks-nav-menu > li > .brx-submenu-toggle {
	white-space: nowrap;
}

@media (max-width: 1100px) {
	.imc-header .bricks-nav-menu {
		gap: 14px;
	}

	.imc-header .bricks-nav-menu > li > a {
		font-size: 14px;
	}
}

/* ── Páginas hechas con el editor de bloques (sin Bricks) ── */
#brx-content.wordpress {
	max-width: 1200px;
	margin: 0 auto;
	padding: 48px 24px 64px;
}

@media (max-width: 767px) {
	#brx-content.wordpress {
		padding: 32px 16px 48px;
	}
}

/* Menú mobile: panel blanco */
.imc-header .bricks-mobile-menu-wrapper,
.imc-header .bricks-mobile-menu-wrapper::before {
	background-color: #fff;
}

.imc-header .bricks-mobile-menu-wrapper {
	padding-top: 64px;
	box-shadow: 8px 0 32px rgba(0, 0, 0, 0.12);
}

.imc-header .bricks-mobile-menu > li > a,
.imc-header .bricks-mobile-menu > li > .brx-submenu-toggle > * {
	padding: 14px 24px;
	font-size: 17px;
	font-weight: 500;
	color: var(--imc-ink);
}

.imc-header .bricks-mobile-menu > li {
	border-bottom: 1px solid var(--imc-line);
}

.imc-header .bricks-mobile-menu .sub-menu a {
	padding: 10px 24px 10px 36px;
	font-size: 15px;
	color: var(--imc-text);
}

.imc-header .bricks-mobile-menu-overlay {
	background-color: rgba(0, 0, 0, 0.4);
}

.imc-header .mini-cart-link .cart-icon {
	display: inline-flex;
	align-items: center;
}

/* ── Tarjetas de producto (portada, tienda y categorías) ── */
.woocommerce ul.products {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woocommerce ul.products li.product {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
	padding: 0;
	text-align: left;
}

.woocommerce ul.products li.product::marker {
	content: none;
}

.woocommerce ul.products li.product a img {
	width: 100%;
	aspect-ratio: 1 / 1;
	object-fit: contain;
	background: #f6f6f6;
	border-radius: 14px;
	margin: 0 0 10px;
	transition: transform 0.25s ease;
}

.woocommerce ul.products li.product a:hover img {
	transform: translateY(-2px);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	margin: 0;
	padding: 0;
	color: var(--imc-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.35;
}

.woocommerce ul.products li.product .price {
	color: var(--imc-ink);
	font-size: 15px;
	font-weight: 500;
}

.woocommerce ul.products li.product .price del {
	color: #9a9a9a;
	font-weight: 400;
	margin-right: 4px;
}

.woocommerce ul.products li.product .price ins {
	color: var(--imc-rojo);
	text-decoration: none;
}

.woocommerce ul.products li.product .button {
	align-self: flex-start;
	margin-top: 6px;
	padding: 9px 18px;
	border: 1.5px solid var(--imc-ink);
	border-radius: 50px;
	background: transparent;
	color: var(--imc-ink);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.woocommerce ul.products li.product .button:hover {
	background: var(--imc-ink);
	color: #fff;
}

.woocommerce ul.products li.product .onsale {
	top: 10px;
	left: 10px;
	right: auto;
	border-radius: 50px;
	background: var(--imc-rojo);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
}

@media (max-width: 767px) {
	.woocommerce ul.products li.product .woocommerce-loop-product__title {
		font-size: 14px;
	}

	.woocommerce ul.products li.product .button {
		min-height: 40px;
		padding: 10px 14px;
		font-size: 13px;
	}
}

.imc-sin-titulo #brx-content.wordpress > h1:first-child {
	display: none;
}

/* ── Blog (listado por defecto de Bricks) ── */
body.blog #brx-content > .brxe-container,
body.archive:not(.woocommerce) #brx-content > .brxe-container {
	width: 100%;
	max-width: 1200px;
	margin: 0 auto;
	padding: 48px 24px 72px;
	box-sizing: border-box;
}

.imc-archive-title {
	margin-bottom: 32px;
	color: var(--imc-ink);
	font-size: clamp(30px, 4vw, 42px);
	font-weight: 700;
}

#brx-content .brxe-posts .bricks-layout-wrapper {
	gap: 40px 32px;
}

#brx-content .brxe-posts .image-wrapper img {
	aspect-ratio: 16 / 10;
	object-fit: cover;
	border-radius: 16px;
	background: #f6f6f6;
	transition: transform 0.25s ease;
}

#brx-content .brxe-posts .image-wrapper a:hover img {
	transform: translateY(-3px);
}

#brx-content .brxe-posts .content-wrapper {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding-top: 14px;
}

#brx-content .brxe-posts .content-wrapper h3 {
	margin: 0;
	color: var(--imc-ink);
	font-size: 21px;
	font-weight: 700;
	line-height: 1.3;
}

#brx-content .brxe-posts .content-wrapper h3 a:hover {
	color: var(--secondary-color);
}

#brx-content .brxe-posts .content-wrapper > *:not(h3) {
	color: #6b6b6b;
	font-size: 14px;
	line-height: 1.6;
}

@media (max-width: 767px) {
	body.blog #brx-content > .brxe-container,
	body.archive:not(.woocommerce) #brx-content > .brxe-container {
		padding: 32px 16px 56px;
	}
}

/* ── Entrada del blog ── */
.single-post .bricks-post-header {
	position: relative;
	min-height: 360px;
	display: flex;
	align-items: flex-end;
}

.single-post .bricks-post-header.has-image::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.7) 100%);
}

.single-post .bricks-post-header > * {
	position: relative;
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	padding: 48px 24px;
	box-sizing: border-box;
}

.single-post .bricks-post-header h1 {
	color: #fff;
	font-size: clamp(28px, 4vw, 42px);
	line-height: 1.2;
}

.single-post .bricks-post-header,
.single-post .bricks-post-header a {
	color: rgba(255, 255, 255, 0.85);
}

.single-post #brx-content > article.brxe-container {
	width: 100%;
	max-width: 760px;
	margin: 0 auto;
	padding: 40px 24px 72px;
	box-sizing: border-box;
	color: var(--imc-text);
	font-size: 17px;
	line-height: 1.75;
}

.single-post #brx-content > article h2 {
	margin: 1.6em 0 0.5em;
	font-size: 26px;
	line-height: 1.3;
}

.single-post #brx-content > article h3 {
	margin: 1.4em 0 0.4em;
	font-size: 21px;
}

.single-post #brx-content > article img {
	border-radius: 14px;
}

@media (max-width: 767px) {
	.single-post .bricks-post-header {
		min-height: 280px;
	}

	.single-post .bricks-post-header > *,
	.single-post #brx-content > article.brxe-container {
		padding-left: 16px;
		padding-right: 16px;
	}

	.single-post #brx-content > article.brxe-container {
		font-size: 16px;
	}
}

/* ── Accesibilidad y tacto (auditoría UX) ── */

/* Foco visible al navegar con teclado */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
	outline: 2px solid var(--imc-ink);
	outline-offset: 3px;
	border-radius: 4px;
}

.imc-footer a:focus-visible,
.imc-hero a:focus-visible,
.imc-hero button:focus-visible {
	outline-color: #fff;
}

/* Íconos del encabezado: área táctil de 44×44 sin cambiar el dibujo */
.imc-header .bricks-mobile-menu-toggle,
.imc-header .brxe-search .toggle,
.imc-header .mini-cart-link {
	position: relative;
}

.imc-header .bricks-mobile-menu-toggle::before,
.imc-header .brxe-search .toggle::before,
.imc-header .mini-cart-link::before {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	transform: translate(-50%, -50%);
}

/* Botón del submenú "Tienda" */
.imc-header .bricks-nav-menu .brx-submenu-toggle button {
	min-width: 24px;
	min-height: 24px;
}

/* Contador del carrito */
.imc-header .cart-count {
	min-width: 18px;
	height: 18px;
	background-color: var(--imc-rojo) !important;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
}

/* Footer: 3 columnas que ocupan todo el contenedor, enlaces más juntos */
.imc-footer #brxe-tfedvy {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 32px 48px;
	align-items: start;
}
.imc-footer #brxe-tfedvy > .brxe-block { width: 100%; gap: 2px; }
.imc-footer #brxe-tfedvy .brxe-heading { margin-bottom: 8px; }
.imc-footer .brxe-text-link {
	padding: 4px 0;
	min-height: 28px;
	line-height: 1.3;
}
@media (max-width: 767px) {
	/* Mobile: marca arriba, las dos listas de enlaces lado a lado */
	.imc-footer #brxe-tfedvy { grid-template-columns: 1fr 1fr; gap: 28px 20px; }
	.imc-footer #brxe-tfedvy > .brxe-block:first-child { grid-column: 1 / -1; }
	.imc-footer .brxe-text-link { min-height: 32px; }
}

/* Casillas y opciones más grandes */
.woocommerce form input[type="checkbox"],
.woocommerce form input[type="radio"],
.woocommerce-page form input[type="checkbox"],
.woocommerce-page form input[type="radio"] {
	width: 20px;
	height: 20px;
	accent-color: var(--imc-ink);
	vertical-align: middle;
}

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

/* Entradas relacionadas (al final de cada entrada): enlaces en naranja al pasar el mouse */
#brx-content .brxe-related-posts .related-posts a,
#brx-content .brxe-post-navigation .title {
	color: var(--imc-ink);
	transition: color 0.15s ease;
}

#brx-content .brxe-related-posts .related-posts a:hover,
#brx-content .brxe-related-posts .related-posts a:focus-visible,
#brx-content .brxe-post-navigation a:hover .title,
#brx-content .brxe-post-navigation a:focus-visible .title {
	color: var(--secondary-color);
}

.brxe-related-posts .related-posts img {
	border-radius: 12px;
	transition: transform 0.25s ease;
}

.brxe-related-posts .related-posts figure a:hover img {
	transform: translateY(-2px);
}

/* Caja de autora en cada entrada: foto centrada en vertical con nombre y bio */
.brxe-post-author.avatar-left { align-items: center; gap: 20px; }
.brxe-post-author.avatar-left .avatar { flex: 0 0 auto; margin: 0; }
.brxe-post-author .author-name { margin-top: 0; margin-bottom: 6px; }
.brxe-post-author .author-bio { margin: 0; }
@media (max-width: 480px) {
  .brxe-post-author.avatar-left { gap: 14px; }
}

/* Anterior / siguiente: títulos largos hacen salto de línea en vez de desbordar */
.brxe-post-navigation { gap: 24px; }
.brxe-post-navigation > a { flex: 1 1 0; min-width: 0; }
.brxe-post-navigation .content { min-width: 0; }
.brxe-post-navigation .title { white-space: normal; overflow-wrap: anywhere; }

/* Foto de la autora 20% más grande (60 → 72px) */
.brxe-post-author .avatar { width: 72px; height: 72px; object-fit: cover; }

/* Paginación del blog */
.imc-paginacion { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 48px 0 16px; padding-top: 24px; border-top: 1px solid var(--imc-line); }
.imc-paginacion__lado { flex: 1 1 0; }
.imc-paginacion__lado--der { text-align: right; }
.imc-paginacion__pagina { color: #6e6e6e; font-size: 14px; white-space: nowrap; }
.imc-paginacion a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 20px; border: 1px solid var(--imc-ink); border-radius: 999px; color: var(--imc-ink); font-weight: 600; font-size: 14px; text-decoration: none; transition: background-color 0.15s ease, color 0.15s ease; }
.imc-paginacion a:hover, .imc-paginacion a:focus-visible { background: var(--imc-ink); color: #fff; }
@media (max-width: 600px) {
  .imc-paginacion { flex-wrap: wrap; }
  .imc-paginacion__pagina { order: -1; flex-basis: 100%; text-align: center; }
  .imc-paginacion a { padding: 0 14px; font-size: 13px; }
}
.imc-paginacion { width: 100%; align-self: stretch; box-sizing: border-box; }
.imc-paginacion a { white-space: nowrap; }
/* La paginación numérica de Bricks se reemplaza por .imc-paginacion */
.layout-default .brxe-posts .bricks-pagination { display: none; }

/* Datos de la entrada (autora · fecha · comentarios): sin cortar palabras en mobile */
.brxe-post-meta.post-meta { flex-wrap: wrap; row-gap: 4px; }
.brxe-post-meta.post-meta .item { white-space: nowrap; }

/* Enlaces dentro del texto de las entradas: visibles (naranja de marca + subrayado) */
.single-post .brxe-post-content a:not(.wp-block-button__link) { color: var(--secondary-color); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; transition: color 0.15s ease; }
.single-post .brxe-post-content a:not(.wp-block-button__link):hover,
.single-post .brxe-post-content a:not(.wp-block-button__link):focus-visible { color: var(--imc-ink); }

/* Listado del blog en mobile: una entrada por fila */
@media (max-width: 600px) {
	.layout-default .brxe-posts .bricks-layout-wrapper { grid-template-columns: 1fr !important; }
}

/* ── Mega menú de "Tienda" (desktop): panel blanco con 5 columnas, como en GeneratePress ── */
@media (min-width: 992px) {
	#brx-header .bricks-nav-menu > li.mega-menu { position: static; }
	/* El puente de hover de Bricks (::before) ocupa el ancho del encabezado sin salirse de la pantalla */
	#brx-header .bricks-nav-menu > li.mega-menu::before { left: 0 !important; right: 0 !important; width: auto !important; }
	/* Con el panel abierto, una franja invisible a todo lo ancho bajo el menú lo mantiene abierto
	   aunque el mouse baje en diagonal hacia las columnas de la derecha */
	#brx-header .bricks-nav-menu > li.mega-menu.open::before {
		content: "" !important;
		display: block !important;
		position: absolute;
		top: auto !important;
		bottom: 0;
		height: 26px !important;
		background: transparent;
		pointer-events: auto;
	}
	/* Puente invisible bajo "Tienda": cubre el hueco hasta el panel para que no se cierre al bajar el mouse */
	#brx-header li.mega-menu > .brx-submenu-toggle { position: relative; }
	#brx-header li.mega-menu > .brx-submenu-toggle::after {
		content: "";
		position: absolute;
		top: 100%;
		left: -24px;
		right: -24px;
		height: 32px;
	}
	#brx-header .bricks-nav-menu > li.mega-menu > .sub-menu {
		left: 0 !important;
		right: 0 !important;
		top: 100%;
		margin: 0 auto;
		width: min(1200px, calc(100% - 32px));
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		gap: 0 28px;
		padding: 28px 28px 32px;
		background: #fff;
		border: 1px solid var(--imc-line);
		border-top: 0;
		border-radius: 0 0 14px 14px;
		box-shadow: 0 18px 40px rgba(0, 0, 0, 0.08);
	}
	/* Columnas */
	#brx-header li.mega-menu > .sub-menu > li { min-width: 0; }
	#brx-header li.mega-menu > .sub-menu > li > .brx-submenu-toggle { padding: 0 0 10px; margin-bottom: 10px; border-bottom: 1px solid var(--imc-line); }
	#brx-header li.mega-menu > .sub-menu > li > .brx-submenu-toggle > a {
		padding: 0;
		color: var(--imc-ink);
		font-size: 13px;
		font-weight: 700;
		letter-spacing: 0.06em;
		text-transform: uppercase;
		line-height: 1.35;
		white-space: normal;
	}
	#brx-header li.mega-menu > .sub-menu > li > .brx-submenu-toggle > button { display: none; }
	/* Enlaces de cada columna: siempre visibles dentro del panel */
	#brx-header li.mega-menu .sub-menu .sub-menu {
		position: static !important;
		visibility: visible !important;
		opacity: 1 !important;
		transform: none !important;
		display: block;
		min-width: 0;
		padding: 0;
		background: none;
		border: 0;
		box-shadow: none;
	}
	#brx-header li.mega-menu .sub-menu .sub-menu a {
		display: block;
		padding: 6px 0;
		color: #222;
		font-size: 14px;
		font-weight: 400;
		line-height: 1.4;
		white-space: normal;
		transition: color 0.15s ease;
	}
	#brx-header li.mega-menu .sub-menu a:hover,
	#brx-header li.mega-menu .sub-menu a:focus-visible { color: var(--secondary-color); }
}
