/* ==========================================================================
   MASUB — Formulario de contacto, header, footer y botón flotante de WhatsApp
   Las secciones de las páginas (hechas con bloques) están en bloques.css.
   Los colores de la cabecera y el pie se eligen en el Personalizador de Blocksy;
   aquí solo hay detalles que Blocksy no ofrece como opción.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Formulario de contacto (DESIGN.md §4.13)
      Bloque "HTML personalizado" con id="masub-form". Etiquetas siempre visibles.
   -------------------------------------------------------------------------- */
body .masub-form {
	width: 100%;
	min-width: 0;
	margin: 0;
	background: var(--masub-fondo-alt);
	border-radius: var(--radio-m);
	padding: var(--esp-m);
	display: flex;
	flex-direction: column;
	gap: 20px;
	font-family: var(--masub-font-texto);
	color: var(--masub-texto);
}

body .masub-form .masub-form__title {
	margin: 0;
	font-family: var(--masub-font-titulos);
	font-size: var(--masub-fs-h3);
	font-weight: 600;
	color: var(--masub-violeta);
}

body .masub-form .masub-field {
	display: flex;
	flex-direction: column;
	gap: var(--esp-xs);
	margin: 0;
	font-size: var(--masub-fs-pequeno);
	font-weight: 700;
	color: var(--masub-texto);
}

body .masub-form .masub-input {
	width: 100%;
	height: 48px;
	margin: 0;
	padding: 12px 14px;
	font: inherit;
	font-size: var(--masub-fs-texto); /* ≥ 16 px: evita el zoom automático en iPhone */
	font-weight: 400;
	color: var(--masub-texto);
	background-color: var(--masub-fondo);
	border: 1px solid var(--masub-borde);
	border-radius: var(--radio-s);
	box-shadow: none;
	transition: border-color 0.2s, box-shadow 0.2s;
}

body .masub-form textarea.masub-input {
	height: auto;
	min-height: 120px;
	resize: vertical;
}

body .masub-form select.masub-input {
	appearance: auto;
	-webkit-appearance: auto;
}

body .masub-form .masub-input::placeholder {
	color: var(--masub-texto-2);
	opacity: 1;
}

/* Foco: borde violeta y sombra suave */
body .masub-form .masub-input:focus,
body .masub-form .masub-input:focus-visible {
	outline: none;
	border-color: var(--masub-violeta);
	box-shadow: 0 0 0 3px var(--masub-foco-suave);
}

/* Botón "Enviar por WhatsApp": principal amarillo, pill */
body .masub-form .masub-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	padding: 14px 28px;
	border: none;
	border-radius: var(--radio-pill);
	background: var(--masub-amarillo);
	color: var(--masub-texto);
	font-family: var(--masub-font-titulos);
	font-size: var(--masub-fs-boton);
	font-weight: 600;
	cursor: pointer;
	transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

body .masub-form .masub-btn::before {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	background: currentColor;
	-webkit-mask: var(--masub-ico-chat) no-repeat center / contain;
	mask: var(--masub-ico-chat) no-repeat center / contain;
}

body .masub-form .masub-btn:hover {
	background: var(--masub-amarillo-hover);
	color: var(--masub-texto);
	transform: translateY(-2px);
	box-shadow: var(--sombra-s);
}

body .masub-form .masub-form__note {
	margin: 0;
	font-size: var(--masub-fs-pequeno);
	color: var(--masub-texto-2);
}

/* --------------------------------------------------------------------------
   2. Header de Blocksy (DESIGN.md §4.3)
      Logo, menú y botón se configuran en Personalizar → Encabezado.
      Aquí: sticky con sombra, subrayado amarillo del menú y botón pill.
   -------------------------------------------------------------------------- */

/* Sticky: la barra superior se va con el scroll y la fila principal queda fija.
   --masub-topbar-h la mide assets/js/header.js. */
body #header {
	position: sticky;
	top: calc(var(--wp-admin--admin-bar--height, 0px) - var(--masub-topbar-h, 0px));
	z-index: 50;
}

body #header [data-row*="middle"] {
	transition: box-shadow 0.2s;
}

body #header.masub-header--scroll [data-row*="middle"] {
	box-shadow: var(--sombra-s);
}

/* Barra superior: texto centrado y compacto */
body [data-row*="top"] [data-id="text"] {
	font-size: var(--masub-fs-pequeno);
	text-align: center;
}

body [data-row*="top"] [data-id="text"] p {
	margin: 0;
}

