/* BlueMountain Store — 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) {
  .shop-layout { flex-direction: column !important; }
  .shop-sidebar { width: 100% !important; }
  .products-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .shop-hero-banner { padding: 32px 24px !important; }
}

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

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

@media (max-width: 768px) {
  .bm-cart-table-wrap { padding: 20px 16px; overflow: hidden; }
  .bm-cart-table { min-width: 100%; display: block; }
  .bm-cart-table thead { display: none; }
  .bm-cart-table tbody, .bm-cart-table tr { display: block; width: 100%; }
  
  .bm-cart-table tr.cart-item {
    display: grid !important;
    grid-template-columns: 1fr auto auto !important;
    align-items: center;
    gap: 16px 12px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
  }
  
  .bm-cart-table td { padding: 0; border: none; display: block; }
  
  /* Product */
  .bm-cart-table td:nth-child(1) { grid-column: 1 / 3; min-width: 0; padding-right: 12px; }
  /* Price */
  .bm-cart-table td:nth-child(2) { grid-column: 1 / 2; }
  /* Qty */
  .bm-cart-table td:nth-child(3) { grid-column: 2 / 3; justify-self: start; }
  /* Total */
  .bm-cart-table td:nth-child(4) { grid-column: 3 / 4; text-align: right; }
  /* Trash */
  .bm-cart-table td:nth-child(5) { grid-column: 3 / 4; grid-row: 1 / 2; align-self: start; justify-self: end; }
  
  .bm-cart-product { gap: 12px; min-width: 0; }
  .bm-cart-product > div { min-width: 0; }
  .bm-cart-product img { width: 64px; height: 64px; flex-shrink: 0; }
  .bm-cart-product h4 { font-size: 0.9rem; white-space: normal; overflow-wrap: break-word; word-wrap: break-word; }
  
  .bm-cart-qty input { width: 32px; height: 32px; font-size: 0.85rem; }
  .bm-cart-qty button { width: 28px; height: 32px; }
  
  .bm-cart-foot { flex-direction: column; align-items: stretch; gap: 16px; }
  .bm-cart-promo { width: 100%; }
  .bm-cart-promo input { flex: 1; width: 100%; min-width: 0; }
}

/* 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 — BlueMountain 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; }

/* ── NordEdge Mart — bm-* layout (shop, checkout, product, auth) ── */

.bm-checkout-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: flex-start;
}

.bm-checkout-fields-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 991px) {
  .bm-checkout-layout {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  .bm-shop-layout { grid-template-columns: 1fr !important; gap: 24px !important; }
  .bm-sidebar-card { position: static !important; top: auto !important; }
  .bm-products-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 16px !important; }
  .bm-prod-card, .bm-shop-card { min-width: 0; }
  .product-detail-grid, .bm-pdp-grid {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
  }
  .bm-cart-grid { grid-template-columns: 1fr !important; }
  .bm-crosssell-grid { grid-template-columns: repeat(2, 1fr) !important; }
}

@media (max-width: 768px) {
  .bm-checkout-fields-2,
  .checkout-field-row-2 {
    grid-template-columns: 1fr !important;
  }
  .bm-reviews-layout {
    grid-template-columns: 1fr !important;
    gap: 32px !important;
  }
  .reviews-section { padding: 48px 0 !important; }
  .reviews-summary h2 { font-size: 1.75rem !important; }
  .bm-features-grid { grid-template-columns: 1fr !important; gap: 20px !important; }
  .bm-features-section { padding: 48px 0 !important; }
  .order-success-grid { grid-template-columns: 1fr !important; gap: 24px !important; }
  .account-form-grid-2,
  .account-form-grid-3 {
    grid-template-columns: 1fr !important;
  }
  .bm-products-grid { grid-template-columns: 1fr !important; }
  .bm-crosssell-grid { grid-template-columns: 1fr !important; }
  .utility-bar .container {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 6px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .utility-bar .util-left {
    font-size: 0.68rem;
    line-height: 1.5;
  }
  .bm-content-hero { padding: 48px 0 !important; }
  .bm-content-hero h1 { font-size: clamp(1.6rem, 6vw, 2.2rem) !important; }
  .guide-tabs { gap: 4px; overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .guide-tab { flex-shrink: 0; padding: 10px 16px; font-size: 0.75rem; }
  .tip-card { flex-direction: column; gap: 14px; padding: 18px; }
  .bm-auth-card { padding: 28px 20px !important; margin: 0 12px; }
  .bm-trust { padding: 48px 16px !important; }
  .bm-trust h2 { font-size: clamp(1.5rem, 5vw, 2rem) !important; }
  .search-overlay .search-input-wrapper { flex-direction: column; gap: 12px; }
  .search-overlay input { width: 100% !important; font-size: 16px !important; }
  .bm-banner { min-height: 220px !important; }
  .bm-banner h3 { font-size: 1.25rem !important; }
  .pagination { flex-wrap: wrap; justify-content: center; gap: 6px; }
}

@media (max-width: 480px) {
  .main-header { padding: 12px 0 !important; }
  .logo a { font-size: 0.95rem !important; white-space: normal; line-height: 1.2; }
  .header-icons { gap: 2px; }
  .bm-hero { min-height: 62vh !important; padding: 88px 0 64px !important; }
  .bm-hero-content h1 { font-size: clamp(1.75rem, 8vw, 2.35rem) !important; }
  .bm-hero-content p { font-size: 0.92rem; }
  .bm-btn-sage, .bm-btn-ghost { padding: 14px 20px !important; font-size: 0.72rem !important; }
  .bm-page-inner { padding: 16px 0 48px !important; }
  .bm-shop-top h1 { font-size: 1.45rem !important; }
  .footer-grid { gap: 20px !important; }
  .page-content-card { padding: 20px 16px !important; }
  .bm-sidebar-card { padding: 16px !important; }
  .bm-filter-label { font-size: 0.72rem; }
  .bm-brand-check { font-size: 0.85rem; }
}

@media (max-width: 991px) {
  .bm-account-layout { grid-template-columns: 1fr !important; }
  .account-sidebar { position: static !important; }
  .account-wishlist-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 16px !important; }
}

@media (max-width: 576px) {
  .account-wishlist-grid { grid-template-columns: 1fr !important; }
  main[style*="padding: 100px"] { padding: 72px 0 !important; }
  main[style*="padding: 100px"] .container.card { padding: 24px 16px !important; }
}

/* Checkout / cart inline grids hooked via class where added */
main.bm-page .container[style*="max-width: 1100px"] {
  max-width: min(1100px, 100%) !important;
  padding-left: clamp(12px, 4vw, 24px);
  padding-right: clamp(12px, 4vw, 24px);
}

.bm-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.bm-spec-table th,
.bm-spec-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: normal;
}
.bm-spec-table th {
  width: 35%;
  font-weight: 600;
  color: var(--text-muted);
}

.footer-home-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
}
