/* AR Nexus — global responsive enhancements */

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

img, video {
  max-width: 100%;
  height: auto;
}

/* Prevent horizontal overflow */
body {
  overflow-x: hidden;
}

/* Fluid containers */
.container {
  width: 100%;
  padding-left: clamp(1rem, 4vw, 2rem);
  padding-right: clamp(1rem, 4vw, 2rem);
}

/* Header layout — stack gracefully on small screens */
@media (max-width: 1100px) {
  .main-header .header-inner {
    display: grid !important;
    grid-template-columns: auto 1fr auto !important;
    align-items: center;
    gap: 12px;
  }
  .main-header .header-main-nav { display: none !important; }
  .main-header .header-right {
    justify-content: flex-end;
    gap: 8px;
  }
}

@media (max-width: 480px) {
  .utility-bar .container {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
    font-size: 0.7rem;
  }
  .logo a { font-size: 1rem !important; }
}

/* Footer */
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(24px, 4vw, 40px);
}

@media (max-width: 992px) {
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
}

@media (max-width: 576px) {
  .footer-grid { grid-template-columns: 1fr; }
  footer .newsletter-inline-form {
    flex-direction: column;
  }
  footer .newsletter-inline-form input,
  footer .newsletter-inline-form button {
    border-radius: var(--radius-pill) !important;
    width: 100%;
  }
  footer .newsletter-inline-form input { border-right: 1px solid var(--border) !important; margin-bottom: 8px; }
}

/* Shop page */
@media (max-width: 991px) {
  .bm-shop-layout { grid-template-columns: 1fr !important; }
  .bm-shop-top { flex-direction: column; align-items: flex-start !important; }
  .bm-sort-wrap { width: 100%; }
  .bm-sort-wrap select { width: 100%; }
  .bm-products-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 576px) {
  .bm-products-grid { grid-template-columns: 1fr !important; }
  .bm-pagination a, .bm-pagination span, .pagination a, .pagination span {
    min-width: 36px;
    height: 36px;
    font-size: 0.82rem;
  }
}

/* Footer columns */
@media (max-width: 992px) {
  .footer-dark-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 576px) {
  .footer-dark-grid { grid-template-columns: 1fr !important; }
}

/* Cart & checkout */
@media (max-width: 900px) {
  .checkout-grid-responsive { grid-template-columns: 1fr !important; }
  .cart-grid-responsive { grid-template-columns: 1fr !important; }
}