/* Menú: activo y hover subrayados en amarillo (3 px, redondeado) */
body [data-id="menu"] > ul > li > a {
	font-family: var(--masub-font-texto);
	font-weight: 700;
	text-transform: none;
}

body [data-id="menu"] > ul > li > a::after {
	content: "";
	position: absolute;
	left: 50%;
	bottom: 18px;
	width: calc(100% - 2 * var(--menu-items-spacing, 25px) / 2);
	max-width: calc(100% - 16px);
	height: 3px;
	border-radius: 3px;
	background: var(--masub-amarillo);
	transform: translateX(-50%) scaleX(0);
	transition: transform 0.2s;
}

body [data-id="menu"] > ul > li > a:hover::after,
body [data-id="menu"] > ul > li.current-menu-item > a::after,
body [data-id="menu"] > ul > li.current-menu-ancestor > a::after {
	transform: translateX(-50%) scaleX(1);
}

/* El indicador propio de Blocksy se sustituye por el subrayado de Masub */
body [data-id="menu"][data-menu*="type-2"] > ul > li > a::before {
	display: none;
}

/* Submenú desplegable "Servicios ▾" (DESIGN.md: fondo blanco, --radio-m, sombra suave).
   Colores de texto y fondo: Personalizar → Encabezado → Menú → Desplegable. */
body [data-id="menu"] .sub-menu {
	padding: var(--esp-xs);
	border-radius: var(--radio-m);
	box-shadow: var(--sombra-m);
	border: 1px solid var(--masub-borde);
	overflow: hidden;
}

body [data-id="menu"] .sub-menu > li > a {
	min-height: 44px;
	padding: 10px 14px;
	border-radius: var(--radio-s);
	font-family: var(--masub-font-texto);
	font-weight: 700;
	font-size: 15px;
	text-transform: none;
}

body [data-id="menu"] .sub-menu > li > a:hover,
body [data-id="menu"] .sub-menu > li > a:focus-visible {
	background: var(--masub-fondo-alt);
}

/* Elemento activo del submenú: mismo subrayado amarillo que el menú principal */
body [data-id="menu"] .sub-menu > li.current-menu-item > a {
	text-decoration: underline;
	text-decoration-color: var(--masub-amarillo);
	text-decoration-thickness: 3px;
	text-underline-offset: 6px;
}

/* Flecha ▾ de "Servicios": gira al abrir */
body [data-id="menu"] .ct-toggle-dropdown-desktop .ct-icon {
	transition: transform 0.2s;
}

body [data-id="menu"] > ul > li:hover > a .ct-toggle-dropdown-desktop .ct-icon,
body [data-id="menu"] > ul > li:focus-within > a .ct-toggle-dropdown-desktop .ct-icon {
	transform: rotate(180deg);
}

/* Botón del header: principal amarillo, pill, con ícono de chat */
body [data-id="button"] .ct-button {
	min-height: 48px;
	padding: 0 24px;
	gap: 10px;
	border-radius: var(--radio-pill);
	font-family: var(--masub-font-titulos);
	font-weight: 600;
	font-size: var(--masub-fs-boton);
	transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

body [data-id="button"] .ct-button::before {
	content: "";
	flex: none;
	width: 20px;
	height: 20px;
	background: currentColor;
	-webkit-mask: var(--masub-ico-chat) no-repeat center / contain;
	mask: var(--masub-ico-chat) no-repeat center / contain;
}

body [data-id="button"] .ct-button:hover {
	transform: translateY(-2px);
	box-shadow: var(--sombra-s);
}

/* Menú móvil (panel a pantalla completa, fondo blanco) */
body #offcanvas [data-id="mobile-menu"] a {
	font-family: var(--masub-font-titulos);
	font-weight: 600;
}

body #offcanvas [data-id="mobile-menu"] .current-menu-item > a,
body #offcanvas [data-id="mobile-menu"] .current-menu-ancestor > a,
body #offcanvas [data-id="mobile-menu"] .current-menu-ancestor > .ct-sub-menu-parent > a {
	text-decoration: underline;
	text-decoration-color: var(--masub-amarillo);
	text-decoration-thickness: 3px;
	text-underline-offset: 8px;
}

body #offcanvas [data-id="button"],
body #offcanvas [data-id="button"] .ct-button {
	width: 100%;
	justify-content: center;
}

