/**
 * Appily fortythree — Orchard mobile responsive (all storefront pages)
 * Complements per-page *-orchard.css breakpoints with shared catch-all rules.
 */

@media (max-width: 960px) {
  /* Hero + two-column shells across all orchard themes */
  [class*="-hero-grid"],
  [class*="-hero-inner"],
  [class*="-layout"],
  [class*="-shell"],
  [class*="-ledger"],
  [class*="-workspace"],
  [class*="-stage-inner"],
  [class*="-mosaic"]:not(.a43-harv-mosaic) {
    grid-template-columns: 1fr !important;
  }

  /* Sticky side rails → flow in document */
  [class*="-dock"],
  [class*="-rail"],
  [class*="-sidebar"],
  [class*="-filters"],
  [class*="-summary"],
  [class*="-compass-nav"] {
    position: static !important;
    top: auto !important;
    max-height: none !important;
  }

  .a43-shop-layout {
    grid-template-columns: 1fr !important;
  }
  .a43-shop-filters {
    position: static !important;
  }

  .a43-grove-guest:not(.a43-grove-guest--solo) {
    grid-template-columns: 1fr !important;
  }
  .a43-grove-benefits-track {
    display: flex !important;
    flex-direction: row !important;
    overflow-x: auto;
  }
  .a43-grove-benefit {
    flex: 0 0 min(260px, 78vw) !important;
    min-height: 0 !important;
  }
}

@media (max-width: 768px) {
  html,
  body.a43-store {
    overflow-x: clip;
  }

  .container {
    padding-left: max(1rem, env(safe-area-inset-left, 0px));
    padding-right: max(1rem, env(safe-area-inset-right, 0px));
  }

  .page-main {
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
  }

  /* Hero typography */
  [class*="-hero"] h1,
  [class*="-hero-title"],
  .a43-grove-hero h1,
  .a43-shop-hero-title,
  .a43-spec-title,
  .page-hero h1 {
    font-size: clamp(1.65rem, 7vw, 2.35rem) !important;
  }

  [class*="-hero"],
  .page-hero.a43-policy-hero {
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  /* Soften decorative layers on phones */
  [class*="-blob"],
  [class*="-orbit"],
  [class*="-ring"],
  [class*="-dial"],
  [class*="-basket-glow"],
  [class*="-gauge"] {
    opacity: 0.32;
  }

  /* Product / shop / catalog grids */
  .a43-shop-grid,
  .a43-harv-mosaic,
  .a43-spec-related-grid,
  .a43-crudo-product-grid,
  .a43-tote-grid {
    --shop-col-min: 155px;
  }

  /* Form field pairs */
  [class*="-fields"],
  [class*="-fields-duo"],
  [class*="-fields-route"],
  [class*="-field-row"],
  [class*="-bento"]:not([class*="-bento-top"]),
  .a43-gate-fields-duo,
  .a43-gate-fields-route,
  .a43-signal-fields,
  .a43-signal-bento {
    grid-template-columns: 1fr !important;
  }

  /* Horizontal scroll tab / lane bars */
  .a43-grove-lanes,
  [class*="-lanes"],
  [class*="-tab-nav"],
  [class*="-compass-nav"],
  .a43-orchard-tabs {
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 0.5rem;
    padding-bottom: 0.25rem;
  }
  .a43-grove-lanes::-webkit-scrollbar,
  [class*="-lanes"]::-webkit-scrollbar { display: none; }
  .a43-grove-lane,
  [class*="-lane-btn"] {
    flex: 0 0 min(200px, 72vw);
    min-width: 168px;
  }

  /* Panels — comfortable mobile padding */
  [class*="-panel"],
  [class*="-card"]:not([class*="-card-media"]):not([class*="-card-body"]),
  [class*="-form-card"],
  [class*="-ticket"],
  .a43-grove-main,
  .a43-grove-vault,
  .policy-card,
  .a43-policy-body {
    padding: 1.1rem !important;
  }

  /* Full-width actions (44px tap targets) */
  [class*="-actions"],
  [class*="-foot"]:not([class*="-footer"]),
  [class*="-toolbar"],
  [class*="-deck-actions"],
  .a43-grove-rail-actions,
  .a43-pd-actions,
  .a43-spec-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.6rem;
  }

  [class*="-btn"],
  .a43-grove-btn,
  .a43-crudo-btn,
  .a43-spec-btn,
  .a43-tote-btn,
  .a43-gate-btn,
  .a43-shop-btn,
  [class*="-actions"] .btn,
  [class*="-foot"] .btn {
    min-height: 44px;
  }

  [class*="-actions"] .a43-grove-btn,
  [class*="-actions"] .a43-spec-btn,
  [class*="-actions"] .a43-tote-btn,
  [class*="-actions"] .a43-gate-btn,
  [class*="-foot"] .a43-tote-btn,
  [class*="-deck"] .a43-tote-btn,
  [class*="-actions"] a[class*="-btn"] {
    width: 100%;
    justify-content: center;
  }

  /* Line items stack */
  .a43-tote-card,
  [class*="-item-row"],
  [class*="-ticket-meta"],
  .a43-grove-orders .order-row,
  [class*="-pulse-item"] {
    flex-direction: column;
    align-items: stretch !important;
  }

  /* Wide tables scroll horizontally */
  table,
  [class*="-table"],
  [class*="-table-wrap"] {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Deck / dock tile grids */
  [class*="-deck-tiles"],
  [class*="-dock-grid"],
  [class*="-vitals-grid"] {
    grid-template-columns: 1fr !important;
  }
  [class*="-dock-tile--wide"] {
    grid-column: span 1 !important;
  }

  /* Policy */
  .policy-layout,
  .a43-policy-layout {
    grid-template-columns: 1fr !important;
  }
  .policy-nav {
    position: static !important;
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    gap: 0.5rem;
    padding-bottom: 0.35rem;
    scrollbar-width: none;
  }
  .policy-nav::-webkit-scrollbar { display: none; }
  .policy-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* Home sections */
  .a43-crudo-bestselling-grid,
  .a43-crudo-deals-grid,
  .a43-crudo-reviews-grid,
  .a43-compass-deck-grid {
    grid-template-columns: 1fr !important;
  }

  .a43-shop-orchard-cats,
  .a43-shop-hero-stats,
  .a43-tote-metrics {
    flex-wrap: wrap;
  }

  .a43-shop-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .a43-shop-grid {
    --shop-col-min: 145px;
  }

  .a43-tote-head {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .a43-grove-member-id { display: none; }
  .a43-grove-passport-preview { min-width: 0; width: 100%; }

  [class*="-hero-stats"],
  [class*="-metrics"] {
    flex-direction: column;
    align-items: stretch;
  }

  .a43-compass-bento {
    grid-template-columns: 1fr !important;
  }
  .a43-compass-bento [class*="tile"] {
    grid-column: span 1 !important;
  }
}

@media (max-width: 400px) {
  .a43-shop-grid,
  .a43-tote-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .a43-crudo-drawer-panel,
  .a43-crudo-drawer-backdrop,
  .a43-crudo-menu-btn span {
    transition: none !important;
  }
}
