/*
Theme Name: Bien Elegido
Description: Tema ligero para guías y comparativas de productos con enlaces de afiliado. Requiere el plugin «Bien Elegido – Núcleo».
Version: 1.0.2
Requires at least: 6.4
Requires PHP: 8.0
Author: Bien Elegido
Text Domain: bienelegido
License: GPL-2.0-or-later
*/

:root {
	--be-primary: #012055;
	--be-accent: #ff6401;
	--be-accent-ink: #b84400;
	--be-ink: #1b2433;
	--be-muted: #5a6577;
	--be-line: #e3e7ee;
	--be-soft: #f5f7fa;
	--be-white: #fff;
	--be-ok: #1d7a46;
	--be-bad: #b3412e;
	--be-radius: 14px;
	--be-shadow: 0 1px 2px rgba(1, 32, 85, .06), 0 6px 20px rgba(1, 32, 85, .06);
	--be-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--be-wrap: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body {
	margin: 0;
	background: var(--be-white);
	color: var(--be-ink);
	font-family: var(--be-font);
	font-size: 17px;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--be-primary); text-underline-offset: 3px; }
a:hover { color: var(--be-accent); }
h1, h2, h3, h4 { color: var(--be-primary); line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .6em; }
h1 { font-size: clamp(1.8rem, 1.3rem + 2vw, 2.6rem); }
h2 { font-size: clamp(1.35rem, 1.15rem + .8vw, 1.7rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--be-accent); outline-offset: 2px; border-radius: 4px; }

.screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link:focus {
	clip: auto; clip-path: none; width: auto; height: auto; z-index: 1000;
	top: 8px; left: 8px; padding: 10px 16px; background: var(--be-white); color: var(--be-primary);
}

.be-container { width: 100%; max-width: var(--be-wrap); margin: 0 auto; padding: 0 16px; }
.be-container--narrow { max-width: 780px; }
.be-main { min-height: 60vh; outline: none; }

/* Cabecera */
.be-header { position: sticky; top: 0; z-index: 50; background: var(--be-white); border-bottom: 1px solid var(--be-line); }
.be-header__bar { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.be-brand { flex: 0 0 auto; }
.be-brand__name { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.3rem; color: var(--be-primary); text-decoration: none; letter-spacing: -.02em; }
.be-brand__mark {
	display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
	background: var(--be-accent); color: var(--be-white); font-size: 1rem; font-weight: 900;
}
.custom-logo-link { display: block; }
.custom-logo { height: 52px; width: auto; max-height: none; }
@media (max-width: 760px) { .custom-logo { height: 42px; } }
.be-header__search { flex: 1 1 auto; max-width: 520px; margin-left: auto; }
.be-nav-toggle { display: none; }

.be-search { display: flex; align-items: stretch; background: var(--be-soft); border: 1px solid var(--be-line); border-radius: 999px; overflow: hidden; }
.be-search:focus-within { border-color: var(--be-primary); box-shadow: 0 0 0 3px rgba(1, 32, 85, .12); }
.be-search input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 16px; font: inherit; font-size: 16px; color: var(--be-ink); }
.be-search input:focus { outline: none; }
.be-search button { border: 0; background: transparent; color: var(--be-primary); padding: 0 14px; cursor: pointer; }

.be-nav { border-top: 1px solid var(--be-line); }
.be-nav__list { display: flex; flex-wrap: wrap; gap: 4px 28px; list-style: none; margin: 0; padding: 0; }
.be-nav__list a { display: block; padding: 12px 0; color: var(--be-ink); font-weight: 600; font-size: .95rem; text-decoration: none; border-bottom: 2px solid transparent; }
.be-nav__list a:hover, .be-nav__list .current-menu-item > a, .be-nav__list .current-cat > a { color: var(--be-primary); border-bottom-color: var(--be-accent); }