/* --------------------------------------------------------------------------
   3. Footer de Blocksy (DESIGN.md §4.12)
      Fondo violeta, texto blanco, enlaces blanco → amarillo.
      Columnas: Apariencia → Widgets (Pie 1–4).
   -------------------------------------------------------------------------- */
body .ct-footer {
	font-size: var(--masub-fs-texto);
}

body .ct-footer .widget-title {
	font-family: var(--masub-font-titulos);
	font-size: var(--masub-fs-h3);
	font-weight: 600;
	margin-bottom: var(--esp-s);
}

body .ct-footer a {
	text-underline-offset: 3px;
}

/* Logo sobre una ficha blanca (el logo oficial es violeta sobre blanco) */
body .ct-footer .masub-pie-logo {
	display: inline-block;
	margin: 0 0 var(--esp-s);
	padding: 12px 18px;
	background: var(--masub-fondo);
	border-radius: var(--radio-m);
	line-height: 0;
}

body .ct-footer .masub-pie-logo img {
	height: auto;
}

/* Eslogan: amarillo sobre violeta (4,8:1) solo en texto grande */
body .ct-footer .masub-pie-eslogan {
	font-family: var(--masub-font-titulos);
	font-size: 1.25rem;
	font-weight: 600;
	color: var(--masub-amarillo);
}

body .ct-footer .masub-pie-enlace a {
	font-weight: 700;
}

body .ct-footer .masub-pie-marca > *,
body .ct-footer .masub-pie-contacto > *,
body .ct-footer .masub-pie-redes > * {
	margin-top: 0;
	margin-bottom: 10px;
}

body .ct-footer .menu {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

body .ct-footer .menu a {
	min-height: 32px;
	display: inline-flex;
	align-items: center;
}

/* --------------------------------------------------------------------------
   3a. Blog de Blocksy: fechas, categorías y miga de pan sin mayúsculas
       (DESIGN.md §2: sin texto en mayúsculas salvo badges cortos).
       Mismos selectores que Blocksy, con "body" delante para ganarles.
   -------------------------------------------------------------------------- */
body .ct-breadcrumbs,
body[data-prefix] .entry-header .entry-meta,
body[data-prefix] .entry-card .entry-meta {
	--theme-text-transform: none;
	--theme-font-family: var(--masub-font-texto);
	--theme-font-weight: 400;
	text-transform: none;
	font-size: var(--masub-fs-pequeno);
	color: var(--masub-texto-2);
}

body[data-prefix] .entry-meta a {
	color: var(--masub-violeta);
}

/* Tarjetas del listado del blog: títulos en Fredoka y bordes redondeados */
body[data-prefix="blog"] .entry-card {
	border-radius: var(--radio-m);
}

body[data-prefix="blog"] .entry-card .entry-title {
	font-family: var(--masub-font-titulos);
	font-weight: 600;
}

/* --------------------------------------------------------------------------
   3b. Botón flotante de WhatsApp (DESIGN.md §4.2) – lo imprime functions.php
   -------------------------------------------------------------------------- */
.masub-wa-flotante {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 40;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 56px;
	height: 56px;
	padding: 0;
	border-radius: var(--radio-pill);
	background: var(--masub-amarillo);
	color: var(--masub-texto);
	box-shadow: var(--sombra-m);
	font-family: var(--masub-font-titulos);
	font-size: var(--masub-fs-boton);
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s, transform 0.2s;
}

.masub-wa-flotante::before {
	content: "";
	flex: none;
	width: 26px;
	height: 26px;
	background: currentColor;
	-webkit-mask: var(--masub-ico-chat) no-repeat center / contain;
	mask: var(--masub-ico-chat) no-repeat center / contain;
}

.masub-wa-flotante:hover {
	background: var(--masub-amarillo-hover);
	color: var(--masub-texto);
	transform: translateY(-2px);
}

.masub-wa-flotante__texto {
	display: none;
}

/* Con el menú móvil abierto, el botón flotante no estorba */
body:has(#offcanvas.active) .masub-wa-flotante,
body[data-panel*="in"] .masub-wa-flotante {
	display: none;
}

/* --------------------------------------------------------------------------
   4. Tablet y escritorio
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
	body .masub-form {
		padding: var(--esp-l);
	}
}

/* Escritorio: el botón flotante muestra el texto "Cotizar" */
@media (min-width: 1024px) {
	.masub-wa-flotante {
		width: auto;
		padding: 0 24px 0 20px;
	}

	.masub-wa-flotante::before {
		width: 22px;
		height: 22px;
	}

	.masub-wa-flotante__texto {
		display: inline;
	}
}
