/*
Theme Name: DeChollos
Theme URI: https://dechollos.es/
Author: DeChollos.es
Description: Plantilla rápida y preparada para SEO para blogs de chollos. Descuento calculado automáticamente, chollos caducados marcados, aviso de afiliación, migas de pan, datos estructurados y paginación numerada. Compatible con los campos de precio de Rehub.
Version: 1.4.0
Requires at least: 6.3
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: dechollos
*/

:root {
	--brand: #1565c0;
	--brand-dark: #0f4a8f;
	--ink: #171a21;
	--dark: #171a21;
	--badge: #ffd60a;
	--badge-text: #171a21;
	--muted: #5b6270;
	--line: #e3e6ec;
	--bg: #f4f5f8;
	--card: #fff;
	--yellow: #ffd60a;
	--green: #0a7d43;
	--radius: 12px;
	--wrap: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
	margin: 0;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 16px;
	line-height: 1.6;
	color: var(--ink);
	background: var(--bg);
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.6rem); }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.wrap { width: min(100% - 32px, var(--wrap)); margin-inline: auto; }
.narrow { max-width: 780px; }
.section { padding-block: 28px 48px; }
.screen-reader-text {
	position: absolute; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 10px 16px; z-index: 100; }
.skip-link:focus { left: 8px; top: 8px; }

/* ---------- Cabecera ---------- */
.site-header { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.header-row { display: flex; align-items: center; gap: 16px; padding-block: 12px; }
.brand-text, .footer-brand { font-weight: 800; font-size: 1.45rem; letter-spacing: -.03em; color: var(--ink); text-decoration: none; }
.brand-text span, .footer-brand span { color: var(--brand); }
.custom-logo { max-height: 48px; width: auto; }

.search-form { display: flex; flex: 1; max-width: 460px; margin-inline: auto; }
.search-form label { flex: 1; }
.search-form input {
	width: 100%; height: 42px; padding: 0 14px; font: inherit;
	border: 1px solid var(--line); border-right: 0; border-radius: 999px 0 0 999px; background: var(--bg);
}
.search-form button {
	height: 42px; padding: 0 18px; font: inherit; font-weight: 600; color: #fff; cursor: pointer;
	background: var(--ink); border: 0; border-radius: 0 999px 999px 0;
}
.btn-telegram {
	white-space: nowrap; font-weight: 600; font-size: .92rem; text-decoration: none;
	color: #0b6fa8; border: 1px solid #b9dcf0; background: #eef8fd; padding: 9px 14px; border-radius: 999px;
}
.menu-toggle { display: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; }
.menu-toggle-bars, .menu-toggle-bars::before, .menu-toggle-bars::after {
	display: block; width: 18px; height: 2px; background: var(--ink); margin-inline: auto; position: relative; content: "";
}
.menu-toggle-bars::before { position: absolute; top: -6px; }
.menu-toggle-bars::after { position: absolute; top: 6px; }

.main-nav { border-top: 1px solid var(--line); }
.main-nav ul { list-style: none; margin: 0; padding: 0; }
.main-nav .menu { display: flex; flex-wrap: wrap; gap: 2px; }
.main-nav li { position: relative; }
.main-nav a { display: block; padding: 11px 13px; color: var(--ink); font-weight: 600; font-size: .95rem; text-decoration: none; }
.main-nav a:hover, .main-nav .current-menu-item > a, .main-nav .current-cat > a { color: var(--brand); }
.main-nav ul ul {
	display: none; position: absolute; left: 0; top: 100%; min-width: 220px; z-index: 60;
	background: var(--card); border: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius);
	box-shadow: 0 12px 24px rgba(23, 26, 33, .08);
}
.main-nav ul ul ul { left: 100%; top: 0; }
.main-nav li:hover > ul, .main-nav li:focus-within > ul, .main-nav li.is-open > ul { display: block; }
.main-nav ul ul a { font-weight: 500; padding: 9px 14px; }
.submenu-toggle { display: none; }