/* Cart page — card layout on mobile (no horizontal scroll, full content visible) */
@media (max-width: 768px) {
  .bm-cart-page .bm-page-inner {
    padding: 20px 0 56px;
  }

  .bm-cart-page .bm-cart-title {
    font-size: 1.65rem;
    margin-bottom: 20px;
  }

  .bm-cart-page .bm-cart-grid {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }

  .bm-cart-page .bm-cart-grid > * {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .bm-cart-page .bm-cart-table-wrap {
    overflow: visible;
    padding: 12px 14px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Break table layout completely on small screens */
  .bm-cart-page .bm-cart-table,
  .bm-cart-page .bm-cart-table tbody {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .bm-cart-page .bm-cart-table thead {
    display: none;
  }

  .bm-cart-page .bm-cart-table tbody tr.cart-item {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
      "product"
      "price"
      "qty"
      "total"
      "remove";
    gap: 8px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .bm-cart-page .bm-cart-table tbody tr.cart-item:last-child {
    border-bottom: none;
  }

  .bm-cart-page .bm-cart-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 0;
    border-bottom: none;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }

  .bm-cart-page .bm-cart-table td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    flex-shrink: 0;
  }

  .bm-cart-page .bm-cart-table td[data-label=""]::before {
    display: none;
  }

  .bm-cart-page .bm-cart-table td.bm-cart-cell-product {
    grid-area: product;
    display: block;
    padding: 0;
    min-width: 0;
  }

  .bm-cart-page .bm-cart-table td.bm-cart-cell-remove {
    grid-area: remove;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    width: 100% !important;
    padding: 10px 0 0;
    margin-top: 4px;
    border-top: 1px dashed var(--border);
  }

  .bm-cart-page .bm-cart-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    background: transparent !important;
    color: var(--text-muted) !important;
    flex-shrink: 0;
    transform: none !important;
  }

  .bm-cart-page .bm-cart-remove:hover {
    color: var(--accent-peach) !important;
    background: var(--bg-light) !important;
    transform: none !important;
  }

  .bm-cart-page .bm-cart-table td.bm-cart-cell-price {
    grid-area: price;
  }

  .bm-cart-page .bm-cart-table td.bm-cart-cell-qty {
    grid-area: qty;
  }

  .bm-cart-page .bm-cart-table td.bm-cart-cell-line-total {
    grid-area: total;
  }

  .bm-cart-page .bm-cart-cell-value {
    margin-left: auto;
    flex-shrink: 0;
    text-align: right;
  }

  .bm-cart-page .bm-cart-product {
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
    width: 100%;
  }

  .bm-cart-page .bm-cart-product img {
    width: 64px;
    height: 64px;
    flex-shrink: 0;
  }

  .bm-cart-page .bm-cart-product > div {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .bm-cart-page .bm-cart-product h4 {
    font-size: 0.9rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .bm-cart-page .bm-cart-product p {
    font-size: 0.74rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .bm-cart-page .bm-cart-foot {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding-top: 16px;
  }

  .bm-cart-page .bm-cart-continue {
    text-align: center;
  }

  .bm-cart-page .bm-cart-promo {
    width: 100%;
    flex-direction: column;
    gap: 8px;
  }

  .bm-cart-page .bm-cart-promo input {
    min-width: 0;
    width: 100%;
    border-right: 1px solid var(--border);
    border-radius: var(--radius);
  }

  .bm-cart-page .bm-cart-promo button {
    width: 100%;
    border-radius: var(--radius);
  }

  .bm-cart-page .bm-summary-card {
    position: static;
    top: auto;
    padding: 20px 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .bm-cart-page .bm-summary-row,
  .bm-cart-page .bm-summary-total {
    width: 100%;
    gap: 12px;
  }

  .bm-cart-page .bm-summary-row span:first-child,
  .bm-cart-page .bm-summary-total span:first-child {
    min-width: 0;
    flex: 1;
  }

  .bm-cart-page .bm-summary-row span:last-child,
  .bm-cart-page .bm-summary-total span:last-child {
    flex-shrink: 0;
    text-align: right;
    white-space: nowrap;
  }

  .bm-cart-page .bm-summary-total span:last-child {
    font-size: 1.45rem;
  }

  .bm-cart-page .bm-ship-box {
    flex-direction: row;
    align-items: flex-start;
  }

  .bm-cart-page .bm-ship-box strong,
  .bm-cart-page .bm-ship-box div {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .bm-cart-page .bm-pay-icons {
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
  }

  .bm-cart-page .bm-secure-bar {
    text-align: center;
    font-size: 0.78rem;
    padding: 0 8px;
  }
}

@media (max-width: 480px) {
  .bm-cart-page .bm-cart-table-wrap {
    padding: 10px 12px 14px;
  }

  .bm-cart-page .bm-summary-row {
    font-size: 0.85rem;
  }
}

/* Product detail */
@media (max-width: 900px) {
  .product-detail-grid { grid-template-columns: 1fr !important; }
  .gallery-wrapper { flex-direction: column-reverse !important; }
  .gallery-wrapper .thumbnails {
    flex-direction: row !important;
    width: 100% !important;
    overflow-x: auto;
    gap: 10px !important;
  }
}

/* Blog grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(20px, 3vw, 40px);
}

@media (max-width: 992px) {
  .blog-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 576px) {
  .blog-grid { grid-template-columns: 1fr !important; }
  .blog-filters { flex-wrap: wrap; gap: 12px !important; justify-content: flex-start !important; }
}

/* Content pages */
.page-content-card {
  margin-left: auto;
  margin-right: auto;
}

@media (max-width: 576px) {
  .page-content-main { padding: 32px 0 60px; }
  .page-content-card { padding: 24px 18px !important; border-radius: var(--radius) !important; }
}

/* About page */
@media (max-width: 992px) {
  .ab-precision, .ab-footprint-grid { grid-template-columns: 1fr !important; }
  .ab-timeline { grid-template-columns: repeat(2, 1fr) !important; }
  .ab-years { right: 12px !important; bottom: 12px !important; }
}

@media (max-width: 560px) {
  .ab-timeline { grid-template-columns: 1fr !important; }
  .ab-hero-inner { padding: 60px 0 70px !important; }
}

/* Contact page */
@media (max-width: 992px) {
  .ct-grid { grid-template-columns: 1fr !important; }
  .ct-form-row { grid-template-columns: 1fr !important; }
}

/* Home — AR Nexus sections */
@media (max-width: 992px) {
  .tm-hero { padding: 40px 0 56px; }
  .tm-hero-grid { grid-template-columns: 1fr !important; gap: 32px; }
  .tm-hero-visual { order: -1; }
  .tm-brands-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .tm-features-grid { grid-template-columns: 1fr !important; gap: 28px; }
  .tm-promise-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .tm-sec-head { flex-direction: column; align-items: flex-start !important; }
}

@media (max-width: 576px) {
  .tm-brands-grid { grid-template-columns: 1fr !important; }
  .tm-hero-btns { flex-direction: column; width: 100%; }
  .tm-hero-btns a { text-align: center; width: 100%; }
  .tm-hero-badge { left: 12px !important; right: 12px; font-size: 0.75rem; }
  .tm-newsletter-form { flex-direction: column; max-width: 100% !important; padding: 0 8px; }
  .tm-newsletter-form input,
  .tm-newsletter-form button {
    border-radius: var(--radius-pill) !important;
    width: 100%;
  }
  .tm-newsletter-form button { margin-top: 8px; }
  .tm-section { padding: 48px 0; }
}

/* Tables scroll on mobile */
@media (max-width: 600px) {
  .specs-table, table { display: block; overflow-x: auto; white-space: nowrap; }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
  .header-icon-link,
  .tm-prod-cart,
  .sp-btn,
  .btn,
  .mobile-bottom-nav a {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Swiper slides equal height */
.swiper-slide { height: auto; }
