/* AuMoinsChere 1.5.5 — Sprint 3, responsive boutique.
   Loaded last. Existing product images, header/footer logo and business flows stay intact. */

/* Text must wrap within the viewport instead of widening the document. */
:where(.topbar, .top-actions, .catalogue, .product-card, .product-info,
       .footer-inner, .footer-brand-block, .footer-col, .amc-newsletter-inner,
       .amc-newsletter-copy, .amc-newsletter-form, .cart-line,
       .product-viewer-info, .order-modal-card, .cart-options-card) {
  min-width: 0;
}
.site-footer { overflow: hidden; }
:where(.footer-brand-block, .footer-col, .contact-section, .amc-newsletter,
       .product-info, .cart-line, .product-viewer-info) {
  overflow-wrap: break-word;
}

/* Match footer logo geometry exactly; older CSS scaled the header visually. */
.topbar .brand.brand-logo-only { transform: none !important; }
.topbar .site-header-logo { transform: none !important; }

/* Real bug in 1.5.4: a global input{width:100%} made the opt-in checkbox
   100% wide, pushing its label past the right edge on narrow phones. */
.amc-newsletter-consent {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}
.amc-newsletter-consent input[type="checkbox"] {
  width: 18px !important;
  min-width: 18px !important;
  max-width: 18px !important;
  height: 18px !important;
  min-height: 18px !important;
  flex: 0 0 18px !important;
  padding: 0 !important;
  margin: 2px 0 0;
  accent-color: #1e5bff;
}
.amc-newsletter-consent span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.amc-newsletter-form { width: 100%; min-width: 0; }
.amc-newsletter-form .btn { white-space: normal; }

/* Keyboard and mobile submenu: don't rely on hover as the only way in. */
#mainNav .nav-dropdown.submenu-open > .nav-dropdown-menu { display: grid; }
#mainNav .nav-dropdown-toggle { min-width: 40px; min-height: 40px; }
:where(.topbar, .tools-sprint2, .drawer, .modal-backdrop, .product-viewer-modal,
       .amc-newsletter-form) :is(button, a, input, textarea, select):focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 3px;
}

