/*
Theme Name: Aspiradoras Sin Cable
Theme URI: https://example.com/
Author: Tu nombre
Description: Tema de WordPress para un sitio de comparativas y guías de compra de aspiradoras sin cable. Hero con parallax, categorías y criterios editables desde el Personalizador.
Version: 1.4.3
Requires at least: 6.0
Tested up to: 6.6
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: aspiradoras-sin-cable
Tags: blog, two-columns, custom-menu, featured-images, custom-logo, translation-ready
*/

/*
 * Paleta tomada del logo (degradado lila → azul grisáceo → verde azulado).
 * --accent y --accent-2 son versiones más oscuras de esos tonos para que
 * el texto blanco de los botones y los enlaces cumplan contraste AA.
 */
:root {
  --bg: #faf8fc;
  --surface: #ffffff;
  --text: #2a2433;
  --muted: #6b6577;
  --accent: #7b4f9d;
  --accent-hover: #5f3a7d;
  --accent-2: #3d7a94;
  --border: #e8e2ee;
  --border-soft: #e6dcf1;
  --dark: #241d33;
  --soft: #f4eefa;

  /* Degradado exacto del logo (solo decorativo: líneas de cabecera y pie) */
  --grad-logo: linear-gradient(90deg, #b67ebb 0%, #8a84af 50%, #578aa0 100%);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  height: auto;
}

.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  width: 1px;
  word-wrap: normal;
}

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Cabecera */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  background: var(--grad-logo);
}

body.admin-bar .header {
  top: 32px;
}

@media (max-width: 782px) {
  body.admin-bar .header {
    top: 46px;
  }
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
  flex-wrap: wrap;
}

.logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--dark);
  letter-spacing: -0.02em;
}

.custom-logo-link img {
  max-height: 44px;
  width: auto;
  display: block;
}

.nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  list-style: none;
}

.nav li {
  list-style: none;
}

.nav a {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.nav a:hover,
.nav .current-menu-item > a {
  color: var(--accent);
}

/* Hero */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(135deg, var(--soft) 0%, #ffffff 100%);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 48px 36px;
  margin: 32px 0;
}

.hero.has-bg {
  padding: 72px 36px;
}

/* Imagen con parallax: sobresale un 20 % arriba y abajo para poder moverse */
.hero-bg,
.closing-bg {
  position: absolute;
  left: 0;
  right: 0;
  top: -20%;
  height: 140%;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  will-change: transform;
}

/* Velo claro para que el texto oscuro siga siendo legible */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.68) 45%, rgba(255, 255, 255, 0.12) 100%);
}

.hero-content {
  position: relative;
}

.hero h1 {
  font-size: 2.15rem;
  line-height: 1.2;
  color: var(--dark);
  max-width: 760px;
  margin-bottom: 14px;
  letter-spacing: -0.02em;
}

.hero p {
  color: var(--muted);
  max-width: 660px;
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.hero.has-bg p {
  color: var(--text);
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 8px;
  transition: background 0.2s ease;
  border: 0;
  cursor: pointer;
}

.btn:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.btn:focus-visible,
.nav a:focus-visible,
.post-link:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
}

/* Hero a todo el ancho de la pantalla (fuera del contenedor) */
.hero.hero-full {
  margin: 0;
  border-width: 0 0 1px 0;
  border-radius: 0;
  padding: 88px 0;
}

.hero.hero-full.has-bg {
  padding: 104px 0;
}

@media (max-width: 640px) {
  .hero.hero-full,
  .hero.hero-full.has-bg {
    padding: 56px 0;
  }
}

/* Marcas */
.brands {
  margin: 44px 0 52px;
  text-align: center;
}

.brands-title {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 22px;
}

.brands-list {
  --s: 1;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 20px 52px;
}

