/*
 * Cama Gato — Responsive CSS
 * Mobile-first breakpoints for all components.
 *
 * Breakpoints:
 *   xs  < 480px
 *   sm  < 640px
 *   md  < 768px
 *   lg  < 1024px
 *   xl  < 1280px
 */

/* ============================================================
   LARGE SCREENS — max 1280px
   ============================================================ */
@media (max-width: 1280px) {
  .container {
    max-width: 1100px;
  }
  .hero .container {
    gap: 3rem;
  }
  .hero__title {
    font-size: 2.75rem;
  }
}

/* ============================================================
   DESKTOP / TABLET — max 1024px
   ============================================================ */
@media (max-width: 1024px) {
  :root {
    --header-height: 65px;
  }

  /* Header */
  .primary-nav { display: none; }
  .menu-toggle { display: flex; }
  .mobile-nav  { display: block; }
  .header-cta .btn { display: none; }

  /* Hero */
  .hero .container {
    grid-template-columns: 1fr;
    gap: 3rem;
    text-align: center;
  }
  .hero__content {
    order: 2;
  }
  .hero__image {
    order: 1;
    max-width: 480px;
    margin-inline: auto;
  }
  .hero__actions {
    justify-content: center;
  }
  .hero__stats {
    justify-content: center;
  }
  .hero__subtitle {
    max-width: 600px;
    margin-inline: auto;
  }
  .hero {
    min-height: auto;
    padding-block: 5rem 6rem;
  }
  .hero::after {
    height: 50px;
  }

  /* Products grid — 2 columns on tablet */
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Features */
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  /* Product single */
  .product-single .container {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
  .product-single__image {
    position: static;
    max-width: 480px;
    margin-inline: auto;
  }

  /* Sidebar layout */
  .layout-sidebar {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
  .sidebar .widget { margin-bottom: 0; }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
  }
  .footer-brand {
    grid-column: 1 / -1;
  }

  /* Pros cons */
  .pros-cons {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   TABLET — max 768px
   ============================================================ */
@media (max-width: 768px) {

  /* Typography scale-down */
  h1 { font-size: 1.875rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.25rem; }

  .section {
    padding-block: 3.5rem;
  }
  .section--lg {
    padding-block: 4rem;
  }

  /* Hero */
  .hero__title {
    font-size: clamp(1.75rem, 5vw, 2.25rem);
  }
  .hero__badge {
    font-size: 0.8rem;
  }
  .hero__stats {
    gap: 1.5rem;
  }
  .hero__actions .btn--lg {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }

  /* Products — single column on small tablet */
  .products-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-inline: auto;
  }

  /* Grid overrides */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  /* Features — single column */
  .features-grid {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-inline: auto;
  }
  .feature-card {
    display: flex;
    text-align: left;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem;
  }
  .feature-card__icon {
    margin: 0;
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    font-size: 1.5rem;
  }

  /* Newsletter */
  .newsletter-form {
    flex-direction: column;
  }
  .newsletter-form input[type="email"] {
    width: 100%;
  }
  .newsletter__title {
    font-size: 1.75rem;
  }

  /* Page header */
  .page-header {
    padding-block: 3rem;
  }
  .page-header__title {
    font-size: 1.875rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }
  .footer-brand { grid-column: auto; }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: 0.75rem;
  }
  .footer-widgets {
    grid-template-columns: 1fr;
  }
  .sidebar {
    grid-template-columns: 1fr;
  }

  /* Section header */
  .section-title { font-size: 1.75rem; }
  .section-subtitle { font-size: 1rem; }

  /* Breadcrumbs */
  .breadcrumbs {
    font-size: 0.8rem;
  }

  /* Post card */
  .post-card__title { font-size: 1.125rem; }
}

/* ============================================================
   MOBILE — max 640px
   ============================================================ */
@media (max-width: 640px) {
  :root {
    --grid-gap: 1.25rem;
    --header-height: 60px;
  }

  .container {
    padding-inline: 1rem;
  }

  /* Header logo */
  .site-logo__tagline { display: none; }
  .site-logo__icon { width: 36px; height: 36px; font-size: 1.1rem; }
  .site-logo__name { font-size: 1rem; }

  /* Hero */
  .hero {
    padding-block: 3.5rem 5rem;
  }
  .hero__title {
    font-size: clamp(1.5rem, 6vw, 2rem);
  }
  .hero__subtitle {
    font-size: 0.95rem;
  }
  .hero__stat-number { font-size: 1.5rem; }
  .hero__actions {
    flex-direction: column;
    align-items: center;
  }
  .hero__actions .btn {
    width: 100%;
    max-width: 320px;
  }
  .hero__image-wrapper {
    border-radius: 0.75rem;
  }
  .hero__image-badge {
    display: none; /* Hidden on very small screens */
  }

  /* Buttons */
  .btn-amazon { font-size: 0.9rem; padding: 0.75rem 1.25rem; }
  .btn-amazon--lg { font-size: 1rem; padding: 0.875rem 1.5rem; }
  .btn--lg { padding: 0.875rem 1.5rem; font-size: 0.95rem; }

  /* Product single */
  .product-single__price-block {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .product-single__cta {
    flex-direction: column;
  }
  .product-single__cta .btn,
  .product-single__cta .btn-amazon {
    width: 100%;
    justify-content: center;
  }

  /* Por debajo de 900 px la tabla se muestra en fichas apiladas (style.css),
     así que aquí no debe imponerse ninguna anchura mínima: esta hoja se carga
     después y su min-width anulaba el basculamiento. */

  /* Error 404 */
  .error-404__code { font-size: 6rem; }
  .error-404__title { font-size: 1.5rem; }
  .error-404__actions { flex-direction: column; align-items: center; }
  .error-404__actions .btn { width: 100%; max-width: 320px; }

  /* Post navigation */
  .post-navigation {
    grid-template-columns: 1fr !important;
  }

  /* Amazon disclaimer */
  .amazon-disclaimer {
    font-size: 0.8rem;
  }

  /* Newsletter */
  .newsletter-section {
    padding-block: 3rem;
  }

  /* Pagination */
  .page-numbers {
    width: 38px;
    height: 38px;
    font-size: 0.8rem;
  }

  /* Widget */
  .widget {
    padding: 1.25rem;
  }
}

/* ============================================================
   EXTRA SMALL — max 480px
   ============================================================ */
@media (max-width: 480px) {
  .hero__stats { gap: 1rem; }
  .hero__stat-number { font-size: 1.25rem; }

  .section-title { font-size: 1.5rem; }

  .feature-card {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  .feature-card__icon {
    margin: 0 auto;
  }

  .product-card__body { padding: 1rem; }
  .product-card__footer { padding: 0.75rem 1rem 1rem; }

  /* Footer brand */
  .footer-disclaimer {
    font-size: 0.75rem;
  }
  .footer-bottom__links {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
  }

  /* Mobile nav font size */
  .mobile-nav ul li a {
    font-size: 1.1rem;
    padding: 0.875rem 1rem;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .site-header,
  .site-footer,
  .mobile-nav,
  .newsletter-section,
  .hero__actions,
  .btn-amazon,
  .sidebar,
  #menu-toggle-check,
  .menu-toggle {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }

  .product-single .container {
    display: block;
  }

  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }

  .btn-amazon[href]::after,
  a.btn[href]::after {
    content: '';
  }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   HIGH CONTRAST MODE
   ============================================================ */
@media (forced-colors: active) {
  .btn--primary,
  .btn-amazon {
    border: 2px solid ButtonText;
  }
  .product-card {
    border: 1px solid ButtonText;
  }
}
