/*
 * CRAFT V6.113 — tablet/mobile final responsive safety layer.
 * IMPORTANT: every visual rule is scoped to <=1024px so the approved desktop
 * layout remains unchanged. This file loads after all template/page CSS.
 */

@media (max-width:1024px){
  html,body{max-width:100%!important;overflow-x:clip!important}
  body{min-width:0!important}
  main,section,article,aside,header,footer,nav,form,fieldset,
  .container,.v22-header-inner,.v39-newsletter-grid,.v39-footer-top,
  .cart-grid,.checkout-grid,.product-stage,.product-grid,
  .account-container,.account-logged-in-shell,.contact-form-grid,
  .loc-exp-grid,.loc-visit-grid,.loc-fav-grid{min-width:0!important}
  img,video,iframe,embed,object,svg{max-width:100%}
  iframe{width:100%}
  input,select,textarea,button{min-width:0;max-width:100%}

  /* Long translated copy must never create horizontal scroll. */
  .section-copy,.product-desc,.summary-name,.item-copy,.account-content-card,
  .woocommerce-MyAccount-content,.loc-visit-info,.contact-copy{
    overflow-wrap:break-word;
    word-break:normal;
  }

  /* WooCommerce/plugin tables remain usable on tablets without widening page. */
  .woocommerce-account .woocommerce-MyAccount-content .woocommerce-orders-table,
  .woocommerce-account .woocommerce-MyAccount-content .shop_table,
  .woocommerce-account .woocommerce-MyAccount-content table{
    max-width:100%!important;
  }

  /* Keep the fixed header compact on landscape tablets while retaining desktop UI. */
  .v22-header-inner{max-width:calc(100% - 24px)!important}
}

@media (min-width:901px) and (max-width:1024px){
  .v22-header-inner{gap:12px!important}
  .v22-desktop-nav{gap:10px!important;font-size:8.5px!important;letter-spacing:.055em!important}
  .v22-header-actions{gap:8px!important;font-size:8.5px!important;letter-spacing:.05em!important}
  .v22-brand{width:104px!important}
  .v22-brand img{width:98px!important}
  .v22-header-actions .craft-header-language-switcher{font-size:8px!important;letter-spacing:.045em!important}
  .v22-header-actions .craft-header-language-divider{margin-inline:1px!important}

  /* Prevent sticky commerce sidebars from colliding with the tablet header. */
  body.woocommerce-cart .summary-col,
  body.woocommerce-checkout .summary-col{top:118px!important}
}

