.storefront { --store-header-offset: calc(90px + env(safe-area-inset-top, 0px)); }
.storefront .wrap { max-width: calc(100% - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)); }
.storefront .topbar {
  position: sticky;
  top: 0;
  z-index: 8;
  padding-top: env(safe-area-inset-top, 0px);
  background: #fbfcfe;
}
.storefront .topnav a { white-space: nowrap; }
.storefront .topnav a[aria-current] { color: var(--blue); }
.storefront .nav-order { border-radius: 999px; }
.nav-icon { display: none; }
.storefront :is(.selector-panel, #generation, #generation-title, .summary-panel, .product-images, #main) {
  scroll-margin-block-start: var(--store-header-offset);
}
.storefront .summary-panel { top: var(--store-header-offset); }

.storefront .button {
  border-radius: 999px;
  transition: background .18s, border-color .18s, box-shadow .18s, transform .18s ease-out;
}
.storefront .button:not(:disabled):active { transform: scale(.97); }

.storefront .hero { min-height: clamp(315px, 35vw, 420px); border-radius: 30px; }
.storefront .hero-visual { inset-inline-start: 24%; background-position: 63% 55%; }
.hero-custom-image { position: absolute; inset: 0 0 0 auto; z-index: -2; width: 64%; height: 100%; object-fit: cover; }
.generic-hero .hero-visual {
  inset: 0;
  background: radial-gradient(ellipse at 78% 30%, #4b83e3 0%, #1a4181 48%, #04123b 76%);
}
.storefront .hero-content { width: min(64%, 650px); padding: 42px 20px 48px clamp(30px, 5vw, 66px); }
.storefront .hero h1 { text-wrap: balance; overflow-wrap: anywhere; text-shadow: 0 1px 12px rgb(3 14 41 / 52%); }
.storefront .hero-caption { max-width: 28rem; color: #edf3ff; overflow-wrap: anywhere; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 22px; }
.hero-actions .hero-button { margin: 0; min-height: 44px; }
.hero-actions .hero-details {
  min-height: 44px;
  color: #fff;
  background: #1d3765;
  border-color: rgb(209 225 255 / 46%);
}
.hero-actions .hero-details:hover { background: #294878; }
.storefront-chevron {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline: 0 2px;
  border: solid currentColor;
  border-width: 1.5px 1.5px 0 0;
  transform: rotate(45deg);
}
.storefront .hero-credit { border-radius: 999px; }
.storefront .segmented, .storefront .stepper { border-radius: 999px; }
.storefront .segmented button { border-radius: 999px; }
.storefront .model-button { position: relative; }
.storefront .model-button[aria-pressed="true"]::after {
  content: "";
  position: absolute;
  inset: 9px 10px auto auto;
  width: 6px;
  height: 9px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.storefront .uploaded-thumb { object-fit: contain; object-position: center; background: #f0f2f5; }
.product-thumb-empty { display: none; }
.model-grid + .empty-product-options, [hidden] + .model-grid { margin-top: 16px; }
.empty-product-options { color: var(--muted); }
.summary-product-link { text-decoration: underline; text-underline-offset: 3px; }
.storefront :is(.checkout-bundle p, .selected-product p, .order-list-item strong) { overflow-wrap: anywhere; }

.unit-pricing { margin-top: 11px; }
.unit-pricing-values { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; }
.unit-pricing-values strong { color: var(--blue); font: 800 1.46rem/1.16 var(--numeric); font-variant-numeric: tabular-nums; }
.unit-pricing-values :is(.unit-label, del) { color: var(--muted); font-size: .875rem; white-space: nowrap; }
.unit-pricing-values del { font-variant-numeric: tabular-nums; }
.discount-badge, .stock-badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 740;
  line-height: 1.2;
  white-space: nowrap;
}
.discount-badge { gap: 5px; padding: 3px 8px; background: #fff0e6; color: #813917; border-color: #f8d9c6; }
.discount-badge b { padding-inline-start: 5px; border-inline-start: 1px solid #e6b79a; font-size: .8125rem; white-space: nowrap; }
.discount-badge.timed-discount { background: #ffe6d8; color: #882d14; border-color: #f1b79b; }
.promotion-deadline { color: #833d22; margin-top: 5px; font-size: .8125rem; font-variant-numeric: tabular-nums; }
.stock-badge { border-color: #efd37a; background: #fff3c1; color: #654811; }
.stock-badge.sold-out { border-color: #e2e7ef; background: #eef1f6; color: #4c5c75; }
.variant-button .sold-out-text { color: #596579; }
.storefront .option-sold-out, .storefront .option-sold-out:hover {
  color: #495365;
  background: #edf0f4;
  border-color: #d5dbe4;
}
.storefront .option-sold-out[aria-pressed="true"] {
  color: #394457;
  background: #e6eaf0;
  border-color: #808da0;
  box-shadow: inset 0 0 0 1px #808da0;
}
.storefront .button.primary.sold-out-purchase:disabled { border-color: #dce0e6; background: #e2e5ea; color: #4d586a; opacity: 1; }
.storefront .button.primary.stock-purchase:enabled { border-color: #dfaa26; background: #ffcf53; color: #382600; }
.storefront .button.primary.stock-purchase:enabled:hover { border-color: #cb9317; background: #f3bf37; }
.quantity-caption { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 7px; }
.selection-stock { margin-top: 9px; }

.checkout-unit-row { display: flex; align-items: baseline; flex-wrap: wrap; justify-content: space-between; gap: 5px 8px; margin-top: 10px; }
.checkout-unit-row .unit-pricing { margin: 0; }
.checkout-unit-row > :empty { display: none; }
.region-picker { display: grid; gap: 5px; min-width: 0; }
.region-picker > p:first-child { font-size: .9375rem; font-weight: 680; }
.region-selects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.region-selects > div { min-width: 0; }
.region-selects select {
  width: 100%;
  min-width: 0;
  min-height: 44px;
  padding: 6px 5px;
  border: 1px solid #d5dfee;
  border-radius: 9px;
  background: #fcfdff;
  color: var(--ink);
  font: 500 1rem var(--font);
  text-overflow: ellipsis;
}
.region-selects select:disabled { background: #f2f5fa; color: var(--muted); opacity: 1; }
.region-status, .checkout-privacy { color: var(--muted); font-size: .8125rem; }
.region-picker > .button { justify-self: start; min-height: 44px; }
.storefront .checkout-fields :is(input, select, textarea) { scroll-margin-block-start: var(--store-header-offset); }
.checkout-privacy { margin: 14px 0 7px; }
.checkout-privacy a { display: inline-block; padding-block: 5px; text-decoration: underline; text-underline-offset: 2px; }
#checkout-stock-retry { margin-top: 2px; min-height: 44px; }

.shipment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px 12px;
  margin-block: 0 14px;
  padding: 12px;
  border: 1px solid #cfe4da;
  border-radius: 17px;
  background: #f0f8f4;
}
.shipment-info { display: grid; min-width: 0; grid-template-columns: 35px minmax(0, 1fr); align-items: center; gap: 9px; }
.shipment-info div { display: grid; min-width: 0; gap: 2px; overflow-wrap: anywhere; }
.shipment-info div > span { color: #245840; font-size: .8125rem; font-weight: 720; }
.shipment-info strong { font: 720 1rem/1.28 ui-monospace, "SFMono-Regular", Menlo, monospace; }
.shipment-info small { color: #4e675d; font-size: .75rem; }
.shipment-icon { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 12px; background: #dbefe3; color: #2d6c4e; }
.shipment-icon::before { content: ""; width: 16px; height: 14px; border: 1.5px solid currentColor; border-radius: 3px; background: linear-gradient(currentColor, currentColor) center top / 1px 5px no-repeat; }
.shipment-card .button { min-width: 78px; min-height: 44px; color: #245840; border-color: #c0dccc; padding-inline: 10px; }
.shipment-card .button:hover { background: #e6f5ec; }
.shipment-card :is(.shipment-copy-input, .shipment-copy-feedback) { grid-column: 1 / -1; }
.shipment-copy-feedback { font-size: .8125rem; color: #245840; }
.shipment-compact { margin: 0 13px 13px; }

.product-back { margin: 0 0 12px; }
.product-page .store-notice { margin: 0 0 12px; }
.product-feature {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(20px, 4.2vw, 60px);
  padding: clamp(16px, 3.2vw, 40px);
}
.product-feature.image-free { grid-template-columns: minmax(0, 1fr); }
.product-copy h1 { font-size: clamp(2rem, 4.7vw, 3.95rem); font-weight: 820; letter-spacing: -.045em; text-wrap: balance; }
.product-copy :is(h1, p) { overflow-wrap: anywhere; }
.product-subtitle { color: var(--muted); margin-top: 12px; line-height: 1.65; }
.product-pricing { color: var(--muted); margin-top: 20px; font-size: .875rem; }
.product-pricing strong { color: var(--ink); font: 790 clamp(1.55rem, 3vw, 2.25rem)/1.1 var(--numeric); letter-spacing: -.05em; }
.product-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.product-media { position: relative; margin: 0; min-width: 0; }
.product-media img { border-radius: 18px; }
.product-media .product-sample { width: 100%; height: auto; }
.product-media figcaption {
  position: absolute;
  inset: auto 11px 11px auto;
  background: #0a1e49;
  color: #f3f6fd;
  border: 1px solid rgb(232 241 255 / 30%);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: .75rem;
}
.product-cover, .gallery-image {
  display: block;
  position: relative;
  overflow: hidden;
  width: 100%;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f0f3f8;
  color: var(--ink);
  cursor: zoom-in;
}
.product-cover { aspect-ratio: 4 / 3; max-height: 390px; }
.product-cover img { width: 100%; height: 100%; object-fit: contain; }
.product-description, .product-images { margin-top: 16px; padding: clamp(16px, 3.2vw, 32px); }
.product-description h2 { font-size: 1.3rem; letter-spacing: -.025em; }
.product-description p { margin-top: 10px; max-width: 70ch; color: var(--subtle); line-height: 1.75; white-space: pre-line; overflow-wrap: anywhere; }
.gallery-total { color: var(--muted); font-size: .875rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 172px), 1fr)); gap: 12px; margin-top: 17px; }
.gallery-image { aspect-ratio: 4 / 3; }
.gallery-image img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
:is(.gallery-image, .product-cover):hover { border-color: var(--blue); }
.gallery-expand {
  position: absolute;
  inset: auto 7px 7px auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 34px;
  min-height: 34px;
  padding: 0 9px;
  border-radius: 999px;
  background: #f7f9fc;
  box-shadow: 0 2px 10px rgb(18 38 73 / 12%);
  font-size: .8125rem;
  font-weight: 720;
}
.zoom-icon {
  position: relative;
  display: inline-block;
  width: 11px;
  height: 11px;
  margin: 0 3px 3px 0;
  border: 1.7px solid currentColor;
  border-radius: 50%;
  flex: 0 0 auto;
}
.zoom-icon::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 1.7px;
  background: currentColor;
  top: 7px;
  left: 6px;
  transform: rotate(45deg);
  transform-origin: left;
}

.product-viewer {
  position: fixed;
  inset: 0;
  margin: auto;
  padding: 0;
  width: min(910px, calc(100% - 34px));
  height: min(86vh, 860px);
  height: min(86dvh, 860px);
  max-width: none;
  max-height: none;
  border: 1px solid #ffffffa8;
  border-radius: 24px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 78px rgb(10 25 51 / 30%);
  overflow: hidden;
}
.product-viewer:not([open]) { display: none; }
.product-viewer[open] { animation: gallery-open .23s cubic-bezier(.2, .7, .2, 1) both; }
.product-viewer::backdrop { background: rgb(8 19 40 / 56%); backdrop-filter: blur(3px); }
.storefront:has(.product-viewer[open]) { overflow: hidden; }
@keyframes gallery-open {
  from { opacity: 0; transform: translateY(12px) scale(.987); }
  to { opacity: 1; transform: none; }
}
.viewer-layout { height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.viewer-header, .viewer-actions { padding: 9px clamp(10px, 2.3vw, 20px); }
.viewer-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.viewer-header h2 { font-size: 1rem; font-weight: 760; }
.viewer-header p { margin-top: 2px; font-size: .8125rem; line-height: 1.3; color: var(--muted); }
.viewer-close { width: 44px; height: 44px; border-radius: 999px; background: #ecf0f6; color: var(--ink); font: 550 1.65rem/1 var(--font); }
.viewer-close:hover { background: var(--blue-pale); }
.viewer-stage {
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding: clamp(8px, 1.8vw, 18px);
  background: #edf0f5;
  touch-action: pan-y pinch-zoom;
}
.viewer-stage:not([data-long]):not([data-zoom]) { display: flex; align-items: center; justify-content: center; }
.viewer-stage:focus-visible { outline-offset: -3px; }
.viewer-stage img { display: block; margin: 0 auto; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-stage[data-long] img { max-height: none; }
.viewer-stage[data-zoom] { touch-action: pan-x pan-y pinch-zoom; }
.viewer-stage[data-zoom] img { width: 175%; max-width: none; max-height: none; }
.viewer-error { text-align: center; color: var(--muted); padding: 12px; }
.viewer-actions { display: flex; justify-content: center; gap: clamp(6px, 2vw, 12px); border-top: 1px solid var(--line); }
.viewer-actions .button { padding-inline: clamp(9px, 3vw, 18px); }

.store-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 245px), 1fr)); gap: 14px; }
.store-product-card { overflow: hidden; display: flex; flex-direction: column; color: var(--ink); }
.store-product-card:hover { border-color: #8eabeb; }
.store-product-card > img { width: 100%; object-fit: cover; aspect-ratio: 3 / 2; }
.store-product-card-copy { flex: 1; display: grid; align-content: center; gap: 7px; padding: clamp(16px, 2.7vw, 24px); }
.store-product-card-copy h2 { font-size: 1.22rem; overflow-wrap: anywhere; }
.store-product-card-copy p { color: var(--muted); overflow-wrap: anywhere; }
.store-product-card-copy span { display: flex; align-items: center; gap: 4px; color: var(--blue); font-size: .875rem; font-weight: 700; }

@supports ((backdrop-filter: blur(2px)) or (-webkit-backdrop-filter: blur(2px))) {
  .storefront .topbar, .storefront .mobile-purchase, .storefront .topnav {
    background: rgb(249 251 254 / 86%);
    -webkit-backdrop-filter: saturate(155%) blur(18px);
    backdrop-filter: saturate(155%) blur(18px);
  }
  .hero-actions .hero-details {
    background: rgb(15 35 76 / 66%);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
}
@media (min-width: 641px) {
  .storefront .topnav { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (max-width: 800px) {
  .storefront .hero { min-height: 302px; }
  .storefront .hero-content { width: 66%; }
  .product-feature { gap: 22px; }
}

@media (max-width: 640px) {
  .storefront {
    --store-header-offset: calc(73px + env(safe-area-inset-top, 0px));
    --store-nav-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  }
  .storefront .topbar { background: #fbfcfe; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .storefront .topnav, .storefront .mobile-purchase {
    position: fixed;
    inset-inline: max(10px, env(safe-area-inset-left, 0px)) max(10px, env(safe-area-inset-right, 0px));
    border: 1px solid #dbe3ee;
    box-shadow: 0 6px 22px rgb(26 49 81 / 15%), inset 0 1px 0 #fff;
  }
  .storefront .topnav {
    bottom: var(--store-nav-bottom);
    display: flex;
    justify-content: center;
    align-items: stretch;
    width: min(100% - 20px, 440px);
    margin-inline: auto;
    padding: 4px;
    gap: 3px;
    border-radius: 999px;
    background-color: rgb(249 251 254 / 96%);
  }
  .storefront .topnav a {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 46px;
    gap: 3px;
    padding: 4px 3px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: .75rem;
    line-height: 1.2;
    transition: background .18s, color .18s, transform .18s ease-out;
  }
  .storefront .topnav a:active { transform: scale(.96); }
  .storefront .topnav a[aria-current] { background: #e3ebfb; color: #1a44ac; }
  .storefront .topnav .receipt-icon { display: inline-block; height: 15px; color: inherit; }
  .storefront .nav-icon { position: relative; display: inline-block; width: 16px; height: 15px; }
  .grid-icon {
    border: 1.5px solid currentColor;
    border-radius: 3px;
    background: linear-gradient(currentColor, currentColor) center / 1px 100% no-repeat,
      linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
  }
  .package-icon { border: 1.5px solid currentColor; border-radius: 3px; }
  .package-icon::before { content: ""; position: absolute; inset: 0 4px auto; height: 5px; border: 1px solid currentColor; border-top: 0; border-radius: 0 0 2px 2px; }
  .choose-icon { border: 1.5px solid currentColor; border-radius: 50%; width: 15px; }
  .choose-icon::before { content: ""; position: absolute; inset: 2px auto auto 4px; width: 4px; height: 7px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
  .storefront.checkout-page .topnav { display: none; }
  .storefront .hero { min-height: 283px; border-radius: 25px; }
  .storefront .hero-content { width: 100%; padding: 27px 21px 53px; }
  .storefront .hero h1 { max-width: 10em; font-size: clamp(2.05rem, 7.6vw, 3.3rem); }
  .storefront .hero-visual { inset-inline-start: 22%; background-position: 67% center; }
  .storefront .hero::after { background: linear-gradient(90deg, #04123b 0%, rgb(4 18 59 / 96%) 28%, rgb(4 18 59 / 72%) 58%, rgb(4 18 59 / 21%) 100%); }
  .storefront .hero-caption { max-width: 16rem; }
  .hero-actions { margin-top: 16px; }
  .hero-actions .button { padding: 8px 13px; font-size: .875rem; }
  .storefront .hero-credit { inset: auto 11px 10px auto; }
  .storefront .mobile-purchase {
    bottom: calc(var(--store-nav-bottom) + 62px);
    width: min(100% - 20px, 440px);
    margin-inline: auto;
    padding: 7px 7px 7px 12px;
    border-radius: 24px;
  }
  .storefront .mobile-base { width: 100%; gap: 8px; }
  .storefront .mobile-base > .button { min-width: 107px; min-height: 46px; padding-inline: 12px; }
  .storefront .mobile-selection > span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .storefront.shop-page .footer { padding-bottom: calc(149px + env(safe-area-inset-bottom, 0px)); }
  .storefront:not(.checkout-page):not(.shop-page) .footer { padding-bottom: calc(77px + env(safe-area-inset-bottom, 0px)); }
  .storefront.shop-page :is(#generation, #generation-title, .summary-panel) {
    scroll-margin-block-end: calc(144px + env(safe-area-inset-bottom, 0px));
  }
  .shipment-card { padding: 8px; gap: 6px; }
  .shipment-info { grid-template-columns: 31px minmax(0, 1fr); gap: 7px; }
  .shipment-icon { width: 31px; height: 31px; border-radius: 10px; }
  .shipment-info strong { font-size: .875rem; }
  .shipment-card .button { min-width: 76px; }

  .product-back { margin-bottom: 7px; }
  .product-feature { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .product-copy h1 { font-size: clamp(1.75rem, 8vw, 2.55rem); }
  .product-subtitle { margin-top: 6px; font-size: .9375rem; }
  .product-pricing { margin-top: 12px; }
  .product-actions { margin-top: 14px; }
  .product-cover { max-height: 280px; }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
  .gallery-image { border-radius: 12px; }
  .product-viewer {
    inset: auto 0 0;
    margin: 0;
    width: 100%;
    height: calc(100vh - 10px - env(safe-area-inset-top, 0px));
    height: calc(100dvh - 10px - env(safe-area-inset-top, 0px));
    border-radius: 23px 23px 0 0;
  }
  .viewer-header, .viewer-actions, .viewer-stage {
    padding-inline-start: max(10px, env(safe-area-inset-left, 0px));
    padding-inline-end: max(10px, env(safe-area-inset-right, 0px));
  }
  .viewer-actions { padding-bottom: calc(9px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 480px) {
  .region-selects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .region-selects > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 370px) {
  .region-selects { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: no-preference) {
  .storefront :is(.hero, .product-feature, .checkout-heading) {
    animation: storefront-enter .2s ease-out both;
  }
}
@keyframes storefront-enter {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .product-viewer[open] { animation: none; }
}
