/* The last catalog card starts a new row at the left edge. */
.storefront .showcase-grid { justify-content: flex-start; }

/* A direct route into the product list from the category showcase heading. */
.storefront .showcase-header-all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  gap: 10px;
  min-height: 48px;
  padding: 0 21px;
  border: 1px solid rgba(255, 255, 255, .72);
  border-radius: 12px;
  background: #fff;
  color: #ae1930;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(84, 10, 27, .11);
  transition: transform .2s ease, box-shadow .2s ease;
}
.storefront .showcase-header-all:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 19px rgba(84, 10, 27, .18);
}
.storefront .showcase-header-all svg { width: 16px; height: 16px; flex: none; }
.storefront .showcase-header-all:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.storefront .showcase-header-all[hidden] { display: none; }

@media (max-width: 800px) {
  /* Keep the existing scroll position and header, but present catalog as a page. */
  body.storefront.category-menu-open::before,
  body.storefront.category-menu-closing::before {
    content: none !important;
    display: none !important;
    backdrop-filter: none !important;
  }

  .storefront .category-mega {
    position: fixed;
    inset: var(--category-screen-top, 129px) 0 0;
    display: flex;
    width: 100%;
    height: auto;
    max-height: none;
    overflow: hidden;
    border: 0;
    border-top: 1px solid #e5eaf0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
  .storefront .category-mega:not([hidden]),
  .storefront .category-mega.is-closing {
    opacity: 1;
    transform: none;
    animation: none;
  }
  .storefront .category-mega.is-closing { pointer-events: none; }
  .storefront .category-mega-inner {
    box-sizing: border-box;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    background: #fff;
    transition: opacity .2s ease, transform .2s ease;
  }
  .storefront .category-mega.is-open .category-mega-inner {
    animation: category-screen-content-in .22s ease-out both;
  }
  .storefront .category-mega.is-closing .category-mega-inner {
    opacity: 0;
    transform: translateY(-5px);
  }
  .storefront .category-mega-heading {
    flex: none;
    min-height: 66px;
    margin: 0;
    padding: 10px 16px;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
  }
  .storefront .category-mega-heading > div {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
  .storefront .category-mega-heading > div > .section-kicker {
    display: block;
    color: #c51b2d;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .12em;
  }
  .storefront .category-mega-heading strong { font-size: 20px; }
  .storefront .category-mega-controls {
    flex: none;
    width: 100%;
    margin: 0;
    padding: 10px 16px;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
  }
  .storefront .category-mega .category-all {
    justify-content: center;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    height: 44px;
    border-color: #c51b2d;
    border-radius: 10px;
    background: #c51b2d;
    color: #fff;
    font-size: 12px;
  }
  .storefront .category-mega .category-all:hover,
  .storefront .category-mega .category-all.active {
    border-color: #b21831;
    background: #b21831;
    color: #fff;
  }
  .storefront .mega-category-grid,
  .storefront .mega-cards {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }
  .storefront .mega-cards {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0;
    padding: 0 0 max(12px, env(safe-area-inset-bottom));
    background: #fff;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .storefront .mega-card,
  .storefront .mega-all-card {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 20px;
    align-items: center;
    flex: none;
    width: 100%;
    min-height: 68px;
    margin: 0;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid #ecf0f3;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    animation: none;
  }
  .storefront .mega-card:hover,
  .storefront .mega-card:focus-visible,
  .storefront .mega-card:active {
    border-color: #ecf0f3;
    background: #fff6f8;
    box-shadow: none;
    transform: none;
  }
  .storefront .mega-all-card { background: #fff5f7; }
  .storefront .mega-card.is-selected,
  .storefront .mega-card.is-current { background: #fff1f4; }
  .storefront .mega-card-name {
    color: #203249;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.36;
  }
  .storefront .mega-card-meta {
    color: #6d7d90;
    font-size: 11px;
    line-height: 1.35;
  }
  .storefront .mega-cards.is-stepping[data-direction="forward"] .mega-card,
  .storefront .mega-cards.is-stepping[data-direction="back"] .mega-card {
    animation: category-screen-row-in .2s ease-out both;
  }

  /* Inner pages use the same catalog screen and list rhythm. */
  .inner-category-backdrop { display: none !important; }
  .inner-category-drawer,
  .inner-category-drawer.is-open {
    position: fixed;
    top: var(--inner-category-top, 129px);
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    width: 100%;
    height: auto;
    max-height: none;
    overflow: hidden;
    border: 0;
    border-top: 1px solid #e5eaf0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    opacity: 1;
    transform: none;
    transition: none;
  }
  .inner-category-drawer[hidden] { display: none !important; }
  .inner-category-drawer.is-open .inner-category-shell {
    animation: category-screen-content-in .22s ease-out both;
  }
  .inner-category-shell {
    box-sizing: border-box;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
    background: #fff;
    transition: opacity .2s ease, transform .2s ease;
  }
  .inner-category-drawer:not(.is-open) .inner-category-shell {
    opacity: 0;
    transform: translateY(-5px);
  }
  .inner-category-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    flex: none;
    min-height: 0;
    margin: 0;
    padding: 12px 16px;
    border-bottom: 1px solid #edf0f4;
    background: #fff;
  }
  .inner-category-title-wrap { grid-column: 1; grid-row: 1; }
  .inner-category-actions { grid-column: 2; grid-row: 1; }
  .inner-category-title { font-size: 20px; }
  .inner-category-all {
    grid-column: 1 / -1;
    grid-row: 2;
    flex: none;
    align-self: stretch;
    justify-content: center;
    min-height: 44px;
    margin: 0;
    padding: 0 14px;
    border-radius: 10px;
    font-size: 12px;
  }
  .inner-category-grid,
  .inner-category-grid.is-sublevel {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding: 0 0 max(12px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
  .inner-category-card,
  .inner-category-grid.is-sublevel .inner-category-card {
    min-height: 68px;
    gap: 12px;
    padding: 10px 16px;
    border: 0;
    border-bottom: 1px solid #ecf0f3;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    transform: none;
  }
  .inner-category-card:hover,
  .inner-category-card:active {
    border-color: #ecf0f3;
    background: #fff6f8;
    box-shadow: none;
    transform: none;
  }
  .inner-category-icon,
  .inner-category-grid.is-sublevel .inner-category-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }
  .inner-category-icon img,
  .inner-category-grid.is-sublevel .inner-category-icon img {
    width: 38px;
    height: 38px;
  }
  .inner-category-name,
  .inner-category-grid.is-sublevel .inner-category-name {
    font-size: 14px;
    line-height: 1.36;
  }
  .inner-category-meta { font-size: 11px; }
  .inner-category-chevron { font-size: 20px; }

  .storefront .showcase-header-all {
    align-self: flex-start;
    min-height: 48px;
    padding-inline: 18px;
  }
}

/* The direct route into a selected section is a primary action. */
@media (min-width: 801px) {
  .storefront .category-mega-controls { justify-content: flex-start; }
  .storefront .category-mega .category-all {
    display: inline-flex;
    justify-content: center;
    width: min(360px, 100%);
    min-height: 44px;
    border-color: #c51b2d;
    background: #c51b2d;
    color: #fff;
    font-size: 12px;
  }
  .storefront .category-mega .category-all:hover,
  .storefront .category-mega .category-all.active {
    border-color: #ad1428;
    background: #ad1428;
    color: #fff;
  }
}
.storefront .category-mega[data-view="children"] .category-mega-controls { display: none; }
.storefront .category-mega .mega-all-card {
  grid-column: 1 / -1;
  min-height: 76px;
  margin: 0;
  padding: 13px 16px;
  border-color: #ad1831;
  border-radius: 13px;
  background: linear-gradient(110deg, #a90f2c, #c91d37 70%, #db2a44);
  box-shadow: 0 8px 18px rgba(157, 18, 45, .16);
}
.storefront .category-mega .mega-all-card:hover,
.storefront .category-mega .mega-all-card:focus-visible,
.storefront .category-mega .mega-all-card.is-current {
  border-color: #a30f29;
  background: linear-gradient(110deg, #980e28, #b81932 70%, #cb243d);
  box-shadow: 0 10px 22px rgba(157, 18, 45, .22);
}
.storefront .category-mega .mega-all-card .mega-card-icon {
  width: 46px;
  height: 46px;
  border-color: #fff;
  background: #fff;
}
.storefront .category-mega .mega-all-card .mega-card-name {
  color: #fff;
  font-size: 15px;
  font-weight: 800;
}
.storefront .category-mega .mega-all-card .mega-card-meta {
  color: #ffe0e6;
  font-size: 11px;
}
.storefront .category-mega .mega-all-card .mega-card-arrow {
  width: 20px;
  height: 20px;
  color: #fff;
}
.storefront .showcase-all-link {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 10px;
  font-size: 12px;
  box-shadow: 0 6px 14px rgba(157, 18, 45, .14);
}
@media (max-width: 800px) {
  .storefront .category-mega .mega-all-card {
    min-height: 78px;
    margin: 2px 0 7px;
    padding: 12px;
    transform: none;
  }
  .storefront .category-mega .mega-all-card .mega-card-icon { width: 44px; height: 44px; }
  .storefront .category-mega .mega-all-card .mega-card-name { font-size: 14px; }
  .storefront .showcase-all-link { width: 100%; justify-content: center; }
}

@keyframes category-screen-content-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes category-screen-row-in {
  from { opacity: .6; transform: translateX(5px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .storefront .showcase-header-all,
  .storefront .category-mega-inner,
  .storefront .mega-card,
  .inner-category-shell,
  .inner-category-drawer,
  .inner-category-card { transition: none !important; animation: none !important; }
  .storefront .category-mega.is-open .category-mega-inner,
  .inner-category-drawer.is-open .inner-category-shell,
  .storefront .mega-cards.is-stepping .mega-card { animation: none !important; }
}