.brands-list img {
  display: block;
  width: auto;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.brands-list img:hover {
  opacity: 1;
}

/* Alturas ajustadas para que todos los logotipos pesen parecido */
.brand-dyson { height: calc(30px * var(--s)); }
.brand-xiaomi { height: calc(30px * var(--s)); }
.brand-philips { height: calc(23px * var(--s)); }
.brand-bosch { height: calc(32px * var(--s)); }
.brand-prettycare { height: calc(21px * var(--s)); }

@media (max-width: 640px) {
  .brands-list {
    --s: 0.78;
    gap: 18px 32px;
  }
}

/* Banner final a todo el ancho */
.closing {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  min-height: 480px;
  background: var(--dark);
  color: #ffffff;
}

.closing-bg {
  background-position: center 20%;
}

/* Velo oscuro por la derecha: ahí va el texto; las personas quedan libres a la izquierda */
.closing-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(270deg, rgba(36, 29, 51, 0.92) 0%, rgba(36, 29, 51, 0.78) 38%, rgba(36, 29, 51, 0) 68%);
}

.closing .container {
  width: 100%;
}

.closing-content {
  margin-left: auto;
  max-width: 460px;
  padding: 64px 0;
}

.closing h2 {
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: #ffffff;
  margin-bottom: 14px;
}

.closing p {
  color: #e7e2ef;
  font-size: 1.05rem;
  margin-bottom: 24px;
}

.closing .btn {
  background: #ffffff;
  color: var(--accent-hover);
}

.closing .btn:hover {
  background: var(--soft);
  color: var(--accent-hover);
}

@media (max-width: 800px) {
  .closing {
    align-items: flex-end;
    min-height: 560px;
  }
  .closing-overlay {
    background: linear-gradient(0deg, rgba(36, 29, 51, 0.95) 0%, rgba(36, 29, 51, 0.85) 45%, rgba(36, 29, 51, 0) 80%);
  }
  .closing-content {
    margin-left: 0;
    max-width: none;
    padding: 40px 0 44px;
  }
  .closing h2 {
    font-size: 1.6rem;
  }
}

/* Secciones */
.section {
  margin-bottom: 48px;
}

.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: 20px;
}

/* Rejilla */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

/* Categorías */
.cat-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  padding: 22px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.cat-card:nth-child(2) {
  border-top-color: #8a84af;
}

.cat-card:nth-child(3) {
  border-top-color: var(--accent-2);
}

.cat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(60, 40, 90, 0.08);
}

.cat-card h3 {
  font-size: 1.1rem;
  color: var(--dark);
  margin-bottom: 8px;
}

.cat-card p {
  font-size: 0.92rem;
  color: var(--muted);
}

/* Artículos */
.post-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(60, 40, 90, 0.1);
}

.post-thumb {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--soft);
  display: block;
}

/* Foto de producto tomada del contenido: se ve entera, centrada y sin deformar */
.post-thumb--contain {
  object-fit: contain;
  object-position: center;
  background: #ffffff;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.post-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.post-tag {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 8px;
}

.post-title {
  font-size: 1.12rem;
  line-height: 1.35;
  color: var(--dark);
  margin-bottom: 10px;
}

.post-excerpt {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 16px;
  flex-grow: 1;
}

.post-link {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent);
}

.section-more {
  margin-top: 24px;
  text-align: center;
}

/* Criterios */
.criteria-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px;
}

.criterion {
  text-align: center;
}

.criterion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  color: var(--accent);
  background: var(--soft);
  border-radius: 50%;
  margin-bottom: 12px;
}

.criterion-icon .icon {
  width: 26px;
  height: 26px;
}

.criterion:nth-child(2) .criterion-icon {
  color: #5f6a9c;
}

.criterion:nth-child(3) .criterion-icon {
  color: var(--accent-2);
}

.criterion h3 {
  color: var(--dark);
  margin-bottom: 6px;
}

.criterion p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* Testimonios */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.testimonial {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.stars {
  color: #e0a100;
  font-size: 1.15rem;
  letter-spacing: 0.12em;
  margin-bottom: 12px;
}

.testimonial-text {
  color: var(--text);
  font-size: 1rem;
  flex-grow: 1;
  margin-bottom: 20px;
}

.testimonial-author {
  display: flex;
  align-items: center;
  gap: 14px;
}

.testimonial-photo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--soft);
}