/* Modals remain usable when the software keyboard leaves little height. */
.modal-backdrop, .product-viewer-modal { overflow-y: auto; overscroll-behavior: contain; }
:where(.order-modal-card, .cart-options-card, .success-card, .restock-modal-card) {
  max-height: calc(100dvh - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.product-viewer-card { max-height: calc(100dvh - 28px); overscroll-behavior: contain; }
.drawer { height: 100vh; height: 100dvh; overscroll-behavior: contain; }
.drawer .cart-line > div { min-width: 0; }
.drawer .cart-line h4 { overflow-wrap: anywhere; }
.drawer :is(input, select, textarea),
.order-modal-card :is(input, select, textarea) { font-size: 16px; }

@media (max-width: 980px) {
  /* Make the menu a dropdown layer rather than pushing the whole page down. */
  .topbar {
    position: sticky;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 9px;
    padding: 10px 16px;
  }
  .topbar .brand { flex: 1 1 auto; min-width: 0; }
  .topbar .top-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
  #mobileNavToggle {
    flex: 0 0 44px;
    width: 44px;
    min-height: 44px;
    padding: 0;
    margin: 0;
    font-size: 22px;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
  }
  #mainNav.main-nav {
    position: absolute;
    top: calc(100% - 1px);
    left: 12px;
    right: 12px;
    width: auto;
    max-height: calc(100dvh - 78px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
    z-index: 80;
  }
  #mainNav.main-nav.open { display: grid; grid-template-columns: minmax(0, 1fr); }
  #mainNav .nav-dropdown { grid-template-columns: minmax(0, 1fr) 44px; }
  #mainNav .nav-dropdown-toggle { min-width: 44px; min-height: 44px; }
  #mainNav .nav-dropdown.submenu-open > .nav-dropdown-menu { display: grid; }
  #mainNav .nav-dropdown-menu { width: 100%; min-width: 0; display: none; }
  #mainNav a { min-height: 44px; display: flex; align-items: center; }

  /* At tablet width, the two-column product grid remains readable. */
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
  .products .product-card { min-width: 0; }
  .products .product-card .product-img { height: clamp(200px, 32vw, 280px); }
  .product-viewer-layout { grid-template-columns: minmax(0, 1fr); }
  .product-viewer-stage { min-height: 280px; }
  .footer-contact-actions { flex-wrap: wrap; }
}

@media (min-width: 561px) and (max-width: 980px) {
  #home #heroSliderTrack > .hero-slide { padding-top: 32px; padding-bottom: 62px; row-gap: 16px; }
  #home .hero-slide > .hero-inner h1 { font-size: clamp(34px, 5.4vw, 48px); }
  #home .hero-slide > .hero-image { height: 300px; }
}

@media (max-width: 760px) {
  .amc-newsletter-inner { grid-template-columns: minmax(0, 1fr); }
  .amc-newsletter-copy { text-align: left; }
  .amc-newsletter-form { padding: 18px; }
  .cart-options-card { width: min(620px, calc(100vw - 20px)); }
  #home .hero-slide > .hero-image { height: 290px; }
  .stats-grid-home { gap: 10px; }
}

@media (max-width: 560px) {
  .topbar { padding: 8px 10px; gap: 6px; }
  .topbar .brand { flex: 1 1 auto; }
  .topbar .site-header-logo {
    height: 56px !important;
    max-width: min(230px, 38vw) !important;
  }
  .topbar .top-actions { gap: 5px; }
  .topbar .cart-btn {
    padding: 8px 9px;
    min-height: 40px;
    font-size: 12px;
    white-space: nowrap;
    border-radius: 11px;
  }
  .topbar .cart-btn span { margin-left: 3px; padding: 3px 5px; }
  .topbar .customer-profile-shortcut {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }
  #mobileNavToggle { width: 40px; min-height: 40px; flex-basis: 40px; }
  #mainNav.main-nav { left: 8px; right: 8px; max-height: calc(100dvh - 68px); }

  /* Hero: retain slide stacking, but don't crowd narrow phone displays. */
  #home #heroSliderTrack > .hero-slide { padding: 24px 14px 58px; row-gap: 12px; }
  #home .hero-slide > .hero-inner h1 {
    font-size: clamp(28px, 8vw, 40px);
    line-height: 1.08;
    letter-spacing: -.04em;
  }
  #home .hero-slide > .hero-inner p { font-size: 14px; line-height: 1.55; }
  #home .hero-slide > .hero-inner .pill {
    font-size: 10px;
    padding: 8px 12px;
    overflow-wrap: anywhere;
  }
  #home .hero-slide > .hero-image { height: 230px; width: min(100%, 350px); }
  #home .hero-slide .shoe-card { width: min(84%, 280px); }
  #home .hero-slide .stock-badge,
  #home .hero-slide .price-badge { max-width: 74%; font-size: 11px; padding: 7px 9px; }
  #home .hero-slide .hero-actions .btn { min-height: 44px; }
  #home .hero-slider-dots { bottom: 5px; gap: 2px; }
  #home .hero-slider-dot {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: transparent;
  }
  #home .hero-slider-dot::after {
    content: "";
    display: block;
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,.48);
    border-radius: 50%;
  }
  #home .hero-slider-dot.is-active::after { background: #fff; }

  main { padding: 20px 12px 30px; }
  .catalogue-heading { padding: 0 2px; }
  .catalogue-heading h2 { font-size: clamp(25px, 7vw, 33px); }
  .delivery-highlight { max-width: 100%; white-space: normal; line-height: 1.45; }
  .products { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .products .product-card .product-img { height: clamp(210px, 72vw, 300px); }
  .product-info { padding: 16px; }
  .product-info h3 { font-size: 19px; }
  .product-card .product-actions { grid-template-columns: minmax(0,1fr); gap: 9px; }
  .product-card .product-actions :is(button, a) { width: 100%; min-height: 44px; }
  .product-card .price { font-size: 24px; }
  .product-card :is(.size-chip, .product-favorite) { min-height: 40px; }
  .tools.tools-sprint2 :is(input, select, button) { min-height: 44px; }

  .drawer { width: min(460px, 100vw); padding: 14px; }
  .drawer-head h2 { font-size: 21px; }
  .drawer .cart-line { grid-template-columns: 58px minmax(0,1fr) 34px; gap: 9px; }
  .drawer .cart-line img { width: 58px; height: 62px; }
  .drawer .cart-line > button { padding: 8px 0; min-width: 34px; min-height: 40px; }
  .drawer .qty button { min-width: 34px; min-height: 36px; }
  .drawer .cart-total { gap: 12px; font-size: 17px; }
  .drawer .cart-total strong { text-align: right; overflow-wrap: anywhere; }
  .modal-backdrop { padding: 10px; align-items: center; }
  :where(.order-modal-card, .success-card, .restock-modal-card, .cart-options-card) {
    width: 100%;
    max-width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 18px;
    border-radius: 20px;
  }
  .order-modal-card h2 { font-size: 21px; }
  .modal-location-actions { grid-template-columns: minmax(0, 1fr); }
  .cart-options-product { grid-template-columns: 68px minmax(0,1fr); gap: 10px; padding-right: 36px; }
  .cart-options-product img { width: 68px; height: 68px; }
  .cart-options-product h2 { font-size: 17px; overflow-wrap: anywhere; }
  .cart-options-quantity { flex-wrap: wrap; gap: 12px; }
  .cart-options-sizes { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .cart-options-sizes button { min-width: 0; min-height: 44px; }

  .product-viewer-modal { padding: 8px; }
  .product-viewer-card { width: 100%; padding: 12px; border-radius: 20px; }
  .product-viewer-layout { gap: 12px; }
  .product-viewer-stage { min-height: 220px; border-radius: 16px; }
  .product-viewer-stage img { height: min(44dvh,280px); }
  .product-viewer-info { padding: 14px; border-radius: 16px; }
  .viewer-thumbs { max-width: 100%; }

  .amc-newsletter { padding: 38px 12px; }
  .amc-newsletter-form { padding: 16px; border-radius: 16px; }
  .amc-newsletter h2 { font-size: 26px; }
  .amc-newsletter-consent { font-size: 13px; line-height: 1.55; }
  .site-footer .footer-logo-only img.footer-main-logo {
    height: 56px !important;
    max-width: min(230px, 58vw) !important;
  }
  .footer-bottom { overflow-wrap: anywhere; }
  .toast { width: min(400px, calc(100vw - 24px)); text-align: center; }
}

@media (max-width: 350px) {
  .topbar { padding-inline: 7px; gap: 4px; }
  .topbar .cart-btn { font-size: 11px; padding-inline: 7px; }
  .topbar .customer-profile-shortcut { width: 32px; height: 32px; flex-basis: 32px; }
  .topbar #mobileNavToggle { width: 38px; flex-basis: 38px; }
  .tools.tools-sprint2 { grid-template-columns: minmax(0,1fr); }
  .tools-sprint2 #search, .tools-sprint2 .catalogue-reset-filters { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .product-card, .drawer, .topbar :is(button,a) { animation: none !important; transition-duration: .01ms !important; }
}
