/**
 * SOCO universal H5 (mobile) layout — all public pages.
 * Complements layout-fix.css (959px breakpoint).
 */

@media (max-width: 959px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  html,
  body {
    overflow-x: clip;
    max-width: 100vw;
  }

  #main,
  .store-main {
    overflow-x: clip;
    max-width: 100%;
    min-width: 0;
  }

  /* Safe area (notch / home indicator) */
  .store-header,
  #TopNavigation,
  [class*="MainNav-sc-"] {
    padding-left: max(1rem, env(safe-area-inset-left));
    padding-right: max(1rem, env(safe-area-inset-right));
  }

  .store-main,
  #main > [class*="Content-sc-"] {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  }

  /* Article / comparison tables — horizontal scroll instead of page bleed */
  #main table,
  [class*="ArticleMainContent-sc-"] table,
  [class*="ArticleContent-sc-"] table {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  #main table tbody,
  #main table thead,
  #main table tr {
    display: table;
    width: 100%;
    min-width: 480px;
  }

  /* Touch targets */
  button,
  [role="button"],
  a[class*="Button-sc-"],
  .store-btn {
    min-height: 44px;
  }

  [class*="MobileOnlyButtonContainer-sc-"] button {
    min-width: 44px;
    min-height: 44px;
  }

  /* Store checkout — single column on phone */
  html[data-store-flow="1"] .store-split {
    grid-template-columns: 1fr !important;
  }

  html[data-store-flow="1"] .store-summary {
    order: -1;
  }

  html[data-store-flow="1"] .store-steps__list {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }

  html[data-store-flow="1"] .store-steps__item span:last-child {
    font-size: 0.75rem;
  }

  /* Category product grids */
  html[data-ro-category-page="1"] [class*="ProductGrid-sc-"],
  html[data-ro-wl-page="1"] [class*="ContentGrid-sc-"] {
    grid-template-columns: 1fr !important;
  }

  /* Advisors / expert cards */
  #main [class*="StyledGrid-sc-55cd32e0"] {
    grid-template-columns: 1fr !important;
  }

  /* Consultation forms */
  html[data-ro-consultation="1"] form [class*="Grid-sc-"],
  html[data-ro-consultation="1"] .consultation-form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Sticky in-page nav — scroll horizontally */
  [class*="StickyContainer-sc-cb5ae65b"] nav,
  [class*="StickyContainer-sc-cb5ae65b"] [class*="List-sc-"] {
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    justify-content: flex-start !important;
    scrollbar-width: none;
  }

  [class*="StickyContainer-sc-cb5ae65b"] nav::-webkit-scrollbar {
    display: none;
  }

  /* Prevent fixed-width images from overflowing */
  #main img,
  #main video,
  #main iframe {
    max-width: 100% !important;
    height: auto;
  }

  #main iframe {
    aspect-ratio: 16 / 9;
  }
}

@media (max-width: 375px) {
  html[data-store-flow="1"] .store-panel {
    padding: 1.25rem 1rem;
  }

  [class*="TopBar-sc-"] .soco-text-logo {
    font-size: 0.95rem !important;
  }
}
