/**
 * North Child Theme - Store Design Layer
 *
 * Capa de diseño modular para sistema tipográfico, WPBakery y mejoras globales
 *
 * @package North Child
 * @version 1.0.0
 * @date 2025-12-21
 */

/* ========================================
   1. VARIABLES CSS (DESIGN TOKENS)
   ======================================== */

:root {
  /* Espaciado base (8px system) */
  --space-xs: 0.25rem; /* 4px */
  --space-sm: 0.5rem; /* 8px */
  --space-md: 1rem; /* 16px */
  --space-lg: 1.5rem; /* 24px */
  --space-xl: 2rem; /* 32px */
  --space-2xl: 3rem; /* 48px */
  --space-3xl: 4rem; /* 64px */

  /* Colores (heredar del tema padre) */
  --primary-color: var(--thb-primary-color, #e74c3c);
  --secondary-color: var(--thb-secondary-color, #3498db);
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --error-color: #e74c3c;

  /* Tipografía */
  --text-primary: #333333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --text-inverse: #ffffff;

  /* Fondos */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-dark: #2c3e50;
  --border-color: #e0e0e0;
}

/* ========================================
   2. RESET WPBAKERY (Reducir gaps)
   ======================================== */

/* Rows - Reducir padding excesivo en móvil */
.vc_row {
  padding-top: var(--space-lg);
  padding-bottom: var(--space-lg);
}

.vc_row.vc_row-no-padding {
  padding-top: 0;
  padding-bottom: 0;
}

/* Aumentar padding en desktop */
@media (min-width: 768px) {
  .vc_row {
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .vc_row {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }
}

/* Columns - Fix gaps extraños */
.vc_column_container {
  padding-left: var(--space-sm);
  padding-right: var(--space-sm);
}

@media (min-width: 768px) {
  .vc_column_container {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }
}

/* Column inner - Spacing consistente */
.vc_column-inner {
  padding-top: 0;
  padding-bottom: 0;
}

/* Evitar doble padding en columns anidadas */
.vc_row .vc_row_inner {
  margin-left: calc(var(--space-sm) * -1);
  margin-right: calc(var(--space-sm) * -1);
}

/* ========================================
   3. TIPOGRAFÍA RESPONSIVE
   ======================================== */

/* H1 - Título principal de página */
h1,
.heading-1,
.hero-headline,
.page-title h1 {
  font-size: 1.75rem; /* 28px móvil */
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  h1,
  .heading-1,
  .hero-headline,
  .page-title h1 {
    font-size: 2.5rem; /* 40px desktop */
  }
}

/* H2 - Títulos de sección */
h2,
.heading-2,
.section-title,
.woocommerce-loop-category__title {
  font-size: 1.5rem; /* 24px móvil */
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: var(--space-lg); /* Aumentado para mejor respiración */
  color: var(--text-primary);
}

@media (min-width: 768px) {
  h2,
  .heading-2,
  .section-title {
    font-size: 2rem; /* 32px desktop */
  }
}

/* H3 - Subtítulos, nombres de producto */
h3,
.heading-3,
.product-title,
.woocommerce-loop-product__title {
  font-size: 1rem; /* 16px móvil - reducido para cards */
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

@media (min-width: 768px) {
  h3,
  .heading-3,
  .product-title {
    font-size: 1.25rem; /* 20px desktop */
  }
}

/* H4 - Títulos de subsección */
h4,
.heading-4 {
  font-size: 1.125rem; /* 18px */
  line-height: 1.4;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}

/* Body text */
p,
.body-text {
  font-size: 1rem; /* 16px - NO reducir en móvil */
  line-height: 1.6;
  margin-bottom: var(--space-md);
  color: var(--text-primary);
}

/* Small text */
small,
.body-small,
.caption {
  font-size: 0.875rem; /* 14px */
  line-height: 1.5;
  color: var(--text-secondary);
}

/* Links */
a {
  color: var(--primary-color);
  transition: color 0.2s ease;
}

a:hover {
  color: var(--secondary-color);
}

/* ========================================
   4. MEJORAS DE PRODUCT CARDS
   ======================================== */

/* NOTA: No sobrescribir grid del tema padre - solo mejoras visuales sutiles */

/* Product card hover effects (sin tocar layout) */
.product:hover,
.product-card:hover,
li.product:hover {
  border-color: var(--primary-color);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Título de producto - Mejorar tipografía sin overflow hidden global */
.woocommerce-loop-product__title,
.product-title h3,
.product-card__title {
  margin-bottom: var(--space-sm);
}

/* Precio - Mejorar visibilidad sin margin-top auto */
.price,
.woocommerce-Price-amount {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.price del {
  font-size: 1rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-right: var(--space-xs);
}

/* Imagen de producto */
.product-image,
.woocommerce-loop-product__link img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: var(--space-md);
  transition: transform 0.3s ease;
}

.product:hover .product-image,
.product:hover img {
  transform: scale(1.05);
}

/* Add to cart button en cards */
.add_to_cart_button,
.product_type_simple {
  margin-top: var(--space-sm);
  width: 100%;
  text-align: center;
}

/* ========================================
   5. TRUST ROW STYLES
   ======================================== */

/* Trust row container */
.product-trust-row,
.trust-row,
.homepage-trust .product-trust-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  padding: var(--space-lg) 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

@media (min-width: 640px) {
  .product-trust-row,
  .trust-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .product-trust-row,
  .trust-row {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

/* Trust item */
.trust-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
}

/* Trust icon */
.trust-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--primary-color);
}

.trust-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

/* Trust text */
.trust-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ========================================
   6. MOBILE FIXES WPBAKERY
   ======================================== */

@media (max-width: 767px) {
  /* Evitar overflow horizontal */
  body,
  .vc_row,
  .vc_row[data-vc-full-width] {
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* Stack columns correctamente */
  .vc_column_container {
    width: 100% !important;
    margin-bottom: var(--space-md);
  }

  .vc_column_container:last-child {
    margin-bottom: 0;
  }

  /* Touch targets mínimos */
  .button,
  a.button,
  input[type="submit"],
  .add_to_cart_button,
  .single_add_to_cart_button {
    min-height: 44px;
    min-width: 44px;
    padding: 0.875rem 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Texto legible sin zoom */
  body,
  p,
  .body-text {
    font-size: 1rem; /* 16px mínimo */
  }

  /* Reducir padding en móvil para más espacio */
  .vc_row {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  /* Imágenes responsive */
  img {
    max-width: 100%;
    height: auto;
  }

  /* Dejar que el tema padre maneje el grid - no forzar 1 columna */
}

/* ========================================
   7. PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Smooth scroll behavior (solo si soportado) */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Optimizar animaciones */
.product,
.product-card,
.button,
a.button {
  will-change: transform, box-shadow;
}

/* Focus states para accesibilidad */
:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Reducir motion para usuarios que lo prefieren */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ========================================
   8. HOME LANDING STYLES
   ======================================== */

/* === 8.0 GLOBAL HOME SECTION SPACING === */

/* Prevent horizontal overflow on all Home sections */
.home-hero-section,
.home-section-header,
.home-category-cards,
.home-bestsellers-section,
.home-trust-section,
.home-trust-row,
.home-faq-section,
.home-final-cta {
  overflow-x: hidden;
  max-width: 100%;
}

/* Ensure vertical spacing between Home sections */
body.page-id-191 .vc_row {
  margin-bottom: var(--space-lg);
}

body.page-id-191 .vc_row:last-child {
  margin-bottom: 0;
}

/* Consistent mobile padding reduction - SOLO EN HOME */
@media (max-width: 640px) {
  body.page-id-191 .vc_row {
    padding-left: var(--space-sm) !important;
    padding-right: var(--space-sm) !important;
    padding-top: var(--space-xl) !important;
    padding-bottom: var(--space-xl) !important;
  }

  .home-hero-section,
  .home-section-header,
  .home-category-cards,
  .home-bestsellers-section,
  .home-trust-section,
  .home-faq-section,
  .home-final-cta {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }
}

/* === 8.1 HERO SECTION === */

.home-hero-section {
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
  max-width: 900px;
  margin: 0 auto;
}

.home-hero-section .hero-title {
  font-size: 1.75rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-lg);
  color: inherit;
}

@media (min-width: 768px) {
  .home-hero-section .hero-title {
    font-size: 2.5rem;
  }
}

@media (min-width: 1024px) {
  .home-hero-section .hero-title {
    font-size: 3rem;
  }
}

.home-hero-section .hero-subtitle {
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: var(--space-2xl);
  color: inherit;
  opacity: 0.95;
}

@media (min-width: 768px) {
  .home-hero-section .hero-subtitle {
    font-size: 1.25rem;
  }
}

/* Hero CTA Group */
.hero-cta-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
}

@media (min-width: 640px) {
  .hero-cta-group {
    flex-direction: row;
    justify-content: center;
    gap: var(--space-lg);
  }
}

/* Hero Buttons */
.hero-cta-primary,
.hero-cta-secondary {
  display: inline-block;
  padding: 1rem 2.5rem;
  font-weight: 700;
  font-size: 1rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: all 0.3s ease;
  min-width: 220px;
  text-align: center;
  min-height: 44px;
  line-height: 1.5;
}

.hero-cta-primary {
  background: var(--primary-color);
  color: var(--text-inverse);
  border: 2px solid var(--primary-color);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hero-cta-primary:hover {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--text-inverse);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.hero-cta-secondary {
  background: transparent;
  color: inherit;
  border: 2px solid currentColor;
}

.hero-cta-secondary:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: var(--text-inverse);
  transform: translateY(-3px);
}

@media (max-width: 639px) {
  .hero-cta-primary,
  .hero-cta-secondary {
    width: 100%;
    max-width: 320px;
  }
}

/* === 8.2 CATEGORIES SECTION === */

.home-categories-section {
  padding: var(--space-2xl) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.home-section-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
}

.home-section-header .section-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.01em;
}

@media (min-width: 768px) {
  .home-section-header .section-title {
    font-size: 2.5rem;
  }
}

.home-section-header .section-subtitle {
  font-size: 1.125rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Category Cards Grid */
.home-category-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 768px) {
  .home-category-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.home-category-card {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  transition: all 0.3s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.home-category-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
  border-color: var(--primary-color);
}

.category-card-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background-color: var(--bg-secondary);
}

.category-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.home-category-card:hover .category-card-image img {
  transform: scale(1.08);
}

.category-card-content {
  padding: var(--space-xl);
  flex: 1;
  display: flex;
  flex-direction: column;
}

.category-card-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.category-card-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  flex: 1;
}

.category-card-link {
  display: inline-block;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.category-card-link:hover {
  color: var(--secondary-color);
  transform: translateX(4px);
}

/* === 8.3 BEST SELLERS SECTION === */

.home-bestsellers-section {
  padding: var(--space-2xl) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.home-bestsellers-section .products {
  margin-top: var(--space-xl);
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .home-bestsellers-section .products {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .home-bestsellers-section .products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* WooCommerce [products] shortcode with home-best-sellers class */
.home-best-sellers.products {
  display: grid !important;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

.home-best-sellers.products .product {
  margin: 0;
}

@media (min-width: 768px) {
  .home-best-sellers.products {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xl);
  }
}

@media (min-width: 1024px) {
  .home-best-sellers.products {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* === 8.4 TRUST SECTION === */

.home-trust-section {
  padding: var(--space-2xl) var(--space-md);
  max-width: 1200px;
  margin: 0 auto;
}

.home-trust-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

@media (min-width: 768px) {
  .home-trust-row {
    grid-template-columns: repeat(3, 1fr);
  }
}

.home-trust-row .trust-item {
  text-align: center;
  padding: var(--space-xl);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.home-trust-row .trust-item:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: var(--primary-color);
}

.home-trust-row .trust-icon {
  width: 48px;
  height: 48px;
  margin-bottom: var(--space-md);
  color: var(--primary-color);
}

.home-trust-row .trust-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.home-trust-row .trust-description {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* === 8.5 FAQ SECTION === */

.home-faq-section {
  padding: var(--space-2xl) var(--space-md);
  max-width: 900px;
  margin: 0 auto;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

.faq-item {
  background: var(--bg-primary);
  padding: var(--space-xl);
  border-radius: 8px;
  border-left: 4px solid var(--primary-color);
  transition: all 0.3s ease;
}

.faq-item:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transform: translateX(4px);
}

.faq-question {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1.4;
}

.faq-answer {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin: 0;
}

/* === 8.6 FINAL CTA SECTION === */

.home-final-cta {
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
  max-width: 800px;
  margin: 0 auto;
}

.final-cta-title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-md);
  letter-spacing: -0.01em;
  color: inherit;
}

@media (min-width: 768px) {
  .final-cta-title {
    font-size: 2.5rem;
  }
}

.final-cta-subtitle {
  font-size: 1.125rem;
  line-height: 1.6;
  margin-bottom: var(--space-2xl);
  color: inherit;
  opacity: 0.95;
}

.final-cta-button {
  display: inline-block;
  padding: 1.125rem 3rem;
  background: var(--bg-primary);
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1rem;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  min-height: 44px;
  line-height: 1.5;
}

.final-cta-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
  background: var(--text-inverse);
  color: var(--secondary-color);
}

@media (max-width: 767px) {
  .final-cta-button {
    display: block;
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
  }
}

/* === 8.7 MOBILE RESPONSIVE OVERRIDES === */

@media (max-width: 767px) {
  .home-hero-section,
  .home-section-header,
  .home-final-cta {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .home-section-header .section-title {
    font-size: 1.75rem;
  }

  .home-hero-section .hero-title {
    font-size: 1.75rem;
  }

  .category-card-content {
    padding: var(--space-lg);
  }

  .faq-item {
    padding: var(--space-lg);
  }

  .home-trust-row .trust-item {
    padding: var(--space-lg);
  }

  /* Evitar horizontal scroll */
  .home-hero-section,
  .home-categories-section,
  .home-bestsellers-section,
  .home-trust-section,
  .home-faq-section,
  .home-final-cta {
    overflow-x: hidden;
    max-width: 100vw;
  }
}

/* === North/THB hover image: force overlay instead of flow === */
ul.thb-main-products li.product .product_thumbnail.thb_hover {
  position: relative;
  overflow: hidden;
}

ul.thb-main-products li.product .product_thumbnail.thb_hover > a {
  position: relative;
  display: block;
}

ul.thb-main-products
  li.product
  .product_thumbnail.thb_hover
  .product_thumbnail_hover {
  position: absolute;
  inset: 0;
  z-index: 2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

ul.thb-main-products
  li.product
  .product_thumbnail.thb_hover
  .product_thumbnail_hover
  img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Ensure the main image is below */
ul.thb-main-products li.product .product_thumbnail.thb_hover > a > img {
  position: relative;
  z-index: 1;
  display: block;
}

/* Show hover image on hover */
ul.thb-main-products
  li.product
  .product_thumbnail.thb_hover:hover
  .product_thumbnail_hover {
  opacity: 1;
}
