:root {
  --mobile-commerce-tabbar-height: 4.25rem;
  --mobile-commerce-safe-bottom: env(safe-area-inset-bottom, 0px);
  --mobile-commerce-sheet-radius: 1.35rem;
  --mobile-commerce-touch: 3rem;
  --mobile-commerce-motion: 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (max-width: 1199.98px) {
  .site-main {
    padding-bottom: calc(var(--mobile-commerce-tabbar-height) + var(--mobile-commerce-safe-bottom) + 1rem);
  }

  .mobile-tabbar {
    z-index: 1080;
    min-height: var(--mobile-commerce-tabbar-height);
    padding: 0.35rem max(0.35rem, env(safe-area-inset-right)) var(--mobile-commerce-safe-bottom) max(0.35rem, env(safe-area-inset-left));
    gap: 0.15rem;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid rgba(7, 27, 47, 0.12);
    box-shadow: 0 -0.8rem 2.2rem rgba(4, 20, 37, 0.13);
    backdrop-filter: blur(18px) saturate(1.25);
  }

  .mobile-tabbar__item {
    position: relative;
    min-width: 0;
    min-height: 3.55rem;
    padding: 0.35rem 0.2rem;
    border-radius: 0.9rem;
    font-size: 0.69rem;
    font-weight: 650;
    touch-action: manipulation;
    transition: color var(--mobile-commerce-motion), background-color var(--mobile-commerce-motion), transform 120ms ease;
  }

  .mobile-tabbar__item:active {
    background: rgba(18, 103, 232, 0.09);
    transform: scale(0.96);
  }

  .mobile-tabbar__item.is-active::before,
  .mobile-tabbar__item[aria-current="page"]::before {
    position: absolute;
    top: 0.1rem;
    left: 50%;
    width: 1.45rem;
    height: 0.2rem;
    background: var(--at-accent);
    border-radius: 999px;
    content: "";
    transform: translateX(-50%);
  }

  .mobile-tabbar__icon {
    font-size: 1.28rem;
  }

  .mobile-tabbar__search {
    color: #fff;
  }

  .mobile-tabbar__search .mobile-tabbar__icon-wrap {
    display: grid;
    width: 2.8rem;
    height: 2.8rem;
    margin-top: -1.05rem;
    place-items: center;
    color: #fff;
    background: linear-gradient(145deg, #1267e8, #0b4fb9);
    border: 0.25rem solid #fff;
    border-radius: 50%;
    box-shadow: 0 0.75rem 1.7rem rgba(18, 103, 232, 0.3);
  }

  .mobile-tabbar__search span:last-child {
    color: var(--at-muted);
  }

  .mobile-tabbar__badge {
    position: absolute;
    top: 0.25rem;
    left: calc(50% + 0.45rem);
    min-width: 1.15rem;
    height: 1.15rem;
    margin: 0;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    line-height: 1;
  }

  .market-navbar {
    min-height: 4.15rem;
    padding-block: 0.45rem;
  }

  .market-navbar .navbar-toggler {
    width: 3rem;
    height: 3rem;
    padding: 0.55rem;
    border-color: rgba(255, 255, 255, 0.25);
    border-radius: 0.85rem;
    touch-action: manipulation;
  }

  .market-navbar__collapse {
    max-height: calc(100dvh - 5rem);
    padding: 0.85rem 0 1rem;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .market-navbar__collapse .market-global-search {
    display: none;
  }

  .market-navbar__collapse .nav-link,
  .market-navbar__collapse .market-nav-action {
    min-height: 3rem;
    justify-content: flex-start;
    padding: 0.7rem 0.8rem;
    border-radius: 0.8rem;
    touch-action: manipulation;
  }

  .market-navbar__actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
  }

  .market-nav-action span {
    display: flex;
  }

  .mobile-commerce-sheet[hidden] {
    display: none !important;
  }

  .mobile-commerce-sheet {
    position: fixed;
    inset: 0;
    z-index: 1110;
  }

  .mobile-commerce-sheet__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    padding: 0;
    background: rgba(4, 17, 30, 0.66);
    border: 0;
    backdrop-filter: blur(5px);
  }

  .mobile-commerce-sheet__panel {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    max-height: min(88dvh, 46rem);
    padding: 0.65rem max(1rem, env(safe-area-inset-right)) calc(1rem + var(--mobile-commerce-safe-bottom)) max(1rem, env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #102235;
    background: #fff;
    border-radius: var(--mobile-commerce-sheet-radius) var(--mobile-commerce-sheet-radius) 0 0;
    box-shadow: 0 -2rem 5rem rgba(4, 17, 30, 0.32);
    animation: mobile-commerce-sheet-enter 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .mobile-commerce-sheet__handle {
    width: 2.8rem;
    height: 0.28rem;
    margin: 0 auto 0.8rem;
    background: #d4dce5;
    border-radius: 999px;
  }

  .mobile-commerce-sheet__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
  }

  .mobile-commerce-sheet__header h2 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 780;
  }

  .mobile-commerce-sheet__close,
  .market-mobile-filter__close {
    display: grid;
    width: var(--mobile-commerce-touch);
    height: var(--mobile-commerce-touch);
    flex: 0 0 auto;
    place-items: center;
    color: #20384e;
    background: #f4f7fb;
    border: 1px solid rgba(16, 34, 53, 0.12);
    border-radius: 50%;
    touch-action: manipulation;
  }

  .mobile-commerce-search {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    min-height: 3.5rem;
    padding-left: 1rem;
    overflow: visible;
    background: #f5f8fc;
    border: 2px solid transparent;
    border-radius: 1rem;
  }

  .mobile-commerce-search:focus-within {
    background: #fff;
    border-color: #1267e8;
    box-shadow: 0 0 0 0.25rem rgba(18, 103, 232, 0.12);
  }

  .mobile-commerce-search input {
    min-width: 0;
    min-height: 3.35rem;
    padding: 0;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 1rem;
  }

  .mobile-commerce-search button {
    min-height: 3.35rem;
    padding-inline: 1rem;
    color: #fff;
    background: #1267e8;
    border: 0;
    border-radius: 0.85rem;
    font-weight: 750;
  }

  .mobile-commerce-search .market-search-results {
    top: calc(100% + 0.5rem);
    max-height: min(58dvh, 30rem);
  }

  .mobile-search-shortcuts,
  .mobile-recent-searches {
    margin-top: 1.25rem;
  }

  .mobile-search-shortcuts h3,
  .mobile-recent-searches h3 {
    margin-bottom: 0.7rem;
    color: #53667a;
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .mobile-search-shortcuts__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .mobile-search-shortcuts__grid a {
    display: flex;
    min-height: 3.7rem;
    align-items: center;
    gap: 0.7rem;
    padding: 0.75rem;
    color: #102235;
    background: #f7faff;
    border: 1px solid rgba(18, 103, 232, 0.1);
    border-radius: 0.9rem;
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    touch-action: manipulation;
  }

  .mobile-search-shortcuts__grid i {
    color: #1267e8;
    font-size: 1.1rem;
  }

  .mobile-recent-searches__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
  }

  .mobile-recent-searches__list button {
    min-height: 2.75rem;
    padding: 0.55rem 0.8rem;
    color: #34495f;
    background: #fff;
    border: 1px solid rgba(16, 34, 53, 0.14);
    border-radius: 999px;
    font-size: 0.8rem;
    touch-action: manipulation;
  }

  body.mobile-commerce-sheet-open,
  body.market-mobile-filter-open {
    overflow: hidden;
  }

  .market-mobile-filter {
    margin: 0.85rem 0 1rem;
  }

  .market-mobile-filter > summary {
    min-height: 3.25rem;
    padding: 0.75rem 0.9rem;
    list-style: none;
    background: #fff;
    border: 1px solid rgba(16, 34, 53, 0.12);
    border-radius: 0.95rem;
    box-shadow: 0 0.55rem 1.4rem rgba(8, 29, 50, 0.06);
    touch-action: manipulation;
  }

  .market-mobile-filter > summary::-webkit-details-marker {
    display: none;
  }

  .market-mobile-filter[open]::before {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(4, 17, 30, 0.66);
    backdrop-filter: blur(5px);
    content: "";
  }

  .market-mobile-filter[open] > summary {
    position: fixed;
    right: 1rem;
    bottom: calc(min(86dvh, 43rem) - 0.2rem);
    z-index: 1103;
    width: 3rem;
    height: 3rem;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    color: transparent;
    background: #f4f7fb;
    border-radius: 50%;
    box-shadow: none;
  }

  .market-mobile-filter[open] > summary::after {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: #20384e;
    content: "×";
    font-size: 1.6rem;
  }

  .market-mobile-filter__body {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1102;
    display: none;
    max-height: min(86dvh, 43rem);
    padding: 0.7rem max(1rem, env(safe-area-inset-right)) calc(1rem + var(--mobile-commerce-safe-bottom)) max(1rem, env(safe-area-inset-left));
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    border-radius: var(--mobile-commerce-sheet-radius) var(--mobile-commerce-sheet-radius) 0 0;
    box-shadow: 0 -2rem 5rem rgba(4, 17, 30, 0.32);
  }

  .market-mobile-filter[open] .market-mobile-filter__body {
    display: block;
    animation: mobile-commerce-sheet-enter 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .market-mobile-filter__sheet-head {
    position: sticky;
    top: -0.7rem;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin: -0.7rem -0.2rem 1rem;
    padding: 0.75rem 0.2rem;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
  }

  .market-mobile-filter__sheet-head strong {
    font-size: 1.1rem;
  }

  .market-mobile-filter .market-filter-form {
    gap: 1rem;
  }

  .market-mobile-filter .form-select,
  .market-mobile-filter .form-control,
  .market-mobile-filter .btn,
  .mobile-commerce-page .form-control,
  .mobile-commerce-page .form-select {
    min-height: 3rem;
    font-size: 1rem;
  }

  .market-mobile-filter .market-filter-form > .btn {
    min-height: 3.25rem;
  }

  .market-collection-strip,
  .market-subcategory-strip,
  .market-active-filters {
    margin-inline: -0.75rem;
    padding-inline: 0.75rem;
    scroll-padding-inline: 0.75rem;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .market-collection-chip,
  .market-filter-pill,
  .market-subcategory-strip a {
    min-height: 2.75rem;
    align-items: center;
    touch-action: manipulation;
  }

  .market-catalog-toolbar {
    align-items: flex-start;
  }

  .market-toolbar-controls,
  .market-toolbar-controls form {
    width: 100%;
  }

  .market-toolbar-controls .form-select {
    min-height: 3rem;
    font-size: 1rem;
  }

  .market-view-toggle button,
  .market-product-card__actions .btn,
  .market-product-card__actions button,
  .market-card-quick-view > summary {
    min-width: 2.9rem;
    min-height: 2.9rem;
    touch-action: manipulation;
  }

  .market-product-card__actions {
    grid-template-columns: minmax(0, 1fr) repeat(3, 2.9rem);
    gap: 0.45rem;
  }

  .market-product-card__actions > .btn:first-child {
    min-width: 0;
  }

  .market-product-card__description {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
  }

  .market-product-card__signals {
    gap: 0.35rem 0.6rem;
  }

  .market-product-card__signals span {
    font-size: 0.7rem;
  }

  .market-product-card:active,
  .market-purpose-card:active,
  .market-category-tile:active,
  .commercial-link-card:active,
  .guide-card:active {
    transform: scale(0.985);
  }

  .mobile-commerce-sticky-cta {
    position: fixed;
    right: 0;
    bottom: calc(var(--mobile-commerce-tabbar-height) + var(--mobile-commerce-safe-bottom));
    left: 0;
    z-index: 1075;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 0.7rem max(0.8rem, env(safe-area-inset-right)) 0.7rem max(0.8rem, env(safe-area-inset-left));
    background: rgba(255, 255, 255, 0.98);
    border-top: 1px solid rgba(16, 34, 53, 0.12);
    box-shadow: 0 -0.8rem 2rem rgba(4, 20, 37, 0.12);
    backdrop-filter: blur(14px);
  }

  .mobile-commerce-sticky-cta__copy {
    min-width: 0;
  }

  .mobile-commerce-sticky-cta__copy small,
  .mobile-commerce-sticky-cta__copy strong {
    display: block;
  }

  .mobile-commerce-sticky-cta__copy small {
    color: #607083;
    font-size: 0.68rem;
  }

  .mobile-commerce-sticky-cta__copy strong {
    color: #102235;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
  }

  .mobile-commerce-sticky-cta .btn {
    min-height: 3rem;
    flex: 0 0 auto;
    padding-inline: 1rem;
    font-weight: 750;
  }

  .mobile-commerce-page .site-main {
    padding-bottom: calc(var(--mobile-commerce-tabbar-height) + var(--mobile-commerce-safe-bottom) + 5.25rem);
  }

  .mobile-cart-page .table-responsive {
    overflow: visible;
  }

  .mobile-cart-page .cart-table,
  .mobile-cart-page .cart-table tbody,
  .mobile-cart-page .cart-table tr,
  .mobile-cart-page .cart-table td {
    display: block;
    width: 100%;
  }

  .mobile-cart-page .cart-table thead {
    display: none;
  }

  .mobile-cart-page .cart-table tbody {
    display: grid;
    gap: 0.8rem;
    padding: 0.8rem;
  }

  .mobile-cart-page .cart-table tr {
    padding: 0.95rem;
    background: #fff;
    border: 1px solid rgba(16, 34, 53, 0.1);
    border-radius: 1rem;
    box-shadow: 0 0.5rem 1.3rem rgba(8, 29, 50, 0.05);
  }

  .mobile-cart-page .cart-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.55rem 0;
    border: 0;
    text-align: right !important;
  }

  .mobile-cart-page .cart-table td:first-child {
    display: block;
    padding-top: 0;
    text-align: left !important;
  }

  .mobile-cart-page .cart-table td::before {
    color: #607083;
    content: attr(data-label);
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
  }

  .mobile-cart-page .cart-table td:first-child::before {
    display: none;
  }

  .mobile-cart-page .cart-quantity-input {
    width: 5.5rem;
    min-height: 2.9rem;
    margin: 0 !important;
    font-size: 1rem;
    text-align: center;
  }

  .mobile-cart-page .cart-line-remove {
    min-height: 2.75rem;
  }

  .mobile-checkout-progress {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.35rem;
    margin-bottom: 1rem;
  }

  .mobile-checkout-progress span {
    display: grid;
    min-height: 2.75rem;
    place-items: center;
    padding: 0.4rem;
    color: #607083;
    background: #f4f7fb;
    border: 1px solid rgba(16, 34, 53, 0.1);
    border-radius: 0.8rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
  }

  .mobile-checkout-progress span.is-current {
    color: #0b4fb9;
    background: rgba(18, 103, 232, 0.09);
    border-color: rgba(18, 103, 232, 0.22);
  }

  .mobile-checkout-page .checkout-summary-column {
    order: -1;
  }

  .mobile-checkout-page .checkout-safe-payment-card {
    display: none;
  }

  .mobile-checkout-page .checkout-inline-submit {
    display: none;
  }

  .mobile-checkout-page .form-check,
  .mobile-checkout-page .fulfillment-option {
    min-height: 3rem;
    touch-action: manipulation;
  }

  .mobile-checkout-page .fulfillment-option:active {
    transform: scale(0.985);
  }

  .mobile-checkout-page .card-body {
    padding: 1.1rem !important;
  }

  .mobile-checkout-page .checkout-summary-column .product-purchase-card {
    margin-bottom: 0 !important;
  }
}

@media (min-width: 576px) and (max-width: 767.98px) {
  .market-catalog-grid:not(.is-list),
  .market-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  .site-brand__copy small {
    display: none;
  }

  .market-catalog-grid,
  .market-product-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .market-product-card__media {
    min-height: 12rem;
  }

  .market-product-card__body {
    padding: 0.95rem;
  }

  .market-product-card__identity h3 {
    font-size: 1rem;
    line-height: 1.35;
  }

  .market-product-card__actions {
    grid-template-columns: minmax(0, 1fr) repeat(3, 2.9rem);
  }

  .market-card-quick-view__panel {
    width: calc(100vw - 1rem) !important;
    max-width: calc(100vw - 1rem) !important;
    max-height: calc(100dvh - var(--mobile-commerce-tabbar-height) - var(--mobile-commerce-safe-bottom) - 1rem);
    border-radius: 1rem !important;
  }

  .catalog-hero,
  .public-catalog-hero {
    margin-bottom: 1.25rem !important;
  }

  .mobile-cart-page .catalog-hero,
  .mobile-checkout-page .catalog-hero {
    padding-block: 0.5rem;
  }
}

@media (orientation: landscape) and (max-height: 540px) and (max-width: 1199.98px) {
  .mobile-commerce-sheet__panel,
  .market-mobile-filter__body {
    max-height: 94dvh;
  }

  .mobile-search-shortcuts {
    display: none;
  }
}

@keyframes mobile-commerce-sheet-enter {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-commerce-sheet__panel,
  .market-mobile-filter__body,
  .mobile-tabbar__item,
  .market-product-card,
  .fulfillment-option {
    animation: none !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
