/*
Theme Name: Barbosa SAM
Theme URI: https://sam.barbosa-group.com/
Author: Maloca CE
Description: Tema de bloques para la web de la SAM Gen5 de Barbosa Engineering Group. Sin recursos externos: letras y estilos alojados en el propio servidor.
Version: 0.3.1
Requires at least: 6.5
Requires PHP: 8.1
License: GNU General Public License v2 or later
Text Domain: barbosa-sam
*/

:root {
	--sam-cabecera-alto: 72px;
	--sam-borde: 1px solid var(--wp--preset--color--linea);
	--sam-rojo-sobre-oscuro: #E0484D;
	--sam-ok: #1C9A50;
}

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--barra, 58px) + 8px); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--wp--preset--color--senal); outline-offset: 3px; }
img { max-width: 100%; height: auto; }

.wp-site-blocks > *, .wp-site-blocks > * + *,
.sam-principal > .wp-block-post-content,
.sam-principal > .wp-block-post-content > .sam-seccion { margin-block: 0; }

/* ---------- Cabecera ---------- */
.sam-cabecera { position: sticky; top: 0; z-index: 50; background: var(--wp--preset--color--blanco); border-bottom: var(--sam-borde); }
.admin-bar .sam-cabecera { top: 32px; }
@media (max-width: 782px) { .admin-bar .sam-cabecera { top: 46px; } }
.sam-cabecera__fila { min-height: var(--sam-cabecera-alto); gap: 1.5rem; }
.sam-cabecera .sam-logo img { display: block; height: auto; }
.sam-menu { margin-left: auto; }
.sam-menu .wp-block-navigation-item__content { padding: .5rem .1rem; text-decoration: none; }
.sam-menu .wp-block-navigation-item__content:hover { color: var(--wp--preset--color--rojo); }
.sam-menu .wp-block-navigation__container { gap: 1.35rem; }
.sam-cabecera__acciones .wp-block-button__link { padding: .7rem 1.1rem; }
@media (max-width: 1180px) and (min-width: 600px) { .sam-menu .wp-block-navigation__container { gap: .9rem; } .sam-menu { font-size: .875rem; } }