@media (max-width: 760px) {
	.be-header__bar { flex-wrap: wrap; gap: 8px 12px; padding-top: 8px; padding-bottom: 10px; }
	.be-header__search { order: 3; flex-basis: 100%; max-width: none; }
	.be-nav-toggle {
		display: inline-grid; place-items: center; margin-left: auto; width: 44px; height: 44px;
		border: 1px solid var(--be-line); border-radius: 10px; background: var(--be-white); cursor: pointer;
	}
	.be-nav-toggle__icon, .be-nav-toggle__icon::before, .be-nav-toggle__icon::after {
		display: block; width: 20px; height: 2px; background: var(--be-primary); border-radius: 2px; position: relative; content: ""; transition: transform .2s;
	}
	.be-nav-toggle__icon::before { position: absolute; top: -6px; }
	.be-nav-toggle__icon::after { position: absolute; top: 6px; }
	.be-nav-toggle[aria-expanded="true"] .be-nav-toggle__icon { background: transparent; }
	.be-nav-toggle[aria-expanded="true"] .be-nav-toggle__icon::before { transform: translateY(6px) rotate(45deg); }
	.be-nav-toggle[aria-expanded="true"] .be-nav-toggle__icon::after { transform: translateY(-6px) rotate(-45deg); }
	.be-nav { display: none; }
	.be-nav.is-open { display: block; }
	.be-nav__list { flex-direction: column; gap: 0; }
	.be-nav__list a { padding: 14px 0; border-bottom: 1px solid var(--be-line); }
}

/* Portada */
.be-hero { background: var(--be-primary); color: #dfe6f2; position: relative; overflow: hidden; }
.be-hero::after {
	content: ""; position: absolute; right: -120px; top: -120px; width: 360px; height: 360px; border-radius: 50%;
	background: radial-gradient(circle, rgba(255, 100, 1, .35), rgba(255, 100, 1, 0) 70%);
}
.be-hero__inner { position: relative; z-index: 1; padding-top: clamp(40px, 7vw, 88px); padding-bottom: clamp(40px, 7vw, 88px); max-width: 860px; margin-left: auto; margin-right: auto; text-align: center; }
.be-hero__title { color: var(--be-white); font-size: clamp(2rem, 1.2rem + 3.4vw, 3.3rem); margin-bottom: .4em; }
.be-hero__lead { font-size: clamp(1.02rem, .95rem + .35vw, 1.18rem); max-width: 640px; margin: 0 auto 28px; }
.be-hero__search { max-width: 560px; margin: 0 auto 22px; }
.be-hero .be-search { background: var(--be-white); border-color: transparent; }
.be-hero .be-search input { padding: 14px 20px; }
.be-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; list-style: none; padding: 0; margin: 0; }
.be-chips a { display: inline-block; padding: 7px 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .3); color: var(--be-white); text-decoration: none; font-size: .92rem; font-weight: 600; }
.be-chips a:hover { background: var(--be-white); color: var(--be-primary); }

.be-eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .74rem; font-weight: 700; color: var(--be-accent-ink); margin-bottom: .6em; }
.be-eyebrow--light { color: #ffc58c; }

.be-section { padding: clamp(40px, 6vw, 72px) 0; }
.be-section--alt { background: var(--be-soft); }
.be-section__head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.be-section__head h2 { margin: 0; }
.be-link { font-weight: 700; text-decoration: none; white-space: nowrap; }
.be-link::after { content: " →"; }

.be-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 22px; }
.be-grid--posts { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }

/* Tarjeta de producto */
.be-card { display: flex; flex-direction: column; background: var(--be-white); border: 1px solid var(--be-line); border-radius: var(--be-radius); overflow: hidden; box-shadow: var(--be-shadow); transition: transform .15s, box-shadow .15s; }
.be-card:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(1, 32, 85, .1); }
.be-card__media { position: relative; display: block; text-decoration: none; aspect-ratio: 4 / 3; background: var(--be-soft); }
.be-card__media img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.be-card__body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 18px; flex: 1; }
.be-card__brand { margin: 0; font-size: .78rem; font-weight: 700; color: var(--be-muted); text-transform: uppercase; letter-spacing: .05em; }
.be-card__title { margin: 0; font-size: 1.05rem; }
.be-card__title a { color: var(--be-ink); text-decoration: none; }
.be-card__title a:hover { color: var(--be-primary); text-decoration: underline; }
.be-card__verdict { margin: 0; color: var(--be-muted); font-size: .93rem; line-height: 1.5; }
.be-card__actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px; }
.be-card__actions .be-link { font-size: .92rem; }

