/* =========================================================
   THERMO ENGINE — Responsive
   Escritorio grande → laptop (1180) → tablet (1024 / 900 con menú
   hamburguesa) → tablet chica (720) → celular (560) → celular pequeño (380)
   ========================================================= */

/* ---------- Laptop ---------- */
@media (max-width: 1180px) {
  .hero__layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .site-header__login span { display: none; }
  .main-nav__link { padding: .5rem .65rem; }
}

/* ---------- Tablet grande ---------- */
@media (max-width: 1024px) {
  .hero__layout { grid-template-columns: 1fr; gap: 2rem; }
  .hero__panel { max-width: 560px; }
  .hero__content { max-width: 720px; }

  .categories__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: 230px; }
  .category-card:first-child { grid-column: span 3; grid-row: span 1; }
  .category-card:first-child .category-card__content { padding: 1.75rem; }

  .services__grid { grid-template-columns: repeat(2, 1fr); }
  .service-card:nth-child(4n) { border-right: 1px solid var(--color-line); }
  .service-card:nth-child(2n) { border-right: none; }
  .service-card:nth-child(n+5) { border-bottom: 1px solid var(--color-line); }
  .service-card:nth-child(n+7) { border-bottom: none; }

  .why-us__grid { grid-template-columns: 1fr; }
  .process__steps { grid-template-columns: repeat(2, 1fr); row-gap: 2.5rem; }
  .process__step:nth-child(2)::before { display: none; }
  .brands .container { grid-template-columns: 1fr; gap: 1rem; text-align: center; }
  .applications .container { grid-template-columns: 1fr; }
  .faq > .container { grid-template-columns: 1fr; }
  .faq .section-heading { position: static; margin-bottom: 1.5rem; }
  .final-cta__inner { grid-template-columns: 1fr; row-gap: 1.75rem; }
  .final-cta__actions { grid-column: 1; grid-row: auto; flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .final-cta__actions .btn { width: auto; flex: 1 1 220px; }

  .testimonials__grid { grid-template-columns: repeat(2, 1fr); }
  .products-grid, .catalog .products-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mvv__grid, .team__grid, .partners__grid { grid-template-columns: repeat(2, 1fr); }
  .product-detail__tabs { grid-template-columns: 1fr; }
  .catalog__layout { grid-template-columns: 220px minmax(0, 1fr); }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Menú hamburguesa ---------- */
@media (max-width: 900px) {
  .main-nav { display: none; }
  .hamburger { display: flex; }
  .site-header__actions .btn--primary.btn--small { display: none; }
  .site-header__auth { display: none; }
  .site-header__actions { gap: 0; }

  .about-summary__grid,
  .history__grid,
  .infrastructure__grid,
  .coverage__grid,
  .service-detail,
  .service-detail--reverse,
  .category-intro__grid,
  .product-detail__grid,
  .product-inquiry__grid,
  .contact__grid { grid-template-columns: 1fr; }
  .service-detail--reverse { direction: ltr; }
  .service-detail__media { order: -1; }
  .about-summary__media img { max-height: 460px; }
  .about-summary__media::before { left: -8px; bottom: -8px; }

  /* Filtros del catálogo: pasan arriba y las opciones se vuelven "chips" fáciles de tocar */
  .catalog__layout { grid-template-columns: 1fr; }
  .catalog__filters { position: static; padding: 1.1rem; gap: 1rem; }
  .filter-group { display: block; }
  .filter-group h2 { margin-bottom: .6rem; }
  .filter-group label {
    display: inline-flex; margin: 0 .4rem .5rem 0; padding: .5rem .9rem; border: 1.5px solid var(--color-border);
    border-radius: 999px; background: var(--te-white); color: var(--te-navy-dark); font-size: .92rem;
    transition: background .2s ease, border-color .2s ease, color .2s ease;
  }
  .filter-group label input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
  .filter-group label:has(input:checked) { background: var(--te-navy-dark); border-color: var(--te-navy-dark); color: var(--te-white); }
  .filter-group label:has(input:focus-visible) { outline: 3px solid var(--te-cyan); outline-offset: 2px; }
  #parts-clear-filters { align-self: flex-start; }
  .catalog__filters-toggle {
    display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 48px; padding: 0 1rem;
    border: 1.5px solid var(--color-border); border-radius: var(--radius-sm); background: var(--te-white);
    font-weight: 600; color: var(--te-navy-dark);
  }
  .catalog__filters-toggle svg { transition: transform .3s var(--ease-out); }
  .catalog__filters.is-open .catalog__filters-toggle svg { transform: rotate(180deg); }
  .catalog__filters:not(.is-open) > :not(form):not(.catalog__filters-toggle) { display: none; }

  .contact__map iframe { min-height: 320px; }
  .product-info__specs { grid-template-columns: 1fr 1fr; }

  /* Barra de acciones rápidas: siempre al alcance del pulgar */
  body { padding-bottom: 76px; }
  .mobile-bar {
    display: grid; grid-template-columns: auto auto minmax(0,1fr); gap: .5rem;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 450;
    padding: .6rem .75rem calc(.6rem + env(safe-area-inset-bottom));
    background: rgba(10,32,53,.97); border-top: 1px solid rgba(255,255,255,.1);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  }
  .mobile-bar a {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 48px; padding: 0 .5rem;
    border-radius: var(--radius-sm); font-size: .95rem; font-weight: 600; color: var(--te-white);
    border: 1.5px solid rgba(255,255,255,.25); transition: background .2s ease; white-space: nowrap;
  }
  .mobile-bar a:active { background: rgba(255,255,255,.12); }
  .mobile-bar__wa { background: #25D366; border-color: #25D366; color: #06331a; }
  .mobile-bar__quote { background: var(--te-cyan); border-color: var(--te-cyan); color: var(--te-navy-dark); }
  .mobile-bar svg { flex-shrink: 0; }
  .whatsapp-float { display: none; }
  .back-to-top { right: 1rem; bottom: 6rem; }
  .cookie-banner { bottom: 5.6rem; }
}

/* ---------- Tablet chica ---------- */
@media (max-width: 720px) {
  .hero__panel-steps li { grid-template-columns: 6.4rem 1fr; }

  /* Categorías: carrusel horizontal con "imán" (se ve la siguiente tarjeta y se desliza) */
  .categories__grid {
    display: flex; gap: .85rem; overflow-x: auto; scroll-snap-type: x mandatory;
    margin-left: -1.1rem; margin-right: -1.1rem; padding: 0 1.1rem 1.4rem;
    scrollbar-width: none; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  }
  .categories__grid::-webkit-scrollbar { display: none; }
  .category-card, .category-card:first-child { flex: 0 0 78%; max-width: 340px; height: 320px; scroll-snap-align: center; grid-column: auto; grid-row: auto; }
  .category-card:first-child .category-card__content { padding: 1.4rem; }
  .category-card:first-child .category-card__title { font-size: 1.5rem; }
  .category-card:hover { transform: none; }

  .testimonials__grid { grid-template-columns: 1fr; }
  .mvv__grid, .team__grid { grid-template-columns: 1fr; }
  .brands__grid { grid-template-columns: repeat(2, 1fr); }
  .brand-card { border-left: none; border-top: 1px solid var(--color-line); }
  .brand-card:nth-child(-n+2) { border-top: none; }
  .brand-card:nth-child(even) { border-left: 1px solid var(--color-line); }
  .applications__grid li { font-size: 1rem; padding: .75rem 1.1rem; }
}

/* ---------- Celular ---------- */
@media (max-width: 640px) {
  :root { --header-height: 66px; --space-lg: 2.25rem; }
  body { font-size: 1rem; }
  .container { padding: 0 1.1rem; }

  .site-header__logo img { height: 36px; max-width: 130px; }
  .site-footer__brand img { height: 38px; }

  .hero { min-height: 0; }
  .hero__layout { padding-top: calc(var(--header-height) + 1.75rem); gap: 1.5rem; }
  .hero__brand { gap: 1rem; }
  .hero__brand-logo { width: 96px; }
  .hero__brand-name { font-size: clamp(1.9rem, 10.5vw, 2.6rem); letter-spacing: .04em; line-height: 1; }
  .hero__brand-name span { display: block; }
  .hero__brand-text .hero__tag { margin-top: .7rem; padding-top: .7rem; font-size: .82rem; }
  .hero__tag span + span::before { margin: 0 .55rem; }
  .hero__display-line { font-size: clamp(2.3rem, 11.5vw, 3.2rem); }
  .hero__display-sub { font-size: 1.2rem; }
  .hero__actions { flex-direction: column; align-items: stretch; }
  .hero__actions .btn { width: 100%; }
  .hero__gauge { display: none; }
  .hero__scroll-cue { display: none; }
  .hero__panel { padding: 1.25rem; border-radius: var(--radius-md); }
  .genuine-parts__inner { flex-direction: column; text-align: center; gap: .9rem; }

  .services__grid { grid-template-columns: 1fr; border-radius: var(--radius-md); }
  .service-card, .service-card:nth-child(n) { border-right: none; border-bottom: 1px solid var(--color-line); padding: 1.5rem 1.35rem; }
  .service-card:last-child { border-bottom: none; }
  .service-card__icon { width: 48px; height: 48px; margin-bottom: .9rem; }

  .why-us__stats { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 1.2rem .75rem 1.2rem 0; }
  .stat-card:nth-child(even) { padding-left: 1rem; }
  .why-us__insight { padding-left: 1.1rem; }

  /* Proceso: línea vertical a la izquierda, un paso debajo del otro */
  .process__steps { grid-template-columns: 1fr; row-gap: 0; }
  .process__step { padding: 0 0 2rem 4rem; min-height: 0; }
  .process__step:last-child { padding-bottom: 0; }
  .process__step::before, .process__step:nth-child(2)::before { display: block; top: 46px; bottom: 0; left: 22px; right: auto; width: 2px; height: auto; background: linear-gradient(180deg, var(--te-cyan), rgba(57,199,244,.2)); }
  .process__step:last-child::before { display: none; }
  .process__number { width: 44px; height: 44px; }

  .products-grid, .catalog .products-grid { grid-template-columns: 1fr; }
  .partners__grid { grid-template-columns: 1fr; }
  .panel-summary { grid-template-columns: 1fr 1fr; }
  .panel-quote-card { flex-direction: column; }
  .panel-quote-card__actions { align-items: stretch; }

  .product-info__specs { grid-template-columns: 1fr; gap: .6rem; }
  .product-detail__grid { gap: var(--space-md); }
  .catalog__toolbar { align-items: flex-start; }

  .final-cta__actions { flex-direction: column; }
  .final-cta__actions .btn { width: 100%; flex: none; }

  .site-footer__grid { grid-template-columns: 1fr; gap: 2rem; text-align: left; }
  .site-footer__bottom-inner { flex-direction: column; align-items: flex-start; }

  .form-grid { grid-template-columns: 1fr; }
  .contact-form, .quote-form { padding: 1.25rem; }
  .contact__actions .btn { flex: 1 1 100%; }

  .part-modal { padding: .75rem; }
  .part-modal__panel { grid-template-columns: 1fr; max-height: 92vh; }
  .part-modal__gallery { min-height: 230px; padding: 1.25rem; }
  .part-modal__gallery img { max-height: 230px; }
  .part-modal__info { padding: 1.4rem 1.25rem 1.5rem; }
  .part-modal__info .btn { align-self: stretch; }

  .cookie-banner { flex-direction: column; align-items: stretch; left: .75rem; right: .75rem; width: auto; max-width: none; }
  .cookie-banner__actions { width: 100%; }
  .cookie-banner__actions .btn { flex: 1; }
  .legal-page__table { display: block; overflow-x: auto; }
  .faq-item p { padding-right: 0; }
  .timeline__item { flex-direction: column; gap: .3rem; }
}

/* ---------- Celular pequeño ---------- */
@media (max-width: 380px) {
  .section-title { font-size: 1.6rem; }
  .btn { padding: .75rem 1.1rem; font-size: .92rem; }
  .btn--large { padding: .9rem 1.2rem; }
  .category-card, .category-card:first-child { flex-basis: 86%; }
  .mobile-bar a { font-size: .88rem; gap: .3rem; }
  .why-us__stats { grid-template-columns: 1fr; }
  .stat-card:nth-child(even) { padding-left: 0; }
}

/* ---------- Pantallas muy grandes: más aire, mismo orden ---------- */
@media (min-width: 1600px) {
  :root { --container-width: 1360px; }
}

/* ---------- Evitar desbordamiento horizontal global ---------- */
html, body { overflow-x: clip; }
