/* Mobile storefront presentation layer. Business and checkout contracts remain in the existing views/scripts. */
.mobile-bottom-nav,
.mobile-purchase-bar,
.checkout-progress,
.checkout-step-actions,
.checkout-review {
  display: none;
}

.checkout-section-heading > small,
.checkout-section-heading > p,
.checkout-step[data-checkout-step="2"] > .checkout-section-heading {
  display: none;
}

@media (max-width: 760px) {
  :root {
    --sf-mobile-nav-height: 66px;
  }

  body {
    padding-block-end: calc(var(--sf-mobile-nav-height) + env(safe-area-inset-bottom));
  }

  body.has-mobile-purchase,
  body.has-mobile-checkout {
    padding-block-end: calc(78px + env(safe-area-inset-bottom));
  }

  .announcement {
    min-height: 26px;
    padding-block: 4px;
  }

  .header-row {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    grid-template-areas:
      "menu brand cart"
      "search search search";
    gap: 8px;
    padding: 8px 10px 9px;
  }

  .nav-toggle {
    grid-area: menu;
    display: grid;
    width: 38px;
    min-height: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid var(--sf-line);
    border-radius: 11px;
    background: var(--sf-surface);
    color: var(--sf-ink);
    font-size: 18px;
  }

  .brand {
    grid-area: brand;
    justify-self: start;
    gap: 8px;
    min-width: 0;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .brand-text {
    max-width: min(45vw, 180px);
    font-size: 17px;
  }

  .search {
    grid-area: search;
    height: 40px;
  }

  .cart-button {
    grid-area: cart;
    min-width: 42px;
    min-height: 38px;
    padding: 7px 9px;
  }

  .main-nav {
    z-index: 50;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 80;
    inset-inline: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    min-height: var(--sf-mobile-nav-height);
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--sf-line);
    background: rgba(255, 255, 255, .97);
    box-shadow: 0 -7px 24px rgba(23, 33, 43, .09);
    backdrop-filter: blur(12px);
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    display: flex;
    min-width: 0;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 1px;
    padding: 4px;
    border: 0;
    border-radius: 11px;
    background: transparent;
    color: var(--sf-muted);
    font: inherit;
    text-decoration: none;
  }

  .mobile-bottom-nav span {
    font-size: 22px;
    line-height: 1;
  }

  .mobile-bottom-nav b {
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-bottom-nav [aria-current="page"] {
    background: var(--sf-surface-soft);
    color: var(--sf-accent);
  }

  .has-mobile-purchase .mobile-bottom-nav,
  .has-mobile-checkout .mobile-bottom-nav {
    display: none;
  }

  .hero-shell {
    padding-block-start: 9px;
  }

  .hero-visual {
    min-height: 154px;
    max-height: 188px;
  }

  .hero-copy {
    padding: 18px 18px 21px;
  }

  .hero h1 {
    margin-block: 5px 8px;
    font-size: clamp(25px, 7.4vw, 31px);
    line-height: 1.22;
  }

  .hero p {
    display: -webkit-box;
    margin-block-end: 14px;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.65;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .hero-actions {
    gap: 8px;
  }

  .hero-actions .primary,
  .hero-actions .secondary {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 12px;
  }

  .category-section {
    padding-block-start: 7px;
  }

  .category-grid {
    padding-block-end: 5px;
  }

  .category-card {
    min-width: 132px;
    height: 86px;
  }

  .category-card span {
    padding: 9px;
    font-size: 12px;
  }

  .section {
    padding-block: 30px;
  }

  .section-head {
    margin-block-end: 14px;
  }

  .section-head h2 {
    font-size: 22px;
  }

  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .product-card {
    display: flex;
    min-width: 0;
    flex-direction: column;
  }

  .product-media {
    min-height: 0;
    aspect-ratio: 4 / 5;
  }

  .product-info {
    min-height: 86px;
    padding: 9px;
  }

  .product-info h3 {
    min-height: 34px;
    margin-block-end: 4px;
    font-size: 12px;
    line-height: 1.42;
  }

  .product-card > button {
    width: calc(100% - 14px);
    min-height: 36px;
    margin: 0 7px 7px;
    font-size: 10px;
  }

  .product-detail {
    margin-block-end: 20px;
    padding-block-end: 18px;
  }

  .gallery-stage {
    height: min(105vw, 430px);
  }

  .detail-copy .wide[data-product-add] {
    display: none;
  }

  .mobile-purchase-bar {
    position: fixed;
    z-index: 85;
    inset-inline: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: minmax(86px, auto) minmax(150px, 1fr);
    gap: 12px;
    align-items: center;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--sf-line);
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 -8px 28px rgba(23, 33, 43, .12);
  }

  .mobile-purchase-bar div {
    display: flex;
    min-width: 0;
    flex-direction: column;
  }

  .mobile-purchase-bar small {
    color: var(--sf-muted);
    font-size: 10px;
  }

  .mobile-purchase-bar b {
    color: var(--sf-ink);
    white-space: nowrap;
  }

  .mobile-purchase-bar .primary {
    min-height: 46px;
  }

  .page-title {
    padding: 25px 13px 15px;
  }

  .page-title h1 {
    font-size: 26px;
  }

  .page-title p {
    margin-block-end: 0;
    font-size: 13px;
  }

  .checkout {
    gap: 12px;
    margin-block-end: 18px;
    padding: 8px 10px;
  }

  .checkout-progress {
    display: block;
    grid-column: 1 / -1;
    position: sticky;
    z-index: 30;
    top: 0;
    padding: 8px 7px;
    border: 1px solid var(--sf-line);
    border-radius: 14px;
    background: rgba(255, 255, 255, .97);
    box-shadow: var(--sf-shadow-sm);
  }

  .checkout-progress ol {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .checkout-progress li {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 3px;
    border-radius: 9px;
    color: var(--sf-muted);
  }

  .checkout-progress li span {
    display: grid;
    width: 21px;
    height: 21px;
    place-items: center;
    border: 1px solid var(--sf-line);
    border-radius: 50%;
    font-size: 10px;
  }

  .checkout-progress li b {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .checkout-progress li[aria-current="step"] {
    background: var(--sf-surface-soft);
    color: var(--sf-accent);
  }

  .checkout.is-stepped .checkout-step,
  .checkout.is-stepped .checkout-products {
    display: none;
  }

  .checkout.is-stepped[data-checkout-current="1"] [data-checkout-step="1"],
  .checkout.is-stepped[data-checkout-current="2"] [data-checkout-step="2"],
  .checkout.is-stepped[data-checkout-current="3"] [data-checkout-step="3"],
  .checkout.is-stepped[data-checkout-current="3"] .checkout-products {
    display: block;
  }

  .checkout.is-stepped[data-checkout-current="3"] .checkout-products {
    order: 2;
  }

  .checkout.is-stepped[data-checkout-current="3"] .customer-form {
    order: 3;
  }

  .checkout-products,
  .customer-form {
    min-width: 0;
  }

  .customer-form {
    padding: 16px;
  }

  .checkout-step[data-checkout-step="2"] > .checkout-section-heading {
    display: block;
  }

  .checkout-section-heading {
    margin-block-end: 14px;
  }

  .checkout-section-heading small {
    display: inline;
    color: var(--sf-accent);
    font-size: 10px;
    font-weight: 800;
  }

  .checkout-section-heading h2 {
    margin: 2px 0 3px;
    font-size: 20px;
  }

  .checkout-section-heading p {
    display: block;
    margin: 0;
    color: var(--sf-muted);
    font-size: 12px;
  }

  .checkout-line {
    grid-template-columns: 72px minmax(0, 1fr);
    margin-block-end: 8px;
    padding: 8px;
  }

  .checkout-line img {
    width: 72px;
    height: 92px;
  }

  .customer-form input,
  .customer-form select,
  .customer-form textarea {
    min-height: 45px;
    font-size: 16px;
  }

  .checkout-step-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 9px;
    margin-block-start: 17px;
    padding-block-start: 13px;
    border-top: 1px solid var(--sf-line);
  }

  .checkout-step-actions button {
    min-height: 45px;
    padding: 9px 16px;
  }

  .checkout-step-actions .primary {
    flex: 1;
  }

  .checkout-review-card,
  .checkout-review-delivery {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin-block-end: 9px;
    padding: 12px;
    border: 1px solid var(--sf-line);
    border-radius: 12px;
    background: var(--sf-surface-soft);
  }

  .checkout-review-card div,
  .checkout-review-delivery {
    min-width: 0;
    flex-direction: column;
  }

  .checkout-review-card span,
  .checkout-review-delivery span,
  .checkout-review-card small,
  .checkout-review-delivery small {
    color: var(--sf-muted);
    font-size: 11px;
  }

  .checkout-review-card b {
    display: block;
    margin-block: 2px;
  }

  .checkout-review-card button {
    flex: 0 0 auto;
    padding: 4px 7px;
    border: 0;
    background: transparent;
    color: var(--sf-accent);
    font-weight: 700;
  }

  .checkout-review-delivery {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .checkout-review-delivery small {
    grid-column: 1 / -1;
  }

  .checkout-confirm-note {
    margin: 12px 0 0;
    color: var(--sf-muted);
    font-size: 11px;
    line-height: 1.6;
  }

  .checkout-final-actions {
    position: sticky;
    bottom: 0;
    margin-inline: -16px;
    margin-block-end: -16px;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, .98);
  }

  .checkout-final-actions [type="submit"] {
    min-height: 48px;
  }

  .checkout [aria-busy="true"] {
    opacity: .68;
    pointer-events: none;
  }

  .success {
    margin: 20px auto 26px;
    padding: 25px 15px;
  }

  .success-icon {
    width: 56px;
    height: 56px;
    font-size: 27px;
  }

  .success h1 {
    font-size: 25px;
  }

  footer {
    gap: 20px;
    padding: 31px 20px;
  }

  footer > div {
    min-width: 0;
  }
}

@media (max-width: 390px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .product-card {
    display: flex;
    grid-template-columns: none;
  }

  .product-media {
    min-height: 0;
    aspect-ratio: 4 / 5;
  }

  .product-info {
    min-height: 84px;
  }

  .product-card > button {
    grid-column: auto;
  }

  .checkout-progress li b {
    font-size: 9px;
  }

  .checkout-step-actions button {
    padding-inline: 11px;
    font-size: 12px;
  }
}

@media (min-width: 761px) {
  .mobile-bottom-nav,
  .mobile-purchase-bar,
  .checkout-progress,
  .checkout-step-actions {
    display: none !important;
  }
}
