/* Base mobile / tactile */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  -webkit-tap-highlight-color: rgba(196, 163, 90, 0.2);
}

.header {
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Menu hamburger (mobile / tablette portrait) */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text);
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.25s, opacity 0.25s;
}

.menu-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile {
  display: none;
  flex-direction: column;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem max(1rem, env(safe-area-inset-right)) 1rem max(1rem, env(safe-area-inset-left));
}

.nav-mobile:not([hidden]) {
  display: flex;
}

.nav-mobile a {
  padding: 0.85rem 0;
  color: var(--text);
  text-decoration: none;
  font-size: 1rem;
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  display: flex;
  align-items: center;
}

.nav-mobile a:last-child {
  border-bottom: none;
}

.nav-mobile a:active {
  color: var(--accent);
}

/* Zones tactiles minimales (Apple HIG / Material) */
.btn,
.cart-btn,
.menu-toggle,
.close-btn,
.payment-method-btn,
.cart-item-remove {
  min-height: 44px;
  touch-action: manipulation;
}

.btn-sm {
  min-height: 40px;
  padding: 0.55rem 0.75rem;
}

/* Évite le zoom iOS sur les champs */
input,
textarea,
select {
  font-size: 16px;
}

/* Footer & toast — safe area bas */
.footer {
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
}

.toast {
  bottom: max(2rem, calc(1rem + env(safe-area-inset-bottom)));
  left: max(1rem, env(safe-area-inset-left));
  right: max(1rem, env(safe-area-inset-right));
  transform: translateY(100px);
  max-width: calc(100% - 2rem);
}

.toast.show {
  transform: translateY(0);
}

.cart-footer {
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
}

/* ——— Tablette (768px – 1023px) ——— */
@media (max-width: 1023px) {
  .gallery-section.alt {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }

  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .section-header h2 {
    font-size: 2rem;
  }

  .payment-layout {
    gap: 2rem;
  }

  .payment-methods-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ——— Mobile + menu (≤ 767px) ——— */
@media (max-width: 767px) {
  .nav-desktop {
    display: none;
  }

  .menu-toggle {
    display: flex;
  }

  .logo {
    font-size: 1.15rem;
  }

  .btn-back {
    padding: 0.45rem 0.65rem;
    font-size: 0.8rem;
  }

  .hero {
    min-height: 70vh;
    min-height: 70dvh;
    padding: 6rem 1rem 3rem;
    padding-top: max(6rem, calc(4rem + env(safe-area-inset-top)));
  }

  .hero-tag {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
  }

  .hero-desc {
    font-size: 0.95rem;
  }

  .hero .btn {
    width: 100%;
  }

  .gallery-section {
    padding: 3rem 1rem;
  }

  .gallery-section.alt {
    padding: 3rem 1rem;
  }

  .section-header {
    margin-bottom: 2rem;
  }

  .section-header h2 {
    font-size: 1.65rem;
  }

  .section-header p {
    font-size: 0.9rem;
    padding: 0 0.5rem;
  }

  .gallery {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .product-card:hover {
    transform: none;
  }

  .product-card h3 {
    font-size: 1.15rem;
  }

  .product-card-actions {
    flex-direction: column;
  }

  .product-card-actions .btn {
    flex: 1 1 auto;
    width: 100%;
  }

  .btn-pay-direct {
    font-size: 0.8rem;
    padding: 0.65rem 0.75rem;
  }

  .about {
    padding: 3rem 1rem;
  }

  .about h2 {
    font-size: 1.5rem;
  }

  /* Panier plein écran sur téléphone */
  .cart-panel-inner {
    width: 100%;
    max-width: 100%;
  }

  /* Modales */
  dialog {
    width: 100%;
    max-width: 100%;
    margin: 0;
    max-height: 100%;
    max-height: 100dvh;
  }

  .product-modal {
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .product-modal-content {
    grid-template-columns: 1fr;
    max-height: calc(100dvh - 3rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .product-modal-image img {
    min-height: 220px;
    max-height: 40vh;
  }

  .product-modal-details {
    padding: 1.25rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  .product-modal-details h2 {
    font-size: 1.4rem;
  }

  .product-modal-actions {
    flex-direction: column;
  }

  .product-modal-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .subscription-modal {
    width: calc(100% - 2rem);
    max-width: 100%;
    margin: 1rem;
    padding: 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  .subscription-modal h2 {
    font-size: 1.4rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  /* Page paiement */
  .payment-main {
    padding: 5rem 1rem 2rem;
    padding-top: max(5rem, calc(3.5rem + env(safe-area-inset-top)));
  }

  .payment-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .payment-summary {
    position: static;
    padding: 1.25rem;
  }

  .payment-summary h1 {
    font-size: 1.4rem;
  }

  .payment-secure-badge {
    display: none;
  }

  .payment-form-section h2 {
    font-size: 1.25rem;
  }

  .payment-methods-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }

  .payment-method-btn {
    min-height: 64px;
    font-size: 0.7rem;
    padding: 0.5rem;
  }

  .payment-panel {
    padding: 1rem;
  }

  .btn-pay {
    padding: 1rem;
    font-size: 1rem;
  }

  .payment-success {
    padding: 3rem 1rem;
    padding-bottom: max(3rem, env(safe-area-inset-bottom));
  }
}

/* ——— Petits téléphones (≤ 380px, iPhone SE, etc.) ——— */
@media (max-width: 380px) {
  .header-inner {
    padding: 0.75rem max(0.75rem, env(safe-area-inset-right)) 0.75rem max(0.75rem, env(safe-area-inset-left));
  }

  .logo {
    font-size: 1.05rem;
  }

  .payment-methods-grid {
    grid-template-columns: 1fr 1fr;
  }

  .product-image-overlay {
    padding: 0.75rem;
  }
}

/* ——— Tablette paysage & grands écrans tactiles ——— */
@media (min-width: 768px) and (max-width: 1023px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-modal {
    width: min(700px, 92vw);
  }
}

/* ——— Préférence mouvement réduit ——— */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* ——— Mode paysage téléphone ——— */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: 5rem 1.5rem 2rem;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .product-modal-image img {
    max-height: 35vh;
  }
}