/* ---------- Portada ---------- */
.hero { background: var(--dark); color: #fff; padding-block: 36px; }
.hero h1 { max-width: 20ch; }
.hero p { max-width: 62ch; color: #cfd3dc; font-size: 1.05rem; }
.hero .chips a { background: rgba(255, 255, 255, .1); border-color: transparent; color: #fff; }
.hero .chips a:hover, .hero .chips a:focus-visible { background: var(--brand); border-color: var(--brand); color: #fff; }
.section-title { margin-bottom: 18px; padding-left: 12px; border-left: 5px solid var(--brand); }
.about { background: var(--card); border-top: 1px solid var(--line); padding-block: 40px; }
.about h2 { margin-top: 1.2em; }
.about h2:first-child { margin-top: 0; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.chips a {
	display: inline-block; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px;
	background: var(--card); color: var(--ink); font-size: .9rem; font-weight: 600; text-decoration: none;
}
.chips a:hover { border-color: var(--brand); color: var(--brand); }
.chips-tags { margin-top: 24px; }

/* ---------- Tarjetas ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.card {
	display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
	border-radius: var(--radius); overflow: hidden; transition: box-shadow .15s, transform .15s;
}
.card:hover { box-shadow: 0 10px 24px rgba(23, 26, 33, .09); transform: translateY(-2px); }
.card-media { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: #fff; padding: 12px; }
.card-media img { width: 100%; height: 100%; object-fit: contain; }
.card-media > *, .deal-media > * { min-height: 0; }
.card-media, .deal-media { text-decoration: none; }
.noimg {
	position: absolute; inset: 12px; display: grid; place-items: center; border-radius: 8px;
	background: var(--bg); color: #b4bac6; font-size: 3rem; font-weight: 800;
}
.badge {
	position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px;
	background: var(--badge); color: var(--badge-text); font-weight: 800; font-size: .95rem;
}
.badge-expired { background: var(--muted); color: #fff; font-weight: 700; font-size: .8rem; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 14px; flex: 1; border-top: 1px solid var(--line); }
.card-meta { display: flex; justify-content: space-between; gap: 8px; margin: 0; font-size: .8rem; color: var(--muted); }
.store { font-weight: 700; color: var(--ink); text-transform: uppercase; letter-spacing: .04em; }
.card-title { font-size: 1rem; font-weight: 600; line-height: 1.35; margin: 0; }
.card-title a {
	color: var(--ink); text-decoration: none;
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card-title a:hover { color: var(--brand); }
.prices { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin: auto 0 0; }
.price { font-size: 1.35rem; font-weight: 800; color: var(--brand); letter-spacing: -.02em; }
.price-old { color: var(--muted); font-size: .92rem; }
.is-expired .price { color: var(--muted); }
.is-expired .card-media img { filter: grayscale(1); opacity: .7; }

.btn {
	display: inline-block; text-align: center; padding: 10px 16px; border-radius: 10px; border: 2px solid var(--brand);
	background: var(--brand); color: #fff; font-weight: 700; text-decoration: none; transition: background .15s;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--bg); color: var(--ink); border-color: var(--muted); }
.btn-lg { padding: 14px 22px; font-size: 1.08rem; }

/* ---------- Migas y cabeceras de listado ---------- */
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; padding: 0; font-size: .86rem; color: var(--muted); }
.breadcrumbs li + li::before { content: "›"; margin-right: 6px; }
.breadcrumbs a { color: var(--muted); }
.breadcrumbs li[aria-current] { max-width: 40ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archive-header { margin-bottom: 24px; }
.archive-header h1 small { font-size: .55em; font-weight: 500; color: var(--muted); }
.archive-desc { max-width: 75ch; color: var(--muted); }

/* ---------- Ficha de chollo ---------- */
.deal, .page-article { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 32px); }
.deal-meta { color: var(--muted); font-size: .88rem; }
.deal-meta a { color: inherit; }
.notice { padding: 12px 16px; border-radius: 10px; background: #fff7d6; border: 1px solid #f0d878; }
.deal-box { display: grid; grid-template-columns: minmax(0, 340px) 1fr; gap: 28px; align-items: center; margin-block: 20px 28px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: #fcfcfd; }
.deal-media { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: #fff; border-radius: 10px; padding: 12px; }
.deal-media img { width: 100%; height: 100%; object-fit: contain; }
.deal-store { margin-bottom: 6px; color: var(--muted); }
.prices-lg .price { font-size: 2.3rem; }
.prices-lg .price-old { font-size: 1.1rem; }
.saving { color: var(--green); font-weight: 700; }
.coupon { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.coupon code { padding: 6px 12px; border: 2px dashed var(--ink); border-radius: 8px; font-size: 1.05rem; font-weight: 700; background: #fff; }
.coupon-copy { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; font-weight: 600; cursor: pointer; }
.deal-check, .affiliate-inline { margin: 12px 0 0; font-size: .84rem; color: var(--muted); }
.affiliate-inline { margin-top: 4px; }

.entry-content { max-width: 72ch; font-size: 1.04rem; }
.entry-content h2 { margin-top: 1.6em; }
.entry-content h3 { margin-top: 1.4em; font-size: 1.15rem; }
.entry-content img { border-radius: 10px; margin-block: 1em; }
.entry-content ul, .entry-content ol { padding-left: 1.3em; }
.entry-content table { width: 100%; border-collapse: collapse; margin-block: 1em; }
.entry-content th, .entry-content td { padding: 8px 10px; border: 1px solid var(--line); text-align: left; }
.related { margin-top: 36px; }

/* ---------- Aviso, Telegram, compartir, botón fijo ---------- */
.notice-bar { background: var(--brand); color: #fff; text-align: center; font-weight: 600; font-size: .92rem; padding: 8px 16px; }
.notice-bar a { color: #fff; text-decoration: none; }
.notice-bar a:hover { text-decoration: underline; }
.tg-banner {
	display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
	margin-top: 28px; padding: 18px 22px; border-radius: var(--radius); background: #eef8fd; border: 1px solid #b9dcf0;
}
.tg-banner p { margin: 0; font-weight: 600; font-size: 1.05rem; }
.btn-tg, .btn-tg:hover { background: #0b6fa8; border-color: #0b6fa8; }
.btn-tg:hover { background: #095a88; border-color: #095a88; }
.share { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 24px; font-size: .92rem; }
.share span { color: var(--muted); font-weight: 600; }
.share a, .share button {
	padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
	color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.share a:hover, .share button:hover { border-color: var(--brand); color: var(--brand); }
.sticky-cta { display: none; }

/* ---------- Lo mejor de hoy, cupón y votos ---------- */
.top { margin-bottom: 34px; }
.top-list { list-style: none; counter-reset: top; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 0; padding: 0; }
.top-list li { counter-increment: top; }
.top-item {
	position: relative; display: grid; grid-template-columns: 64px 1fr; gap: 4px 12px; align-items: center; height: 100%;
	padding: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
	color: var(--ink); text-decoration: none;
}
.top-item:hover { border-color: var(--brand); color: var(--ink); }
.top-item::before {
	content: counter(top); position: absolute; top: -8px; left: -8px; display: grid; place-items: center;
	width: 26px; height: 26px; border-radius: 50%; background: var(--dark); color: #fff; font-size: .82rem; font-weight: 800;
}
.top-img { position: relative; grid-row: span 2; width: 64px; height: 64px; display: grid; place-items: center; }
.top-img img { width: 100%; height: 100%; object-fit: contain; }
.top-img .noimg { inset: 0; font-size: 1.4rem; }
.top-title { font-size: .9rem; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.top-price { display: flex; align-items: baseline; gap: 8px; }
.top-price .price { font-size: 1.1rem; }
.top-off { padding: 1px 8px; border-radius: 999px; background: var(--badge); color: var(--badge-text); font-size: .8rem; font-weight: 800; }
.badge-coupon { left: auto; right: 10px; background: var(--green); color: #fff; font-weight: 700; font-size: .78rem; }
.card-votes { margin-left: auto; font-weight: 600; }
.card-meta time { margin-left: 0; }
.vote {
	display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; padding: 9px 16px; cursor: pointer;
	border: 2px solid var(--green); border-radius: 999px; background: var(--card); color: var(--green); font: inherit; font-weight: 700;
}
.vote b { padding: 0 8px; border-radius: 999px; background: var(--green); color: #fff; }
.vote:hover, .vote.is-voted { background: var(--green); color: #fff; }
.vote:hover b, .vote.is-voted b { background: #fff; color: var(--green); }
.vote:disabled { cursor: default; }
.vote + .share { margin-top: 14px; }
.steps { list-style: none; counter-reset: step; margin: 1.5em 0; padding: 0; display: grid; gap: 14px; }
.steps li { counter-increment: step; position: relative; padding: 16px 18px 16px 62px; border: 1px solid var(--line); border-radius: var(--radius); background: #fcfcfd; }
.steps li::before {
	content: counter(step); position: absolute; left: 16px; top: 16px; display: grid; place-items: center;
	width: 32px; height: 32px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 800;
}
.steps strong { display: block; margin-bottom: 2px; }
.store-group { margin-top: 32px; }

/* ---------- Comentarios ---------- */
.comments { margin-top: 36px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(18px, 3vw, 32px); }
.comment-list { list-style: none; padding: 0; }
.comment-list .comment-body { padding-block: 14px; border-bottom: 1px solid var(--line); }
.comment-list .children { list-style: none; padding-left: 24px; }
.comment-meta { font-size: .86rem; color: var(--muted); }
.comment-author img { display: inline-block; border-radius: 50%; vertical-align: middle; margin-right: 8px; }
.comment-form label { display: block; font-weight: 600; margin-bottom: 4px; }
.comment-form input[type="text"], .comment-form input[type="email"], .comment-form input[type="url"], .comment-form textarea {
	width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 8px;
}
.comment-form .submit { padding: 11px 20px; border: 0; border-radius: 10px; background: var(--ink); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.comment-form-cookies-consent label { display: inline; font-weight: 400; }

/* ---------- Paginación ---------- */
.pagination { margin-top: 30px; }
.pagination ul { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 0; padding: 0; }
.pagination li .page-numbers {
	display: block; min-width: 42px; padding: 9px 13px; text-align: center; border: 1px solid var(--line);
	border-radius: 10px; background: var(--card); color: var(--ink); font-weight: 600; text-decoration: none;
}
.pagination li .page-numbers.current { background: var(--ink); border-color: var(--ink); color: #fff; }
.pagination li a.page-numbers:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Pie ---------- */
.site-footer { background: var(--dark); color: #cfd3dc; padding-block: 40px 24px; font-size: .93rem; }
.site-footer a { color: #fff; }
.footer-brand { color: #fff; margin-bottom: 6px; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 28px; }
.widget-title { font-weight: 700; color: #fff; margin-bottom: 8px; }
.footer-menu, .social { list-style: none; margin: 0; padding: 0; }
.footer-menu li { margin-bottom: 6px; }
.social { display: flex; gap: 14px; }
.footer-bottom { margin-top: 28px; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, .14); font-size: .84rem; color: #a9afbb; }
.affiliate-note { max-width: 95ch; }

/* ---------- Móvil ---------- */
@media (max-width: 860px) {
	.header-row { flex-wrap: wrap; }
	.brand { flex: 1; }
	.menu-toggle { display: block; order: 2; }
	.btn-telegram { display: none; }
	.search-form { order: 3; flex-basis: 100%; max-width: none; }
	.main-nav { display: none; }
	.main-nav.is-open { display: block; max-height: 70vh; overflow-y: auto; }
	.main-nav .menu { flex-direction: column; gap: 0; }
	.main-nav li { border-bottom: 1px solid var(--line); }
	.main-nav a { padding-right: 52px; }
	.main-nav ul ul, .main-nav ul ul ul { position: static; display: none; border: 0; box-shadow: none; padding-left: 14px; }
	.main-nav li:hover > ul, .main-nav li:focus-within > ul { display: none; }
	.main-nav li.is-open > ul { display: block; }
	.submenu-toggle { display: block; position: absolute; right: 0; top: 0; width: 46px; height: 44px; border: 0; background: none; cursor: pointer; }
	.submenu-toggle::before { content: "+"; font-size: 1.3rem; font-weight: 600; color: var(--ink); }
	.is-open > .submenu-toggle::before { content: "–"; }
	.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.card-body { padding: 10px; }
	.card-meta time { display: none; }
	.price { font-size: 1.15rem; }
	.deal-box { grid-template-columns: 1fr; padding: 14px; }
	.deal-media { max-width: 300px; margin-inline: auto; }
	.btn-lg { display: block; }
	.sticky-cta {
		display: flex; align-items: center; justify-content: space-between; gap: 12px;
		position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; padding: 10px 16px;
		background: var(--card); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px rgba(23, 26, 33, .1);
	}
	.sticky-cta .btn { flex: 1; max-width: 240px; margin-left: auto; }
	body.single-post { padding-bottom: 72px; }
	.tg-banner .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.card, .btn { transition: none; }
	.card:hover { transform: none; }
}

.entry-content p:empty { display: none; }