.be-noimg { display: grid; place-items: center; align-content: center; gap: 6px; width: 100%; height: 100%; min-height: 160px; color: #9aa5b6; font-size: .8rem; background: repeating-linear-gradient(45deg, #f5f7fa, #f5f7fa 12px, #eef1f6 12px, #eef1f6 24px); }

.be-badge { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; }
.be-badge--demo { background: #fff1c7; color: #7a5300; }
.be-card__media .be-badge { position: absolute; top: 10px; left: 10px; }

/* Botón de afiliado */
.be-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 8px;
	min-height: 48px; padding: 12px 24px; border-radius: 12px;
	background: var(--be-accent); color: var(--be-primary); font-weight: 800; font-size: 1rem; text-decoration: none; text-align: center;
	box-shadow: 0 2px 0 rgba(0, 0, 0, .12); transition: filter .15s, transform .15s;
}
.be-btn:hover { color: var(--be-primary); filter: brightness(1.06); transform: translateY(-1px); }
.be-btn--small { min-height: 40px; padding: 8px 14px; font-size: .88rem; border-radius: 10px; }
.be-btn.is-disabled { background: var(--be-soft); color: var(--be-muted); border: 1px dashed #c3cad6; box-shadow: none; cursor: not-allowed; font-weight: 600; }
.be-btn.is-disabled:hover { transform: none; filter: none; }
.be-aff-note { font-size: .82rem; color: var(--be-muted); margin: 10px 0 0; line-height: 1.45; }

/* Categorías */
.be-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; }
.be-cat { display: flex; flex-direction: column; gap: 8px; padding: 26px; background: var(--be-white); border: 1px solid var(--be-line); border-radius: var(--be-radius); text-decoration: none; color: var(--be-ink); box-shadow: var(--be-shadow); }
.be-cat:hover { border-color: var(--be-primary); color: var(--be-ink); }
.be-cat__icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 100, 1, .14); color: var(--be-accent-ink); }
.be-cat__name { font-size: 1.25rem; font-weight: 800; color: var(--be-primary); }
.be-cat__desc { color: var(--be-muted); font-size: .95rem; }
.be-cat__cta { margin-top: auto; font-weight: 700; color: var(--be-primary); }

.be-steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }
.be-steps li { counter-increment: step; position: relative; padding: 24px 24px 24px 72px; background: var(--be-white); border-radius: var(--be-radius); border: 1px solid var(--be-line); }
.be-steps li::before { content: counter(step); position: absolute; left: 22px; top: 22px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--be-primary); color: var(--be-white); font-weight: 800; }
.be-steps strong { display: block; color: var(--be-primary); margin-bottom: 4px; }

/* Tarjeta de artículo */
.be-post-card { display: flex; flex-direction: column; background: var(--be-white); border: 1px solid var(--be-line); border-radius: var(--be-radius); overflow: hidden; }
.be-post-card__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.be-post-card__body { padding: 18px 20px 20px; display: flex; flex-direction: column; flex: 1; }
.be-post-card__title { font-size: 1.12rem; }
.be-post-card__title a { color: var(--be-ink); text-decoration: none; }
.be-post-card__title a:hover { color: var(--be-primary); text-decoration: underline; }
.be-post-card__excerpt { color: var(--be-muted); font-size: .95rem; }
.be-meta { color: var(--be-muted); font-size: .85rem; margin: auto 0 0; }

/* Cabeceras de página */
.be-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 18px 0 0; font-size: .85rem; color: var(--be-muted); }
.be-crumbs li + li::before { content: "›"; margin-right: 6px; }
.be-crumbs a { color: var(--be-muted); }
.be-page-head { padding: 26px 0 10px; max-width: 820px; }
.be-page-head__intro { color: var(--be-muted); font-size: 1.05rem; }
.be-page-head__search { max-width: 560px; margin-top: 12px; }
.be-block { margin: 28px 0 48px; }
.be-block__title { font-size: 1.4rem; }
.be-empty { padding: 26px; background: var(--be-soft); border-radius: var(--be-radius); color: var(--be-muted); }

.be-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 12px 18px; margin: 0 0 20px; padding: 14px 16px; background: var(--be-soft); border-radius: 12px; }
.be-filters__group { display: flex; flex-direction: column; gap: 4px; }
.be-filters label { font-size: .8rem; font-weight: 700; color: var(--be-muted); text-transform: uppercase; letter-spacing: .05em; }
.be-filters select { min-width: 180px; min-height: 42px; padding: 8px 12px; border: 1px solid var(--be-line); border-radius: 10px; background: var(--be-white); font: inherit; font-size: 16px; }
.be-filters__count { margin: 0 0 8px auto; font-size: .9rem; color: var(--be-muted); }

