/**
 * Racine Vita — affichage responsive
 * Chargée en dernier. Unifie le rendu téléphone / tablette / ordinateur
 * sans casser le style élégant (forêt, crème, titraille).
 */

/* ============================================================
   0. Fondations
   ============================================================ */
html {
  overflow-x: clip;
}

body {
  overflow-x: clip;
  min-width: 0;
}

img,
video,
iframe,
svg {
  max-width: 100%;
  height: auto;
}

.container,
.header-inner,
.catalog-layout,
.footer-grid {
  min-width: 0;
}

input,
select,
textarea,
button {
  max-width: 100%;
}

input,
select,
textarea {
  font-size: 16px;
}

.theme-toggle,
.favorites-header-btn,
.menu-toggle,
.hero-mosaic-arrow,
.catalog-filters-toggle,
.product-favorite-btn {
  min-height: 44px;
  min-width: 44px;
}

/* ============================================================
   1. Header — zone critique 992–1199 px
   ============================================================ */
.header-inner {
  flex-direction: row !important;
  flex-wrap: nowrap;
  align-items: center !important;
  min-width: 0;
  gap: clamp(8px, 1.2vw, 18px);
}

.header .nav-menu {
  width: auto;
  max-width: none;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

.header-search {
  flex: 0 1 220px;
  min-width: 0;
  max-width: 240px;
}

@media (max-width: 1199px) {
  .header .nav-menu {
    width: auto !important;
    gap: 10px !important;
  }

  .header .nav-link,
  .header .nav-menu .nav-link {
    font-size: 11.5px;
    letter-spacing: 0.08em;
    min-width: 0;
    padding: 8px 2px;
  }

  .header-search {
    max-width: 168px;
    flex-basis: 148px;
  }

  .header-search-input {
    font-size: 12px;
    padding: 0 10px;
  }
}

@media (max-width: 991px) {
  .header-search {
    display: none;
  }

  .logo-icon img {
    max-width: min(168px, 42vw);
  }
}

/* ============================================================
   2. Accueil
   ============================================================ */
body.page-home .hero-mosaic-slider {
  height: clamp(200px, 42vw, 720px);
}

@media (max-width: 768px) {
  body.page-home .hero-mosaic-slider {
    height: clamp(200px, 52vw, 360px);
  }

  body.page-home .hero-mosaic-arrow {
    width: 40px;
    height: 40px;
    min-width: 40px;
  }

  body.page-home .hero-mosaic-arrow--prev {
    left: 8px;
  }

  body.page-home .hero-mosaic-arrow--next {
    right: 8px;
  }

  .home-intro {
    padding: 48px 0 8px;
  }

  .home-intro__title {
    font-size: clamp(1.85rem, 8.4vw, 2.6rem);
    max-width: none;
  }

  .home-intro__lead {
    font-size: 1.05rem;
    padding: 0 4px;
  }

  body.page-home .featured-products-grid,
  body.page-home .featured-products-grid--three {
    grid-template-columns: 1fr;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  body.page-home .categories-row {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
    gap: 12px;
    padding: 0;
  }

  body.page-home .categories-row__card {
    flex: none;
    flex-basis: auto;
    min-width: 0;
    width: auto;
  }

  body.page-home .categories-row__cta {
    opacity: 1;
    transform: none;
  }

  body.page-home .home-experience-grid {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .home-promo-bar p {
    font-size: 10px;
    letter-spacing: 0.08em;
    line-height: 1.45;
  }
}

@media (min-width: 768px) and (max-width: 991px) {
  body.page-home .featured-products-grid,
  body.page-home .featured-products-grid--three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }

  body.page-home .featured-products-grid--three .featured-product-card:last-child {
    grid-column: 1 / -1;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
  }

  body.page-home .home-experience-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-width: none;
  }
}

@media (min-width: 992px) and (max-width: 1199px) {
  body.page-home .featured-products-grid,
  body.page-home .featured-products-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ingredients-track-wrap {
  scroll-padding-inline: 20px;
}

.ingredients-track {
  padding-inline: clamp(16px, 4vw, 32px);
}

/* ============================================================
   3. Catalogue
   ============================================================ */
body.page-products .products-catalog-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.page-products .products-catalog-grid .product-card {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
}

@media (max-width: 1199px) {
  body.page-products .products-catalog-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 16px;
  }
}

@media (max-width: 991px) {
  body.page-products .products-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 14px;
  }

  body.page-products .products-catalog-grid .product-image {
    min-height: 0;
  }

  body.page-products .products-catalog-grid .product-image img {
    transform: scale(1.38);
    transform-origin: 36% 66%;
  }

  body.page-products .products-catalog-grid .product-card:hover .product-image img,
  body.page-products .products-catalog-grid .product-image:hover img {
    transform: scale(1.46);
  }

  body.page-products .product-name {
    font-size: 1.05rem;
  }

  body.page-products .product-info {
    padding: 12px 4px 8px;
  }
}