@media (max-width:900px){
  /* Shared page/container safety after all page-specific styles. */
  .container{max-width:100%!important}
  .v22-header-inner{max-width:calc(100% - 24px)!important}

  /* Cart / checkout should always stack cleanly on portrait tablet. */
  body.woocommerce-cart .cart-grid,
  body.woocommerce-checkout .checkout-grid{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.woocommerce-cart .summary-col,
  body.woocommerce-checkout .summary-col{
    position:static!important;
    top:auto!important;
    width:100%!important;
    min-width:0!important;
  }
  body.woocommerce-cart .summary-card,
  body.woocommerce-checkout .summary-card,
  body.woocommerce-checkout .checkout-card{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }

  /* Checkout form rows cannot inherit a desktop minimum or oversized gap. */
  body.woocommerce-checkout .contact-form-grid,
  body.woocommerce-checkout .card-fields,
  body.woocommerce-checkout .fulfilment-address{
    min-width:0!important;
  }
  body.woocommerce-checkout .field,
  body.woocommerce-checkout .form-row{
    min-width:0!important;
    max-width:100%!important;
  }
  body.woocommerce-checkout .payment_methods,
  body.woocommerce-checkout .wc_payment_method,
  body.woocommerce-checkout .payment_box{
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
  }
  body.woocommerce-checkout .wc_payment_method label,
  body.woocommerce-checkout .payment_box,
  body.woocommerce-checkout .checkout-note{
    overflow-wrap:break-word!important;
  }
  body.woocommerce-checkout .payment-icons img{max-width:100%!important;height:auto!important}

  /* Product detail: no desktop dimensions leak after the stacked breakpoint. */
  body.single-product .product-stage{grid-template-columns:minmax(0,1fr)!important;height:auto!important;min-height:0!important;max-height:none!important}
  body.single-product .gallery,
  body.single-product .purchase-card{width:100%!important;max-width:100%!important;min-width:0!important}
  body.single-product .product-name{max-width:100%!important;overflow-wrap:break-word!important}
  body.single-product .availability-locations{max-width:100%!important}

  /* Logged-in account shell: navigation and content become one readable column. */
  body.woocommerce-account.logged-in .account-logged-in-shell{
    grid-template-columns:minmax(0,1fr)!important;
  }
  body.woocommerce-account.logged-in .account-sidebar,
  body.woocommerce-account.logged-in .account-content-card,
  body.woocommerce-account.logged-in .woocommerce-MyAccount-content{
    width:100%!important;max-width:100%!important;min-width:0!important;
  }
  body.woocommerce-account.logged-in .woocommerce-MyAccount-navigation ul{
    display:flex!important;overflow-x:auto!important;flex-wrap:nowrap!important;
    max-width:100%!important;padding-bottom:6px!important;scrollbar-width:none;
    -webkit-overflow-scrolling:touch;
  }
  body.woocommerce-account.logged-in .woocommerce-MyAccount-navigation ul::-webkit-scrollbar{display:none}
  body.woocommerce-account.logged-in .woocommerce-MyAccount-navigation li{flex:0 0 auto!important}

  /* New location template: tablet cards remain balanced and never overflow. */
  .loc-main .loc-exp-grid,.loc-main .loc-visit-grid{grid-template-columns:minmax(0,1fr)!important}
  .loc-main .loc-visit-info,.loc-main .loc-visit-map{width:100%!important;min-width:0!important}
  .loc-main .loc-hero-actions{flex-wrap:wrap!important}
  .loc-main .loc-hero-actions .btn{max-width:100%!important}
}

@media (max-width:820px){
  /* Three favourite location cards are too narrow on small tablets. */
  .loc-main .loc-fav-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .loc-main .loc-fav-tile:last-child{grid-column:1/-1!important}
}

@media (max-width:600px){
  /* Avoid iOS zoom and keep controls comfortably tappable. */
  input[type="text"],input[type="email"],input[type="tel"],input[type="password"],
  input[type="number"],input[type="search"],select,textarea{font-size:16px!important}

  /* Editorial italic phrases are allowed to wrap on narrow phones. */
  .section-title em,.hero-title em,.final-copy h2 em,.nowrap-phrase{
    white-space:normal!important;
  }

  /* Long multilingual buttons must stay inside the viewport. */
  .btn,.cta,.account-submit,.checkout-btn,.place-order,
  .single_add_to_cart_button,.add-to-bag,.craft-cart-drawer-button{
    white-space:normal!important;
    text-align:center!important;
    overflow-wrap:break-word!important;
  }

  /* Woo notices/messages wrap instead of creating sideways scroll. */
  .woocommerce-message,.woocommerce-info,.woocommerce-error,
  .woocommerce-notices-wrapper{
    max-width:100%!important;
    overflow-wrap:break-word!important;
  }

  /* Cart item controls can wrap naturally on very narrow screens. */
  body.woocommerce-cart .item-controls{min-width:0!important;max-width:100%!important}
  body.woocommerce-cart .qty{flex:0 0 auto!important}
  body.woocommerce-cart .cart-footer-row{width:100%!important}

  /* Checkout details and summary rows cannot force a minimum width. */
  body.woocommerce-checkout .summary-item,
  body.woocommerce-checkout .summary-line,
  body.woocommerce-checkout .fulfilment-option,
  body.woocommerce-checkout .payment-option{
    min-width:0!important;max-width:100%!important;
  }
  body.woocommerce-checkout .summary-name,
  body.woocommerce-checkout .summary-meta,
  body.woocommerce-checkout .field-help{
    overflow-wrap:anywhere!important;
  }

  /* Account data tables scroll inside their card only when genuinely necessary. */
  body.woocommerce-account.logged-in .woocommerce-MyAccount-content .woocommerce-orders-table,
  body.woocommerce-account.logged-in .woocommerce-MyAccount-content .shop_table,
  body.woocommerce-account.logged-in .woocommerce-MyAccount-content table{
    display:block!important;
    width:100%!important;
    overflow-x:auto!important;
    -webkit-overflow-scrolling:touch;
  }

  /* Product purchase/sticky bars remain inside safe-area on phones. */
  body.single-product .buy-row{min-width:0!important;max-width:100%!important}
  body.single-product .sticky-buy{
    left:10px!important;right:10px!important;width:auto!important;max-width:none!important;
    bottom:calc(10px + env(safe-area-inset-bottom,0px))!important;
  }
  body.single-product .availability-locations{gap:6px 10px!important}

  /* Location page phone layout. */
  .loc-main .loc-fav-grid{grid-template-columns:minmax(0,1fr)!important}
  .loc-main .loc-fav-tile:last-child{grid-column:auto!important}
  .loc-main .loc-visit-data{grid-template-columns:minmax(82px,95px) minmax(0,1fr)!important}
  .loc-main .loc-visit-data a{overflow-wrap:anywhere!important}
  .loc-main .loc-other-links{row-gap:12px!important}

  /* Footer legal/language row always stays within the global container. */
  .v39-footer-bottom .v39-footer-legal{
    max-width:100%!important;justify-content:flex-start!important;overflow-wrap:break-word!important;
  }
}

@media (max-width:430px){
  /* Small-phone refinements only; no desktop/tablet effect. */
  .v22-header-inner{max-width:calc(100% - 16px)!important}
  .v22-brand{max-width:88px!important}
  .v22-brand img{width:84px!important;max-width:84px!important}

  body.single-product .recommend .product-grid,
  body.woocommerce-cart .recommend-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  body.woocommerce-checkout .stepper{max-width:100%!important;overflow:hidden!important}
  body.woocommerce-checkout .step{min-width:0!important}

  .loc-main .loc-hero-actions{display:grid!important;grid-template-columns:minmax(0,1fr)!important;width:100%!important}
  .loc-main .loc-hero-actions .btn{width:100%!important;white-space:normal!important}
  .loc-main .loc-title{font-size:clamp(52px,15vw,72px)!important}
  .loc-main .loc-visit-data{grid-template-columns:minmax(0,1fr)!important;gap:5px!important}
}

@media (max-width:1024px) and (hover:none), (max-width:1024px) and (pointer:coarse){
  a,button,[role="button"],input,select,textarea{touch-action:manipulation}
}