.testimonial-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.05rem;
  color: #ffffff;
  background: var(--accent);
}

.testimonial:nth-child(2) .testimonial-initials {
  background: #5f6a9c;
}

.testimonial:nth-child(3) .testimonial-initials {
  background: var(--accent-2);
}

.testimonial:nth-child(4) .testimonial-initials {
  background: #8a4f9e;
}

.testimonial-name {
  font-weight: 700;
  color: var(--dark);
}

@media (max-width: 720px) {
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Páginas interiores */
.page-header {
  margin: 32px 0 24px;
}

.page-header h1 {
  font-size: 1.9rem;
  color: var(--dark);
  letter-spacing: -0.02em;
}

.page-header .archive-description {
  color: var(--muted);
  margin-top: 8px;
}

.entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px;
  margin: 32px auto 48px;
  max-width: 820px;
}

.entry-title {
  font-size: 2rem;
  line-height: 1.25;
  color: var(--dark);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.entry-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 22px;
}

.entry-thumb {
  margin-bottom: 24px;
}

.entry-thumb img {
  width: 100%;
  border-radius: 10px;
  display: block;
}

.entry-content > * + * {
  margin-top: 1.1em;
}

.entry-content h2,
.entry-content h3,
.entry-content h4 {
  color: var(--dark);
  line-height: 1.3;
  margin-top: 1.6em;
}

.entry-content h2 { font-size: 1.5rem; }
.entry-content h3 { font-size: 1.2rem; }

.entry-content a {
  color: var(--accent);
  text-decoration: underline;
}

.entry-content a:hover {
  color: var(--accent-hover);
}

.entry-content ul,
.entry-content ol {
  padding-left: 1.4em;
}

.entry-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.entry-content th,
.entry-content td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.entry-content th {
  background: var(--soft);
}

.entry-content blockquote {
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
}

.entry-footer {
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}

/* Anterior / siguiente: dos tarjetas con imagen y título */
.post-navigation {
  max-width: 820px;
  margin: -16px auto 56px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.nav-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(60, 40, 90, 0.1);
}

.nav-card .post-thumb {
  height: 150px;
}

.nav-card:focus-visible {
  outline: 3px solid var(--accent-2);
  outline-offset: 3px;
}

.nav-body {
  display: block;
  padding: 16px 18px 18px;
}

.nav-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent);
  margin-bottom: 6px;
}

.nav-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--dark);
}

.nav-next {
  text-align: right;
}

/* Si solo hay "siguiente", se queda a la derecha */
.nav-next:only-child {
  grid-column: 2;
}

@media (max-width: 640px) {
  .post-navigation {
    grid-template-columns: 1fr;
  }
  .nav-next:only-child {
    grid-column: auto;
  }
}

/* Paginación */
.pagination {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 48px;
}

.pagination .page-numbers {
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
}

.pagination .page-numbers.current,
.pagination .page-numbers:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

/* Buscador */
.search-form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.search-form input[type="search"] {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
}

/* Footer */
.footer {
  position: relative;
  background: var(--dark);
  color: #b9b2c7;
  padding: 36px 0;
  font-size: 0.88rem;
}

.footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: var(--grad-logo);
}

.footer-note {
  margin-top: 10px;
  font-size: 0.8rem;
  color: #9a93ab;
}

@media (max-width: 640px) {
  .hero {
    padding: 32px 20px;
  }
  .hero.has-bg {
    padding: 48px 20px;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .entry {
    padding: 22px 18px;
  }
  .entry-title {
    font-size: 1.55rem;
  }
}

/* Sin parallax si el usuario prefiere menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .hero-bg,
  .closing-bg {
    top: 0;
    height: 100%;
    transform: none !important;
    will-change: auto;
  }
  .cat-card,
  .post-card,
  .nav-card,
  .btn {
    transition: none;
  }
}