@media (max-width: 599px) {
  body.page-products .products-catalog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  body.page-products .product-name {
    font-size: 0.95rem;
  }

  body.page-products .product-price {
    font-size: 14px;
  }

  body.page-products .product-btn {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
  }
}

@media (max-width: 339px) {
  body.page-products .products-catalog-grid {
    grid-template-columns: 1fr !important;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* ============================================================
   4. Modale produit
   ============================================================ */
.product-modal-content {
  max-width: min(1000px, calc(100vw - 24px));
  width: calc(100% - 24px);
  max-height: min(90vh, 100dvh - 24px);
}

@media (max-width: 767px) {
  .product-modal-grid {
    grid-template-columns: 1fr !important;
  }

  .product-modal-image {
    min-height: 0;
    height: min(42vh, 320px);
  }

  .product-modal-info {
    padding: 22px 18px 28px;
  }

  .product-modal-title {
    font-size: clamp(1.4rem, 6vw, 1.9rem);
  }

  .product-modal-actions {
    flex-direction: column;
  }

  .product-modal-actions .btn {
    width: 100%;
  }
}

/* ============================================================
   5. Contact + pages internes
   ============================================================ */
.contact-info-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 992px) {
  .contact-info-cards {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 479px) {
  .contact-info-cards {
    grid-template-columns: 1fr;
  }

  .contact-info-card {
    padding: 24px 18px;
  }
}

body.page-contact .contact-grid,
.contact-section .contact-form-wrapper {
  max-width: min(720px, 100%);
}

.inst-values,
.inst-certs,
.inst-why,
.inst-perks,
.inst-metrics .container {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 992px) {
  .inst-values,
  .inst-certs,
  .inst-metrics .container {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 639px) {
  .inst-values,
  .inst-certs,
  .inst-why,
  .inst-perks,
  .inst-duo,
  .inst-metrics .container {
    grid-template-columns: 1fr;
  }

  .inst-pagehead__title {
    font-size: clamp(1.9rem, 8vw, 2.6rem);
  }
}

.page-title,
.inst-pagehead__title,
.home-intro__title,
.product-name {
  overflow-wrap: break-word;
}

/* ============================================================
   6. Footer
   ============================================================ */
@media (max-width: 991px) {
  .footer.footer-premium .footer-grid,
  .footer.footer-premium.footer-unified .footer-grid {
    grid-template-columns: 1fr 1fr !important;
  }

  .footer.footer-premium .footer-column--brand,
  .footer.footer-premium.footer-unified .footer-column--brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 575px) {
  .footer.footer-premium .footer-grid,
  .footer.footer-premium.footer-unified .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 28px 16px;
  }
}

/* ============================================================
   7. Newsletter / formulaires larges
   ============================================================ */
.newsletter-content,
.newsletter-form {
  min-width: 0;
}

@media (max-width: 767px) {
  .newsletter-content {
    flex-direction: column;
    text-align: center;
    gap: 20px;
  }

  .newsletter-form {
    flex-direction: column;
    width: 100%;
    max-width: 100%;
  }

  .newsletter-btn,
  .form-row {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ============================================================
   8. Paysage téléphone + safe-area
   ============================================================ */
@media (max-height: 480px) and (orientation: landscape) {
  body.page-home .hero-mosaic-slider {
    height: min(70vh, 280px);
  }

  .header-inner {
    min-height: 52px;
  }
}

@supports (padding: max(0px, env(safe-area-inset-bottom))) {
  .footer.footer-premium.footer-unified .footer-bottom {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .whatsapp-float {
    bottom: max(24px, env(safe-area-inset-bottom));
    right: max(16px, env(safe-area-inset-right));
  }
}

@media (max-width: 991px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }

  body.page-contact .contact-form-wrapper {
    padding: 24px 18px;
  }

  .contact-form-wrapper h3 {
    font-size: clamp(1.45rem, 5vw, 1.85rem);
  }
}