/* Ficha de producto */
.be-product__top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 56px); padding-top: 22px; padding-bottom: 36px; align-items: start; }
.be-product__media { background: var(--be-soft); border-radius: var(--be-radius); padding: 18px; position: sticky; top: 130px; }
.be-product__media img { margin: 0 auto; max-height: 460px; width: auto; object-fit: contain; }
.be-product__media .be-noimg { min-height: 300px; border-radius: 10px; }
.be-product__media .be-meta { margin-top: 10px; }
.be-product__title { margin-bottom: 18px; }
.be-verdict { border-left: 4px solid var(--be-accent); background: #fff7ef; padding: 14px 18px; border-radius: 0 12px 12px 0; margin-bottom: 16px; }
.be-verdict__label { font-weight: 800; color: var(--be-primary); margin-bottom: 4px; font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; }
.be-verdict p:last-child { margin: 0; }
.be-for { font-size: 1.02rem; }
.be-product__cta { margin: 22px 0 14px; padding: 18px; border: 1px solid var(--be-line); border-radius: var(--be-radius); }
.be-product__cta .be-btn { width: 100%; }
.be-product__body { max-width: 860px; padding-bottom: 20px; }

.be-specs { margin: 0; border: 1px solid var(--be-line); border-radius: 12px; overflow: hidden; }
.be-specs div { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; border-top: 1px solid var(--be-line); }
.be-specs div:first-child { border-top: 0; }
.be-specs div:nth-child(odd) { background: var(--be-soft); }
.be-specs dt { font-weight: 700; padding: 10px 14px; color: var(--be-primary); }
.be-specs dd { margin: 0; padding: 10px 14px; }

.be-proscons { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.be-pros, .be-cons { padding: 20px 22px; border-radius: var(--be-radius); border: 1px solid var(--be-line); }
.be-pros h2, .be-cons h2 { font-size: 1.15rem; }
.be-pros ul, .be-cons ul { list-style: none; padding: 0; margin: 0; }
.be-pros li, .be-cons li { position: relative; padding-left: 28px; margin: 8px 0; }
.be-pros li::before { content: "✓"; position: absolute; left: 0; color: var(--be-ok); font-weight: 900; }
.be-cons li::before { content: "–"; position: absolute; left: 4px; color: var(--be-bad); font-weight: 900; }
.be-pros { border-top: 4px solid var(--be-ok); }
.be-cons { border-top: 4px solid var(--be-bad); }

.be-cta-box { text-align: center; padding: 28px 20px; background: var(--be-soft); border-radius: var(--be-radius); }
.be-cta-box__title { font-weight: 800; font-size: 1.15rem; color: var(--be-primary); }

.be-sticky-cta {
	position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; display: none; align-items: center; gap: 12px;
	padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--be-white); border-top: 1px solid var(--be-line);
	box-shadow: 0 -6px 20px rgba(1, 32, 85, .08); transform: translateY(110%); transition: transform .2s;
}
.be-sticky-cta__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.be-sticky-cta__title { font-weight: 700; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.be-sticky-cta__note { font-size: .72rem; color: var(--be-muted); }
@media (max-width: 760px) {
	.be-sticky-cta { display: flex; }
	.be-sticky-cta.is-visible { transform: none; }
	.be-product__top { grid-template-columns: 1fr; }
	.be-product__media { position: static; }
	.be-product__media img { max-height: 320px; }
}

/* Artículos */
.be-article { padding-bottom: 40px; }
.be-article__head { padding: 18px 0 8px; }
.be-basis { background: var(--be-soft); padding: 12px 16px; border-radius: 12px; font-size: .95rem; margin-top: 14px; }
.be-article__media { margin: 10px 0 24px; }
.be-article__media img { border-radius: var(--be-radius); }
.be-content > * { max-width: 100%; }
.be-content h2 { margin-top: 1.6em; }
.be-content h3 { margin-top: 1.3em; }
.be-content ul, .be-content ol { padding-left: 1.3em; }
.be-content li { margin: .3em 0; }
.be-content img { border-radius: 10px; }
.be-content table { width: 100%; border-collapse: collapse; }
.be-content .wp-block-table { overflow-x: auto; }
.be-content th, .be-content td { border: 1px solid var(--be-line); padding: 8px 10px; text-align: left; }
.be-content blockquote { margin: 1.5em 0; padding: 4px 20px; border-left: 4px solid var(--be-accent); color: var(--be-muted); }
.be-sources { margin-top: 36px; padding: 20px 22px; background: var(--be-soft); border-radius: var(--be-radius); font-size: .93rem; }
.be-sources h2 { font-size: 1.1rem; margin-top: 0; }
.be-author { display: flex; gap: 16px; align-items: flex-start; margin-top: 36px; padding-top: 24px; border-top: 1px solid var(--be-line); }
.be-author img { border-radius: 50%; }
.be-author__name { font-weight: 700; margin-bottom: 4px; }

.be-draft-note, .be-demo-banner { background: #fff7e0; border: 1px solid #f1d58a; color: #5c4300; padding: 12px 16px; border-radius: 12px; font-size: .95rem; }
.be-demo-banner { margin: 16px 0 0; }
.be-pending { background: #ffe9a8; padding: 1px 4px; border-radius: 4px; color: #5c4300; }
.be-admin-hint { color: var(--be-bad); font-size: .9rem; }

/* Comparativas: tabla con desplazamiento horizontal y primera columna fija */
.be-compare { overflow-x: auto; margin: 1.5em 0 .5em; border: 1px solid var(--be-line); border-radius: var(--be-radius); -webkit-overflow-scrolling: touch; }
.be-compare table { border-collapse: separate; border-spacing: 0; min-width: 560px; width: 100%; font-size: .93rem; }
.be-compare th, .be-compare td { border: 0; border-bottom: 1px solid var(--be-line); padding: 12px 14px; vertical-align: top; text-align: left; min-width: 150px; }
.be-compare thead th { background: var(--be-soft); font-weight: 700; }
.be-compare thead a { color: var(--be-ink); }
.be-compare__img .be-noimg span { display: none; }
.be-compare tbody th { position: sticky; left: 0; z-index: 1; background: var(--be-white); color: var(--be-primary); min-width: 120px; max-width: 160px; box-shadow: 1px 0 0 var(--be-line); }
.be-compare thead th:first-child { position: sticky; left: 0; z-index: 2; }
.be-compare__img { width: 96px; height: 72px; margin-bottom: 8px; background: var(--be-soft); border-radius: 8px; overflow: hidden; }
.be-compare__img img { width: 100%; height: 100%; object-fit: contain; }
.be-compare__img .be-noimg { min-height: 0; font-size: 0; }
.be-compare__img .be-noimg svg { width: 24px; }
.be-compare tr:last-child th, .be-compare tr:last-child td { border-bottom: 0; }

.be-inline-product { margin: 1.5em 0; max-width: 420px; }

/* Paginación */
.navigation.pagination { margin: 30px 0; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px; }
.page-numbers { display: inline-grid; place-items: center; min-width: 42px; height: 42px; padding: 0 12px; border: 1px solid var(--be-line); border-radius: 10px; text-decoration: none; }
.page-numbers.current { background: var(--be-primary); color: var(--be-white); border-color: var(--be-primary); }

/* Pie */
.be-footer { margin-top: 40px; background: var(--be-primary); color: #c9d3e3; font-size: .93rem; }
.be-footer a { color: var(--be-white); }
.be-footer__grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 32px; padding-top: 44px; padding-bottom: 28px; }
.be-footer__brand { display: flex; align-items: center; gap: 8px; color: var(--be-white); font-weight: 800; font-size: 1.2rem; }
.be-footer__logo { height: 56px; width: auto; margin-bottom: 14px; }
.be-footer__legal { list-style: none; padding: 0; margin: 0; columns: 2 180px; }
.be-footer__legal li { margin: 0 0 8px; break-inside: avoid; }
.be-footer__legal a { text-decoration: none; }
.be-footer__legal a:hover { text-decoration: underline; color: var(--be-white); }
.be-footer__bottom { border-top: 1px solid rgba(255, 255, 255, .14); padding-top: 18px; padding-bottom: 26px; font-size: .84rem; }
.be-footer__disclosure { color: var(--be-white); }
@media (max-width: 760px) {
	.be-footer__grid { grid-template-columns: 1fr; }
	body.single-producto .be-footer { padding-bottom: 76px; }
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after { transition: none !important; }
}