/* ---------- Secciones y tipografía común ---------- */
.sam-seccion { padding-top: var(--wp--preset--spacing--60); padding-bottom: var(--wp--preset--spacing--60); }
.sam-titular { max-width: 24ch; margin-top: 0; margin-bottom: var(--wp--preset--spacing--30); }
.sam-subtitulo { margin-top: var(--wp--preset--spacing--50); margin-bottom: var(--wp--preset--spacing--30); max-width: 28ch; }
.sam-antetitulo {
	font-family: var(--wp--preset--font-family--titulos); font-weight: 600; font-size: 1.0625rem;
	color: var(--wp--preset--color--rojo); margin-bottom: .5rem;
}
.has-antracita-background-color .sam-antetitulo { color: var(--sam-rojo-sobre-oscuro); }
.sam-entradilla { max-width: 60ch; margin-bottom: var(--wp--preset--spacing--40); }
/* Textos estrechos alineados a la izquierda del ancho de la sección, no centrados */
.sam-seccion.is-layout-constrained > :is(.sam-entradilla, .sam-titular, .sam-subtitulo, .sam-antetitulo, .sam-nota, .sam-pie-foto, .sam-lista-numerada, p) {
	margin-left: max(0px, calc((100% - 1240px) / 2)) !important; margin-right: auto !important;
}
.sam-nota { color: var(--wp--preset--color--texto-2); font-size: var(--wp--preset--font-size--pequena); }
.has-antracita-background-color .sam-nota, .has-antracita-background-color .sam-pie-foto { color: #B9B5B6; }
.sam-pie-foto { font-size: var(--wp--preset--font-size--pequena); color: var(--wp--preset--color--texto-2); margin-top: .75rem; }

/* ---------- 0 · Cabecera de producto ---------- */
.sam-hero { padding-top: clamp(1.5rem, 4vw, 3.5rem); padding-bottom: clamp(1rem, 3vw, 2.5rem); background: var(--wp--preset--color--aluminio-claro); }
.sam-hero__cols { gap: clamp(1.5rem, 5vw, 4rem); }
.sam-hero__titulo {
	font-size: clamp(3.5rem, 9vw, 7.5rem); line-height: .85; letter-spacing: -.03em; margin: 0;
}
.sam-hero__sigla { font-family: var(--wp--preset--font-family--titulos); font-size: 1.25rem; letter-spacing: .02em; color: var(--wp--preset--color--texto-2); margin: .75rem 0 0; }
.sam-hero__sigla strong { color: var(--wp--preset--color--rojo); font-weight: 700; }
.sam-hero__eslogan {
	font-family: var(--wp--preset--font-family--titulos); font-weight: 600;
	font-size: clamp(1.625rem, 3vw, 2.375rem); line-height: 1.1; max-width: 20ch; margin: 1.5rem 0 1.25rem;
}
.sam-hero__ideas { list-style: none; padding: 0; margin: 0 0 1.75rem; display: grid; gap: .5rem; }
.sam-hero__ideas li { padding-left: 1.5rem; position: relative; }
.sam-hero__ideas li::before { content: ""; position: absolute; left: 0; top: .6em; width: .75rem; height: 3px; background: var(--wp--preset--color--rojo); }
.sam-hero__imagen { margin: 0; }
.sam-hero__imagen img { display: block; max-height: min(62vh, 560px); width: auto; margin-inline: auto; }

/* Vídeo en ventana (el JS mueve aquí el vídeo de .sam-video-fuente) */
.sam-video-fuente { display: none; }
.sam-video { width: min(1100px, calc(100vw - 2rem)); padding: 0; border: 0; background: #000; color: #ddd; }
.sam-video::backdrop { background: rgba(20,18,19,.85); }
.sam-video video { display: block; width: 100%; aspect-ratio: 16 / 9; }
.sam-video p { margin: 0; padding: .6rem 1rem; font-size: .875rem; }
.sam-video__cerrar { position: absolute; top: .25rem; right: .25rem; z-index: 2; width: 44px; height: 44px; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.75rem; cursor: pointer; }

/* ---------- 1 · Configurador ---------- */
.sam-config { padding-top: clamp(.5rem, 1.5vw, 1rem); padding-bottom: 0; background: #F2F4F5; border-top: var(--sam-borde); }
.sam-config__titulo { gap: .5rem 2rem; margin-bottom: clamp(.75rem, 2vw, 1.25rem); }
.sam-config__h { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.25rem); }
.sam-config__ayuda { margin: 0; color: var(--wp--preset--color--texto-2); max-width: 48ch; }

/* ---------- 2 · Visión ---------- */
.sam-vision__pasos { gap: clamp(1rem, 2vw, 1.5rem); }
.sam-vision__paso figure { margin: 0 0 .75rem; }
.sam-vision__paso img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; }
.sam-vision__paso p { margin: 0; }
.sam-vision__paso strong { color: #fff; }

/* Puntos: título + texto con línea superior */
.sam-puntos { gap: clamp(1.25rem, 3vw, 2.5rem); margin-top: var(--wp--preset--spacing--50); }
.sam-punto { border-top: 3px solid var(--wp--preset--color--antracita); padding-top: 1rem; }
.sam-punto h3 { margin: 0 0 .5rem; }
.sam-punto p { margin: 0; color: var(--wp--preset--color--texto-2); }
.sam-puntos--oscuro .sam-punto { border-top-color: var(--sam-rojo-sobre-oscuro); }
.sam-puntos--oscuro .sam-punto p { color: #D2CECF; }

.sam-followme { margin-top: var(--wp--preset--spacing--50); gap: clamp(2rem, 5vw, 4rem); }
.sam-lista-numerada { list-style: none; padding: 0; margin: 1.25rem 0; counter-reset: n; display: grid; gap: .75rem; }
.sam-lista-numerada li { counter-increment: n; position: relative; padding-left: 2.25rem; }
.sam-lista-numerada li::before { content: counter(n); position: absolute; left: 0; top: -.1em; font-family: var(--wp--preset--font-family--titulos); font-weight: 700; font-size: 1.25rem; color: var(--wp--preset--color--rojo); }
.has-antracita-background-color .sam-lista-numerada li::before { color: var(--sam-rojo-sobre-oscuro); }

/* Vídeo de YouTube que solo se carga al pulsar */
.sam-yt { position: relative; aspect-ratio: 16 / 9; background: #151314; border-radius: 4px; overflow: hidden; }
.sam-yt + .sam-yt { margin-top: 1rem; }
.sam-yt__boton {
	position: absolute; inset: 0; width: 100%; border: 1px solid #4a4546; border-radius: 4px; cursor: pointer;
	background: radial-gradient(ellipse at center, #3a3536 0%, #1a1718 75%); color: #f2f2f0;
	display: grid; place-content: center; justify-items: center; gap: .6rem; font: inherit; padding: 1rem;
}
.sam-yt__play { width: 72px; height: 72px; border-radius: 50%; background: var(--wp--preset--color--rojo); position: relative; }
.sam-yt__play::after { content: ""; position: absolute; left: 29px; top: 22px; border-style: solid; border-width: 14px 0 14px 22px; border-color: transparent transparent transparent #fff; }
.sam-yt__boton:hover .sam-yt__play { background: var(--wp--preset--color--rojo-hover); }
.sam-yt__titulo { font-family: var(--wp--preset--font-family--titulos); font-weight: 600; font-size: 1.25rem; }
.sam-yt__aviso { font-size: .8125rem; color: #B9B5B6; }
.sam-yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- 3 · Por qué ---------- */
.sam-porque__cols { gap: clamp(2rem, 6vw, 5rem); }
.sam-render { margin: 0; }
.sam-render img { display: block; max-height: 640px; width: auto; margin-inline: auto; }
.sam-render figcaption { text-align: center; color: var(--wp--preset--color--texto-2); font-size: var(--wp--preset--font-size--pequena); }
.sam-argumento + .sam-argumento { margin-top: 1.75rem; }
.sam-argumento h3 { margin: 0 0 .4rem; }
.sam-argumento p { margin: 0; max-width: 54ch; }

.sam-cifras {
	list-style: none; padding: 0; margin: var(--wp--preset--spacing--50) 0 0;
	display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
	border-top: 6px solid var(--wp--preset--color--antracita);
}
.sam-cifras li { padding: 1.25rem 1.25rem 0 0; display: grid; gap: .4rem; align-content: start; }
.sam-cifras__n { font-family: var(--wp--preset--font-family--titulos); font-weight: 700; font-size: clamp(2.75rem, 5vw, 4.25rem); line-height: .9; color: var(--wp--preset--color--rojo); }
.sam-cifras__n small { font-size: .38em; font-weight: 600; color: var(--wp--preset--color--texto); margin-right: .15em; }
.sam-cifras__t { font-weight: 500; max-width: 24ch; line-height: 1.35; }

/* ---------- 4 · Cómo trabaja: secuencia sobre un perfil ---------- */
.sam-pasos {
	list-style: none; padding: 0; margin: var(--wp--preset--spacing--40) 0 0;
	display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
	border-top: 6px solid var(--wp--preset--color--antracita);
}
.sam-pasos li { position: relative; padding: 1.75rem 1.25rem 0 0; display: flex; flex-direction: column; gap: .35rem; }
.sam-pasos li::after {
	content: ""; position: absolute; top: -12px; left: 0; width: 18px; height: 18px;
	background: var(--wp--preset--color--antracita); border: 3px solid var(--wp--preset--color--aluminio);
}
.sam-pasos .sam-pasos__ok::after { width: 34px; background: linear-gradient(90deg, var(--sam-ok) 50%, var(--wp--preset--color--rojo) 50%); }
.sam-pasos__icono { width: 48px; height: 48px; margin-bottom: .5rem; }
.sam-pasos strong { font-family: var(--wp--preset--font-family--titulos); font-size: 1.375rem; font-weight: 600; }
@media (max-width: 860px) {
	.sam-pasos { grid-template-columns: 1fr; border-top: 0; border-left: 6px solid var(--wp--preset--color--antracita); }
	.sam-pasos li { padding: 0 0 1.75rem 1.5rem; display: grid; grid-template-columns: 56px 1fr; column-gap: 1rem; }
	.sam-pasos__icono { grid-row: span 2; margin: 0; }
	.sam-pasos li::after { top: 14px; left: -12px; }
}

/* ---------- 5 · Lo que incluye y medidas ---------- */
.sam-incluye__cols, .sam-conector__cols, .sam-protecciones__cols { gap: clamp(2rem, 6vw, 5rem); }
.sam-conector__cols, .sam-protecciones__cols { margin-top: var(--wp--preset--spacing--60); }
.sam-incluye { margin: 1.25rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 0 2.5rem; }
.sam-incluye > div { border-top: var(--sam-borde); padding: .85rem 0; }
.sam-incluye dt { font-weight: 600; }
.sam-incluye dd { margin: .2rem 0 0; color: var(--wp--preset--color--texto-2); }

/* Configuración habitual: discreta, sin destacarla */
.sam-habitual { margin-top: var(--wp--preset--spacing--50); padding: clamp(1.25rem, 3vw, 2.25rem); border: var(--sam-borde); background: var(--wp--preset--color--blanco); }
.sam-habitual h3 { margin-top: 0; }
.sam-habitual__lista { margin: 1rem 0 1.5rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: .5rem 2rem; font-size: .9375rem; }
.sam-habitual__lista dt { font-weight: 600; }
.sam-habitual__lista dd { margin: 0; color: var(--wp--preset--color--texto-2); }
.sam-habitual .sam-render img { max-height: 380px; }

.sam-tamanos { margin: var(--wp--preset--spacing--30) 0; }
.sam-tamanos img { display: block; width: 100%; }

.sam-tabla { margin: 1rem 0; overflow-x: auto; }
.sam-tabla table { border-collapse: collapse; width: 100%; font-size: .9375rem; }
.sam-tabla th, .sam-tabla td { text-align: left; padding: .65rem .75rem .65rem 0; border: 0; border-bottom: var(--sam-borde); vertical-align: top; }
.sam-tabla thead th { font-weight: 600; border-bottom: 2px solid var(--wp--preset--color--antracita); }
.sam-tabla--conector td:not(:first-child), .sam-tabla--conector th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.sam-tabla--ficha td:first-child { font-weight: 600; width: 34%; }
.sam-tabla--ficha thead th:empty { display: none; }
.sam-conectores { gap: 1rem; margin-top: 1.25rem; align-items: end; }
.sam-conectores figure { margin: 0; }
.sam-conectores img { display: block; width: 100%; background: #fff; border: var(--sam-borde); }
.sam-conectores figcaption { font-weight: 600; font-size: var(--wp--preset--font-size--pequena); margin-top: .35rem; }

/* Comparador antes / después */
.sam-comparador { --pos: 50%; position: relative; max-width: 520px; margin-inline: auto; user-select: none; }
.sam-comparador img { display: block; width: 100%; height: auto; }
.sam-comparador__antes { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.sam-comparador__antes::after { content: ""; position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: var(--wp--preset--color--rojo); }
.sam-comparador__rotulo { position: absolute; bottom: .75rem; padding: .3rem .6rem; background: var(--wp--preset--color--antracita); color: #fff; font-size: .8125rem; font-weight: 600; }
.sam-comparador__rotulo--antes { left: .75rem; }
.sam-comparador__rotulo--despues { right: .75rem; }
.sam-comparador__control { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.sam-comparador__control:focus-visible + * , .sam-comparador:focus-within { outline: 3px solid var(--wp--preset--color--senal); outline-offset: 4px; }

/* ---------- 6 · Funciones ---------- */
.sam-funcion { margin-top: var(--wp--preset--spacing--60); gap: clamp(2rem, 6vw, 5rem); }
.sam-funcion h3 { margin-top: 0; max-width: 22ch; }
.sam-funcion .sam-render img { max-height: 520px; }
.sam-videos { display: grid; gap: 1rem; }
.sam-pantallas { gap: 1.25rem; margin-top: 1.5rem; }
.sam-pantalla { margin: 0; }
.sam-pantalla img { display: block; width: 100%; max-width: 800px; border: var(--sam-borde); }
.sam-pantalla figcaption { font-size: var(--wp--preset--font-size--pequena); color: var(--wp--preset--color--texto-2); margin-top: .4rem; }
.sam-abierta { margin-top: var(--wp--preset--spacing--60); padding: clamp(1.5rem, 4vw, 3rem); background: var(--wp--preset--color--antracita); color: var(--wp--preset--color--aluminio); }
.sam-abierta h3 { margin-top: 0; color: #fff; }
.sam-abierta .sam-antetitulo { color: var(--sam-rojo-sobre-oscuro); }
.sam-abierta__botones { flex-direction: column; align-items: stretch; }
.sam-abierta .is-style-outline .wp-block-button__link { color: #fff; }

/* ---------- 7 · Contacto ---------- */
.sam-contacto .wp-block-columns { gap: clamp(2rem, 6vw, 5.5rem); }
.sam-contacto h2 { margin-top: 0; font-size: var(--wp--preset--font-size--titulo-1); }
.sam-contacto h3 { margin-top: 0; }
.sam-contacto__eslogan { font-family: var(--wp--preset--font-family--titulos); font-weight: 600; font-size: 1.5rem; line-height: 1.15; }
.sam-contacto__resumen { list-style: none; padding: 0; margin: 1.25rem 0 1.75rem; }
.sam-contacto__resumen li { padding: .55rem 0; border-top: var(--sam-borde); font-weight: 500; }
.sam-contacto__datos { margin-top: 1.75rem; line-height: 1.8; }

/* ---------- Pie ---------- */
.sam-pie { padding-top: 2rem; padding-bottom: 2rem; }
.sam-pie p { margin: 0; }
.sam-pie a { color: inherit; }
.sam-pie a:hover { color: #fff; }
.sam-pie__legal { display: flex; gap: 1.5rem; }

/* ---------- Accesibilidad ---------- */
.screen-reader-text { border: 0; clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute !important; width: 1px; white-space: nowrap; }

/* Marcas de contenido pendiente */
.sam-pendiente { background: #FFE45C; padding: .75rem 1rem; }

/* ---------- Móvil ---------- */
@media (max-width: 781px) {
	.sam-hero__imagen img { max-height: 46vh; }
	.sam-hero__cols { flex-direction: column-reverse; }
	.sam-funcion { flex-direction: column; }
}

/* Rejillas de 3 elementos: ocupan todo el ancho */
.sam-vision__pasos, .sam-pantallas { grid-template-columns: repeat(auto-fit, minmax(min(16rem, 100%), 1fr)) !important; }
.sam-conectores { grid-template-columns: repeat(auto-fit, minmax(min(8rem, 100%), 1fr)) !important; }


/* ---------- Cabecera común (v0.3): la barra de Josep (logo · Inicio · SAM Gen5 · Sistema de visión · Configurador · ES | EN · Iniciar sesión) ---------- */
.wp-site-blocks > header.wp-block-template-part { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 1000; }
.sam-barra {
	box-sizing: border-box; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0 20px; min-height: 58px;
	padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
	background: #fff; color: #231F20; border-bottom: 1px solid #D9DCDF;
	font: 15px/1.4 var(--wp--preset--font-family--texto);
}
.sam-barra > * { margin: 0 !important; }
.sam-barra__logo { margin: 0; height: 58px; display: flex; align-items: center; }
.sam-barra__logo a { display: block; }
.sam-barra__logo img { height: 22px !important; width: auto !important; display: block; }
.sam-barra__pestanas { overflow-x: auto; scrollbar-width: none; }
.sam-barra__pestanas::-webkit-scrollbar { display: none; }
.sam-barra__pestanas .wp-block-navigation__container { gap: 4px; flex-wrap: nowrap; }
.sam-barra .sam-barra__pestanas .wp-block-navigation-item__content {
	font: 600 16px var(--wp--preset--font-family--titulos); letter-spacing: .01em; color: #231F20; text-decoration: none; white-space: nowrap;
	padding: 17px 12px 15px !important; border-bottom: 3px solid transparent; display: block; line-height: 23px;
}
.sam-barra .sam-barra__pestanas .wp-block-navigation-item__content:hover { color: #9E0B10; }
.sam-barra .sam-barra__pestanas .wp-block-navigation-item__content[aria-current="page"] { border-bottom-color: #9E0B10; }
.sam-barra__der { gap: 12px; }
.sam-idioma { display: inline-flex; border: 1px solid #C9CDD1; border-radius: 8px; overflow: hidden; }
.sam-idioma > * { font: 600 12.5px ui-monospace, Consolas, monospace; letter-spacing: .04em; padding: 6px 10px; background: #fff; color: #5B6168; text-decoration: none; }
.sam-idioma > * + * { border-left: 1px solid #C9CDD1; }
.sam-idioma [aria-current="true"] { background: #231F20; color: #fff; }
.sam-idioma [aria-disabled="true"] { opacity: .55; cursor: default; }
.sam-barra__cta {
	font: 600 14px var(--wp--preset--font-family--texto); padding: 8px 14px; border-radius: 8px; border: 1px solid #9E0B10;
	background: #9E0B10; color: #fff; white-space: nowrap; text-decoration: none; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
}
.sam-barra__cta:hover { background: #7F080C; border-color: #7F080C; color: #fff; }
.sam-barra__cta.dentro { background: #fff; color: #231F20; border-color: #C9CDD1; }
@media (max-width: 760px) {
	.sam-barra { grid-template-columns: auto 1fr; grid-template-rows: 52px auto; gap: 0 10px; }
	.sam-barra__logo { height: 52px; }
	.sam-barra__logo img { height: 19px !important; }
	.sam-barra__der { justify-content: flex-end; gap: 8px; }
	nav.sam-barra__pestanas { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid #EEF0F2; margin: 0 -16px !important; padding: 0 10px !important; }
	.sam-barra__pestanas ul { margin: 0 !important; }
	.sam-barra .sam-barra__pestanas .wp-block-navigation-item__content { font-size: 15px; padding: 11px 10px 9px !important; line-height: 18px; }
	.sam-barra__cta { padding: 7px 10px; font-size: 13px; max-width: 150px; }
}

/* Páginas de Josep y configurador: sin márgenes del tema alrededor */
.sam-principal:has(> .sam-pkg), .sam-principal:has(> .sam-pkg-configurador) { margin: 0; padding: 0; }
body .sam-pkg > :not(dialog), body .sam-pkg-configurador > * { margin-block-start: 0; }
.sam-pkg-configurador .sam-configurador { margin: 0; }
