/* نظام الجوال المستقل. لا يغيّر تنسيق الشاشات الأوسع من 480. */
.m-ptop { display: none; }
.m-dock, .m-sheet, .m-sheet-back, .m-head-cart { display: none; }

@media (max-width: 480px) {
  :root { --m-dock: calc(74px + env(safe-area-inset-bottom)); }
  body {
    padding-bottom: var(--m-dock);
    text-align: start;
  }
  body:has(.product-actions) { padding-bottom: calc(var(--m-dock) + 68px); }

  .site-header {
    position: relative;
    height: auto;
    min-height: 64px;
    padding: 8px 16px;
    gap: 12px;
  }
  .site-header .brand { display: flex; flex: 1 1 auto; min-width: 0; }
  .site-header .brand .logo-full { display: block; height: 68px; width: auto; max-width: none; }
  .nav-toggle,
  .site-header .head-link[href="/desk#follow"] { display: none; }
  .head-actions { flex: 0 0 auto; margin-inline-start: auto; gap: 2px; }
  .theme-toggle { width: 44px; height: 48px; }
  .site-header .head-link[href="/login"],
  .m-head-cart {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 58px;
    min-height: 48px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--ink);
    font-family: Alexandria, sans-serif;
    font-size: 10px;
    font-weight: 700;
    line-height: 12px;
    cursor: pointer;
  }
  .site-header .head-link[href="/login"] .tile,
  .m-head-cart .tile { width: 28px; height: 32px; }
  .site-header .head-link[href="/login"] span,
  .m-head-cart span {
    position: static;
    width: auto;
    max-width: 58px;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
    text-align: center;
    font-size: 10px;
    line-height: 12px;
  }
  .site-nav,
  html.nav-open .site-nav,
  html.nav-collapsed .site-nav {
    display: none;
    visibility: hidden;
    pointer-events: none;
    transform: none;
  }
  html.nav-open .nav-backdrop { display: none; pointer-events: none; }
  html.nav-open,
  html.nav-open body { overflow: visible; }

  .wrap,
  .faq-page .wrap,
  .desk-page .wrap { width: calc(100% - 32px); }
  .band .wrap { padding: 16px; border-radius: 12px; }
  .band + .band, .home-grid, .faq-home, .desk-home { margin-top: 24px; }
  .home-grid, .faq-grid, .desk-home-grid, .promo-grid, .promo-grid.cols-3, .promo-grid.cols-4 {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  body.home .promo h2,
  body.home .summary h2,
  body.home .faq-lead h2,
  body.home .footer-card h2,
  .dept-head h2,
  .page-intro h1,
  .policy-mast h1,
  .policy-page h1,
  .block-head h2,
  .faq-lead h1,
  .copy-title {
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
  }
  .back-home { display: none; }
  .page-intro { padding: 8px 0 0; }
  .split, .path, .flow, .stack, .stack.c4, .cards, .rows, .versus,
  .policy-nav, .desk-static, .desk-choices {
    grid-template-columns: 1fr;
  }
  .path span::after, .flow span::after, .desk-path li::after { display: none; }
  .block-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
  .hero-mark { display: flex; justify-content: flex-start; }
  .hero-mark .tile, .block-head .tile { width: 56px; height: 64px; }
  .band { padding-top: 8px; }
  .subcat-head h3,
  body.home .faq-q,
  .detail-topic-head h3,
  .opt-block h2,
  .visual-opts h2 {
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
  }
  body.home .summary .desc,
  body.home .faq-lead p,
  body.home .faq-a-inner p,
  body.home .prose p,
  body.home .footer-card > p,
  body.home .promo-lead,
  body.home .promo-quote,
  body.home .promo-card p,
  body.home .dialog-box p,
  .prose p,
  .lead,
  .summary .desc,
  .summary li,
  .faq-a-inner p,
  .policy-clauses p,
  .policy-clauses li,
  .detail-list li,
  .copy-card {
    max-width: none;
    margin-bottom: 16px;
    text-align: start;
    font-size: 16px;
    line-height: 26px;
    font-weight: 400;
  }
  body.home .promo-kicker,
  body.home .faq-lead .sub,
  body.home .footer-kicker,
  body.home .footer-name,
  body.home .endmark span,
  .crumb,
  .field-hint,
  .cat-kicker,
  .sku-chip,
  .footer-copy {
    font-size: 13px;
    line-height: 18px;
    font-weight: 400;
  }
  .more,
  button.more,
  .view-btn,
  .dept-chip,
  .back-home {
    min-height: 48px;
    padding-inline: 16px;
    border-radius: 12px;
    font-size: 15px;
    line-height: 20px;
    font-weight: 600;
  }
  .more:active,
  button:active,
  .m-dock a:active,
  .acc-link:active,
  .detail-open:active {
    opacity: .8;
    transform: scale(0.98);
    transition: opacity .1s linear, transform .1s linear;
  }
  input,
  select,
  textarea,
  .catalog-search input,
  .opt-line input,
  .opt-line textarea,
  .opt-line select {
    min-height: 48px;
    font-size: 16px;
    line-height: 24px;
    border-radius: 12px;
  }
  .qty-btn { width: 48px; height: 48px; min-height: 48px; }

  .catalog-tools {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    align-items: stretch;
  }
  .catalog-tools .cart-open { display: none; }
  .view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    border-radius: 12px;
    padding: 4px;
  }
  .view-btn { min-height: 48px; border-radius: 8px; }
  .catalog-grid.is-list .cat-card { align-items: center; }
  .catalog-grid.is-list .cat-foot { align-items: flex-start; }
  .catalog-grid.is-list .blurb { -webkit-line-clamp: 2; }

  .catalog-grid:not(.is-list) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }
  .catalog-grid:not(.is-list) .cat-card {
    padding: 12px;
    gap: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
  }
  .catalog-grid:not(.is-list) .cat-visual-wrap {
    aspect-ratio: 1;
    border-radius: 8px;
  }
  .catalog-grid:not(.is-list) .cat-card b {
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    min-height: 40px;
    -webkit-line-clamp: 2;
  }
  .catalog-grid .offer-price,
  .cat-foot .offer-price {
    font-size: 16px;
    line-height: 24px;
    font-weight: 700;
    color: var(--amber);
  }
  .cat-badge,
  .option-flag {
    font-size: 12px;
    line-height: 16px;
    border-radius: 4px;
    background: #f6f4f0;
    color: var(--ink);
  }
  .catalog-grid.is-list { grid-template-columns: 1fr; gap: 16px; }
  .catalog-grid.is-list .cat-card {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
  }
  .catalog-grid.is-list .cat-visual-wrap {
    width: 96px;
    height: 96px;
    border-radius: 8px;
  }

  .m-ptop {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
    min-height: 56px;
    padding: 4px 8px;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
  }
  .m-ptop .m-cart { display: none; }
  .m-back,
  .m-cart {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    flex: none;
  }
  .page-intro.product-top,
  .dept-filter,
  .crumb,
  .section-intro { display: none; }
  .m-ptitle { display: none; }
  .m-ptitle {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: Alexandria, sans-serif;
    font-size: 16px;
    line-height: 22px;
    font-weight: 500;
  }
  .product-gallery {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: none;
    position: static;
    box-sizing: border-box;
  }
  .gallery-stage { width: 100%; overflow: hidden; border-radius: 8px; }
  .product-photo {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 280px;
    aspect-ratio: 1;
    border-radius: 8px;
    object-fit: contain;
    display: block;
  }
  .zoom-bar { width: 100%; margin: 8px 0 0; }
  .zoom-btn { width: 100%; box-sizing: border-box; }
  .product-form.product-layout { display: flex; flex-direction: column; gap: 16px; }
  .media-col { display: contents; }
  .product-gallery { order: 1; }
  .product-identity { order: 2; }
  .visual-opts { order: 3; }
  .buy-panel { order: 4; }
  .buy-panel.will-rise,
  .buy-panel.will-rise.is-shown { transform: none; opacity: 1; }
  .site-main:has(.product-sheet) { display: flex; flex-direction: column; }
  .site-main:has(.product-sheet) > .band { order: 3; }
  .site-main:has(.product-sheet) > .detail-rail { order: 4; }
  .gal-btn { width: 48px; height: 48px; }
  .gal-dots { gap: 0; }
  .gal-dot,
  .gal-dot.is-on {
    width: 48px;
    height: 48px;
    min-height: 48px;
    background: transparent;
    position: relative;
  }
  .gal-dot::after {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--line);
    display: block;
    margin: auto;
  }
  .gal-dot.is-on::after { background: var(--teal); }
  .nameplate h1,
  .product-identity h1 {
    font-size: 18px;
    line-height: 24px;
    font-weight: 700;
  }
  .product-price {
    font-size: 16px;
    line-height: 22px;
    font-weight: 700;
    color: var(--amber);
  }
  .product-actions {
    position: fixed;
    inset-inline: 0;
    bottom: var(--m-dock);
    z-index: 75;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0;
    padding: 8px 16px;
    background: var(--surface);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .04);
  }
  .product-actions .more { min-height: 52px; width: 100%; }
  .product-actions .more:only-child { grid-column: 1 / -1; }
  .detail-rail .copy-title {
    font-size: 16px;
    line-height: 22px;
    font-weight: 600;
  }
  .visual-opts .opt-set,
  .opt-block .opt-set:has(> .opt-choice),
  .party-set {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: stretch;
  }
  .visual-opts .opt-set > legend,
  .opt-block .opt-set:has(> .opt-choice) > legend,
  .party-set > legend,
  .contact-set > .opt-line,
  .contact-set > .field-hint,
  .contact-set > .time-row,
  .contact-set > .party-set,
  .contact-set > .ship-set { grid-column: 1 / -1; }
  .contact-set { grid-template-columns: 1fr; }
  .time-row { width: 100%; }
  .opt-choice {
    width: 100%;
    min-height: 48px;
    margin: 0;
    box-sizing: border-box;
    align-items: center;
  }
  .opt-choice span { min-width: 0; }
  .detail-titles { display: grid; gap: 8px; }
  .detail-open {
    width: 100%;
    min-height: 48px;
    border-radius: 12px;
    justify-content: flex-start;
    font-size: 15px;
    line-height: 20px;
    font-weight: 600;
  }
  .detail-titles .detail-topic { margin: 0; border-radius: 12px; }
  .detail-titles .detail-topic[hidden] { display: none; }
  .detail-list li { max-width: none; font-size: 16px; line-height: 26px; }
  .ship-dialog[open],
  .detail-dialog[open] {
    padding: 8px;
    place-items: start center;
  }
  .tgm-box { width: 100%; max-height: calc(100dvh - 16px); }
  .tgm-stage { height: 32vh; min-height: 180px; }
  .tgm-acts { grid-template-columns: 1fr; }
  .tgm-short-row { grid-template-columns: 1fr; }
  .tgm-lay button { font-size: 11px; }
  .tgm-foot { display: grid; grid-template-columns: 1fr; }
  .detail-sheet { width: 100%; max-height: calc(100dvh - 16px); overflow: auto; }

  .summary,
  .faq-item,
  .footer-card,
  .promo-card,
  .pay-card {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .04);
  }
  .pay-title-18 { font-size: 16px; line-height: 22px; font-weight: 600; }
  .pay-title-14 { font-size: 16px; line-height: 26px; font-weight: 400; }

  .whatsapp-float { bottom: calc(var(--m-dock) + 12px); }
  body:has(.product-actions) .whatsapp-float { bottom: calc(var(--m-dock) + 80px); }

  .m-sheet-back {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    background: rgba(10, 31, 68, .28);
  }
  .m-sheet {
    display: block;
    position: fixed;
    inset-inline: 0;
    bottom: var(--m-dock);
    z-index: 75;
    max-height: min(52vh, 420px);
    overflow: auto;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .04);
  }
  .m-sheet[hidden], .m-sheet-back[hidden] { display: none; }
  .m-sheet-list { display: grid; gap: 8px; padding: 12px 16px 16px; }
  .m-sheet-list a {
    display: flex;
    align-items: center;
    min-height: 48px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--paper);
    color: var(--ink);
    text-decoration: none;
    font-family: Alexandria, sans-serif;
    font-size: 15px;
    font-weight: 600;
    line-height: 20px;
  }
  .m-sheet-list a.is-on { border-color: var(--teal); }
  .m-dock {
    display: flex;
    position: fixed;
    inset-inline: 0;
    bottom: 0;
    z-index: 80;
    height: var(--m-dock);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, .04);
  }
  .m-dock a,
  .m-dock button {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 0;
    min-height: 48px;
    padding: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    text-decoration: none;
    font-family: Alexandria, sans-serif;
    font-size: 9px;
    line-height: 12px;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
  }
  .m-dock a span,
  .m-dock button span {
    display: block;
    max-width: 100%;
    white-space: normal;
  }
  .m-dock .tile { width: 22px; height: 26px; }
  .m-dock a.is-on,
  .m-dock button.is-on,
  .m-dock button[aria-expanded="true"] { color: var(--ink); }

  @media (prefers-reduced-motion: no-preference) {
    .site-main { animation: m-fade .3s ease-out; }
    .will-rise.is-shown { transition: opacity .3s ease-out, transform .3s ease-out; }
  }
}

@keyframes m-fade {
  from { opacity: .01; }
  to { opacity: 1; }
}

@media (max-width: 480px) and (prefers-reduced-motion: reduce) {
  .more:active,
  button:active,
  .m-dock a:active,
  .acc-link:active,
  .detail-open:active { transform: none; }
  .site-main { animation: none; }
}
