/* Mobile/tablet storefront. Loaded after app.css — this file wins. */

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
  overscroll-behavior-x: none;
}

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

@media (max-width: 980px) {
  html, body {
    font-size: 16px;
    overflow-x: clip;
  }

  .wrap {
    width: calc(100% - 20px);
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: clip;
  }
  .catalog-layout {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: clip;
  }

  .header {
    width: 100%;
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
  }
  .header .wrap,
  .header-search.wrap {
    width: calc(100% - 16px);
  }
  .header-top {
    min-height: 56px;
    gap: 8px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
  }
  .brand { flex-shrink: 0; }
  .brand span { display: none; }
  .hide-sm { display: none !important; }
  .icon-btn-text,
  .cart-label { display: none; }
  .icon-btn-call { display: none !important; }
  .header-phones {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1px;
    margin-right: 2px;
  }
  .header-phone {
    font-size: 12px;
    font-weight: 700;
    padding: 2px 0;
    -webkit-tap-highlight-color: rgba(26, 102, 214, 0.18);
  }
  .header-phone span { display: none; }
  .burger { display: inline-flex !important; }
  .header-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .icon-btn,
  .cart-btn,
  .burger {
    width: 42px;
    min-width: 42px;
    min-height: 42px;
    padding: 0;
    justify-content: center;
  }
  .cart-btn { padding: 0; }
  .cart-btn::before { display: none !important; }

  .filters { display: none !important; }
  .catalog-layout {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .catalog-layout > div {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  .pdp,
  .ck,
  .blog-feature,
  .blog-layout,
  .blog-cta,
  .seo-block,
  .coop-layout {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .page-head { padding: 12px 0 8px; }
  .page-head h1 { font-size: 24px; margin: 4px 0; line-height: 1.15; overflow-wrap: anywhere; }
  .crumbs { font-size: 13px; flex-wrap: wrap; }
  body.page-catalog .page-head > .lead,
  body[class*="page-category"] .page-head > .lead,
  body[class*="page-brand"] .page-head > .lead {
    display: none;
  }
  .cat-only { margin: 2px 0 0; font-size: 14px; }
  .cat-count-line { font-size: 14px; margin: 0 0 10px; }

  .cat-chips-wrap {
    overflow: hidden;
    max-width: 100%;
  }
  .cat-chips {
    display: flex !important;
    flex-wrap: nowrap;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0 0 12px;
    margin-top: 0;
  }
  .cat-chips::-webkit-scrollbar { display: none; }
  .cat-chips a {
    flex: 0 0 auto;
    font-size: 14px;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .cat-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 12px;
  }
  .cat-sort a {
    padding: 8px 12px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid #e4e6ea;
    font-size: 14px;
  }

  .brand-picker {
    padding: 14px 12px 12px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    touch-action: pan-y;
  }
  .brand-picker-head h2 { font-size: 16px; }
  .brand-picker-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
    touch-action: pan-y !important;
  }
  .brand-pick {
    flex: none !important;
    width: auto !important;
    min-width: 0 !important;
    min-height: 84px;
    padding: 10px 6px 8px;
  }
  .brand-pick-logo,
  .brand-pick-ini {
    color: #8a8e96 !important;
  }
  .brand-pick.is-on .brand-pick-logo,
  .brand-pick.is-on .brand-pick-ini {
    color: #fff !important;
  }

  .grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }
  .card {
    min-width: 0 !important;
    max-width: 100%;
    overflow: hidden;
  }
  .card-photo {
    aspect-ratio: 1 / 1;
    max-height: 200px;
    padding: 8px;
  }
  .card-body { padding: 10px; gap: 4px; }
  .card-brand { font-size: 11px; }
  .card-body h3 { font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
  .price { font-size: 16px; }
  .card-actions {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    min-width: 0;
  }
  .card-actions .btn {
    min-height: 40px !important;
    font-size: 12px !important;
    padding: 0 4px;
    white-space: nowrap;
    min-width: 0;
  }

  .section { padding: 8px 0 36px; }
  .section h2 { font-size: 24px; }
  .btn { min-height: 44px; font-size: 16px; }
  input, select, textarea { font-size: 16px !important; }

  .pdp { padding: 12px; }
  .pdp-buy h1 { font-size: 24px; overflow-wrap: anywhere; }
  .pdp-price { font-size: 28px; }
  .pdp-back { min-height: 44px; font-size: 15px; }
  .pill {
    font-size: 14px;
    padding: 8px 12px;
    white-space: normal;
    overflow-wrap: anywhere;
    max-width: 100%;
  }

  .pdp-specs { overflow: visible; padding: 4px 12px 10px; }
  .specs,
  .specs tbody,
  .specs tr,
  .pdp-specs .specs,
  .pdp-specs .specs tbody,
  .pdp-specs .specs tr {
    display: block;
    width: 100%;
  }
  .specs th,
  .specs td,
  .pdp-specs .specs th,
  .pdp-specs .specs td {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }
  .specs th,
  .pdp-specs .specs th {
    padding: 12px 4px 0;
    border-bottom: 0;
    font-size: 13px;
    color: #6b6e76;
  }
  .specs td,
  .pdp-specs .specs td {
    padding: 3px 4px 12px;
    border-bottom: 1px solid #eceef1;
    font-size: 16px;
  }

  .warranty-steps,
  .trust,
  .coop-kinds { grid-template-columns: 1fr !important; }
  .warranty-steps h3,
  .trust h3,
  .pdp-facts h3 { font-size: 18px; }
  .warranty-steps p,
  .trust p,
  .pdp-facts p { font-size: 16px; line-height: 1.45; }

  .cats {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px;
  }
  .cat-tile {
    min-height: 0;
    padding: 14px 12px 12px;
  }
  .cat-tile:first-child {
    grid-column: span 2;
    min-height: 0;
  }
  .cat-tile img {
    position: static;
    width: 100%;
    height: 92px;
    object-fit: contain;
  }
  .cat-tile:first-child img,
  .cat-tile-mac img { height: 120px; }
  .cat-tile strong { font-size: 16px; }

  .hero {
    min-height: min(58dvh, 480px);
    margin: 12px auto 28px;
    border-radius: 18px;
  }
  .hero-inner { padding: 20px 16px 64px; }
  .hero h1,
  .hero-title { font-size: clamp(26px, 7vw, 34px); }

  .footer { padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .footer-grid { gap: 20px; }
  .help-widget {
    right: 8px;
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    max-width: none;
    padding: 20px;
    overflow: visible !important;
  }
  .help-toggle {
    box-shadow: 0 4px 14px rgba(17, 17, 19, 0.18);
  }

  .variants-table th,
  .variants-table td,
  .legal-table th,
  .legal-table td {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 599px) {
  .search-wrap { display: none !important; }
  .header-search { display: block; padding: 0 0 10px; }
  .header-tools { margin-left: auto; }
  .brand-picker-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
  .grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }
  .card-photo {
    max-height: 280px;
    padding: 16px;
  }
  .card-body { padding: 12px 14px 14px; }
  .card-body h3 { font-size: 16px; }
  .price { font-size: 18px; }
  .card-actions .btn {
    min-height: 44px !important;
    font-size: 14px !important;
  }
}

@media (min-width: 600px) and (max-width: 980px) {
  .search-wrap {
    display: block !important;
    flex: 1 1 auto;
    max-width: none;
    min-width: 0;
    margin: 0 8px;
  }
  .search-wrap .search { height: 40px; width: 100%; }
  .header-search { display: none !important; }
  .header-tools { margin-left: 0; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .card-photo { max-height: 200px; }
  .brand-picker-grid {
    display: grid !important;
    overflow: visible;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  }
  .brand-pick {
    flex: none;
    min-height: 96px;
  }
}

@media (max-width: 380px) {
  .grid { gap: 8px; }
  .card-body h3 { font-size: 14px; }
  .price { font-size: 15px; }
  .card-actions .btn { font-size: 12px !important; padding: 0 4px; }
  .page-head h1 { font-size: 22px; }
  .icon-btn,
  .cart-btn,
  .burger {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
  }
}

@media (max-width: 640px) {
  .trust { grid-template-columns: 1fr !important; }
  .footer-grid { grid-template-columns: 1fr !important; }
  .dir-grid { grid-template-columns: 1fr !important; }
  .hero-actions .btn { width: 100%; }
  .oc-modal {
    align-items: stretch !important;
    padding: 0 !important;
    background: #fff !important;
  }
  .oc-card {
    display: block !important;
    width: 100% !important;
    max-height: none !important;
    height: auto !important;
    min-height: 100dvh;
    border-radius: 0 !important;
    background: #fff !important;
    box-shadow: none !important;
    padding: 14px 16px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
    overflow: visible !important;
  }
  .oc-card > * { margin-bottom: 12px; }
  .oc-card > *:last-child { margin-bottom: 0; }
  .oc-fields { display: grid !important; gap: 12px !important; }
  .oc-src {
    display: grid !important;
    grid-template-columns: 1fr 1fr 1fr !important;
    gap: 8px !important;
  }
  .oc-src-btn {
    -webkit-appearance: none !important;
    appearance: none !important;
    height: auto !important;
    min-height: 52px;
    width: 100%;
    flex-direction: column;
    color: #111113 !important;
    -webkit-text-fill-color: #111113 !important;
  }
  .oc-src-btn span {
    color: #111113 !important;
    -webkit-text-fill-color: #111113 !important;
  }
  .oc-bottom { margin-top: 4px; }
  .oc-submit { position: static !important; }
}
