.merchant-storefront {
  min-height: 100vh;
  background: #faf8f4;
  color: #181613;
}

.storefront-header,
.storefront-hero,
.storefront-band,
.storefront-products,
.storefront-footer {
  width: min(1180px, calc(100% - 32px));
  margin-inline: auto;
}

.storefront-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(120px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 22px 0;
}

.storefront-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 600;
}

.storefront-brand span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(24, 22, 19, 0.16);
  border-radius: 50%;
  background: #f0e6d8;
  font-size: 12px;
}

.storefront-brand strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.storefront-header nav,
.storefront-footer nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(14px, 3vw, 28px);
  color: rgba(24, 22, 19, 0.68);
  font-size: 14px;
}

.storefront-header nav a:hover,
.storefront-footer nav a:hover,
.storefront-link:hover {
  color: #181613;
}

.storefront-cart {
  justify-self: end;
  border: 1px solid rgba(24, 22, 19, 0.16);
  border-radius: 999px;
  background: #ffffff;
  color: #181613;
  padding: 9px 15px;
  box-shadow: 0 8px 24px rgba(24, 22, 19, 0.08);
}

.storefront-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(300px, 0.8fr);
  gap: clamp(28px, 6vw, 78px);
  align-items: center;
  padding: clamp(44px, 8vw, 92px) 0 clamp(28px, 5vw, 64px);
}

.storefront-hero__copy {
  display: grid;
  gap: 22px;
}

.storefront-eyebrow {
  color: #8a4f2b;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.storefront-hero h1 {
  max-width: 10ch;
  font-family: var(--font-display);
  font-size: clamp(58px, 11vw, 132px);
  font-weight: 400;
  letter-spacing: 0;
  line-height: 0.92;
}

.storefront-hero p {
  max-width: 520px;
  color: rgba(24, 22, 19, 0.68);
  font-size: clamp(17px, 2vw, 21px);
}

.storefront-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
}

.storefront-button,
.storefront-product button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: #181613;
  color: #ffffff;
  padding: 0 20px;
  font-weight: 700;
}

.storefront-link {
  color: rgba(24, 22, 19, 0.62);
  font-weight: 600;
}

.storefront-notice {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto 18px;
  border: 1px solid rgba(24, 22, 19, 0.14);
  border-radius: 8px;
  background: #ffffff;
  padding: 13px 16px;
  color: rgba(24, 22, 19, 0.76);
  font-size: 14px;
  font-weight: 600;
}

.storefront-notice--success {
  border-color: rgba(22, 101, 52, 0.24);
  color: #166534;
}

.storefront-notice--error {
  border-color: rgba(190, 18, 60, 0.24);
  color: #be123c;
}

.storefront-hero__visual {
  position: relative;
  display: grid;
  place-items: end start;
  min-height: clamp(360px, 48vw, 620px);
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0)),
    linear-gradient(135deg, #403226 0%, #c8824f 46%, #efe0c8 100%);
  box-shadow: 0 26px 80px rgba(24, 22, 19, 0.18);
}

.storefront-hero__visual div {
  position: absolute;
  inset: 34px;
  border: 1px solid rgba(255, 255, 255, 0.32);
}

.storefront-hero__visual span {
  position: relative;
  padding: 32px;
  color: #fffaf1;
  font-family: var(--font-display);
  font-size: clamp(44px, 6vw, 86px);
  line-height: 0.95;
  letter-spacing: 0;
}

.storefront-band {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(24, 22, 19, 0.14);
  border-bottom: 1px solid rgba(24, 22, 19, 0.14);
}

.storefront-band div {
  display: grid;
  gap: 4px;
  padding: 22px 10px;
}

.storefront-band div + div {
  border-left: 1px solid rgba(24, 22, 19, 0.14);
}

.storefront-band strong {
  font-size: 14px;
}

.storefront-band span {
  color: rgba(24, 22, 19, 0.58);
  font-size: 13px;
}

.storefront-products {
  padding: clamp(48px, 8vw, 92px) 0;
}

.storefront-legal {
  width: min(780px, calc(100% - 32px));
  margin-inline: auto;
  padding: clamp(48px, 8vw, 88px) 0 clamp(64px, 9vw, 110px);
}

.storefront-legal h1 {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(42px, 7vw, 78px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: 0;
}

.storefront-legal__meta {
  margin-top: 14px;
  color: rgba(24, 22, 19, 0.58);
  font-size: 15px;
}

.storefront-legal__content {
  display: grid;
  gap: 18px;
  margin-top: 34px;
  color: rgba(24, 22, 19, 0.76);
  font-size: 17px;
  line-height: 1.72;
}

.storefront-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.storefront-section-head h2 {
  font-size: clamp(32px, 4.5vw, 56px);
  letter-spacing: 0;
}

.storefront-product-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.storefront-product {
  display: grid;
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(24, 22, 19, 0.12);
  border-radius: 8px;
  background: #ffffff;
}

.storefront-product__media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  background: #e7ddcf;
}

.storefront-product:nth-child(2n) .storefront-product__media { background: #d8e7df; }
.storefront-product:nth-child(3n) .storefront-product__media { background: #d9d7e9; }

.storefront-product__media span {
  color: rgba(24, 22, 19, 0.2);
  font-family: var(--font-display);
  font-size: clamp(72px, 11vw, 132px);
  line-height: 1;
}

.storefront-product__body {
  display: grid;
  gap: 18px;
  padding: 16px;
}

.storefront-product h3 {
  font-size: 18px;
  letter-spacing: 0;
}

.storefront-product p {
  margin-top: 4px;
  color: rgba(24, 22, 19, 0.58);
  font-size: 13px;
}

.storefront-product__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.storefront-product button {
  min-height: 36px;
  padding-inline: 14px;
  font-size: 13px;
}

.storefront-buy-form {
  flex: 0 0 auto;
}

.storefront-product button:disabled {
  background: rgba(24, 22, 19, 0.12);
  color: rgba(24, 22, 19, 0.5);
  cursor: not-allowed;
}

.storefront-empty {
  grid-column: 1 / -1;
  border: 1px solid rgba(24, 22, 19, 0.12);
  border-radius: 8px;
  background: #ffffff;
  padding: 28px;
}

.storefront-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-top: 1px solid rgba(24, 22, 19, 0.14);
  padding: 24px 0 34px;
  color: rgba(24, 22, 19, 0.6);
  font-size: 14px;
}

/* ---------- Mini-cart drawer ---------- */
.cart-drawer {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.cart-drawer[hidden] {
  display: none;
}

.cart-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(24, 22, 19, 0.42);
  opacity: 0;
  transition: opacity 200ms ease;
}

.cart-drawer.is-open .cart-drawer-overlay {
  opacity: 1;
}

.cart-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  background: #fffaf3;
  box-shadow: -16px 0 48px rgba(24, 22, 19, 0.18);
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.cart-drawer.is-open .cart-drawer-panel {
  transform: translateX(0);
}

.cart-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(24, 22, 19, 0.1);
}

.cart-drawer-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: 0;
}

.cart-drawer-close {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: rgba(24, 22, 19, 0.7);
}

.cart-drawer-close:hover {
  background: rgba(24, 22, 19, 0.06);
  color: #181613;
}

.cart-drawer-items {
  flex: 1;
  overflow-y: auto;
  padding: 14px 18px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cart-drawer-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(24, 22, 19, 0.08);
}

.cart-drawer-item:last-child {
  border-bottom: 0;
}

.cart-drawer-item__media {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f0e6d8;
  overflow: hidden;
}

.cart-drawer-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-drawer-item__media span {
  font-family: var(--font-display);
  font-size: 28px;
  color: rgba(24, 22, 19, 0.4);
}

.cart-drawer-item__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cart-drawer-item__body strong {
  font-size: 14px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-drawer-item__body > span {
  color: rgba(24, 22, 19, 0.6);
  font-size: 12px;
}

.cart-drawer-qty {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  border: 1px solid rgba(24, 22, 19, 0.16);
  border-radius: 999px;
  overflow: hidden;
  width: fit-content;
}

.cart-drawer-qty button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  color: #181613;
}

.cart-drawer-qty button:hover {
  background: rgba(24, 22, 19, 0.06);
}

.cart-drawer-qty__value {
  min-width: 28px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}

.cart-drawer-item__total {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}

.cart-drawer-empty,
.cart-drawer-loading {
  margin: 16px 0;
  text-align: center;
  color: rgba(24, 22, 19, 0.6);
  font-size: 14px;
}

.cart-drawer-footer {
  border-top: 1px solid rgba(24, 22, 19, 0.1);
  padding: 16px 18px 20px;
  background: #fff;
}

.cart-drawer-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 14px;
}

.cart-drawer-total strong {
  font-size: 18px;
}

.cart-drawer-actions {
  display: grid;
  gap: 8px;
}

.storefront-button--secondary {
  background: #fff;
  color: #181613;
  border: 1px solid rgba(24, 22, 19, 0.16);
}

body.cart-drawer-open {
  overflow: hidden;
}

/* ---------- Toasts ---------- */
.storefront-toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.storefront-toast {
  pointer-events: auto;
  background: #181613;
  color: #fffaf3;
  padding: 12px 16px;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(24, 22, 19, 0.22);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.storefront-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.storefront-toast--error {
  background: #be123c;
  color: #fff;
}

/* ---------- Recently viewed ---------- */
.storefront-recently-viewed {
  margin-top: 56px;
}

/* ---------- Hover quick add on product card ---------- */
.storefront-product {
  position: relative;
}

.storefront-product__quick-add {
  position: absolute;
  inset: auto 12px 12px 12px;
  display: none;
  justify-content: center;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  border: 0;
  border-radius: 999px;
  background: #181613;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(24, 22, 19, 0.18);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 160ms ease, transform 160ms ease;
}

@media (hover: hover) {
  .storefront-product:hover .storefront-product__quick-add {
    display: inline-flex;
    opacity: 1;
    transform: translateY(0);
  }
}

.storefront-product__quick-add:focus-visible {
  display: inline-flex;
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Empty states ---------- */
.storefront-empty-illustration {
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #fffaf3 0 28%, transparent 32%),
    linear-gradient(135deg, #f0e6d8 0%, #c8824f 100%);
  box-shadow: inset 0 0 0 4px rgba(24, 22, 19, 0.05);
}

.storefront-empty-illustration::after {
  content: '';
  width: 36px;
  height: 32px;
  border: 3px solid #181613;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  position: relative;
}

.storefront-empty-illustration::before {
  content: '';
  position: absolute;
  width: 24px;
  height: 12px;
  border: 3px solid #181613;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  margin-top: -8px;
}

.storefront-empty {
  display: grid;
  gap: 10px;
  padding: 32px 28px;
  text-align: center;
}

.storefront-empty strong {
  font-size: 17px;
}

.storefront-empty p {
  margin: 0 auto;
  max-width: 36ch;
  color: rgba(24, 22, 19, 0.6);
  font-size: 14px;
}

.storefront-empty-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 6px;
}

/* ---------- Sticky add-to-cart (mobile) ---------- */
.storefront-sticky-buy {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0));
  background: #ffffff;
  border-top: 1px solid rgba(24, 22, 19, 0.12);
  box-shadow: 0 -10px 30px rgba(24, 22, 19, 0.08);
  transform: translateY(100%);
  transition: transform 200ms ease;
}

.storefront-sticky-buy.is-visible {
  transform: translateY(0);
}

.storefront-sticky-buy__price {
  font-weight: 700;
  font-size: 16px;
}

.storefront-sticky-buy button {
  flex: 0 0 auto;
}

@media (max-width: 720px) {
  .storefront-sticky-buy {
    display: flex;
  }
}

@media (max-width: 900px) {
  .storefront-header {
    grid-template-columns: 1fr auto;
  }

  .storefront-header nav {
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .storefront-hero {
    grid-template-columns: 1fr;
  }

  .storefront-hero h1 {
    max-width: 8ch;
  }

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

@media (max-width: 620px) {
  .cart-drawer-panel {
    width: 100%;
  }

  .storefront-header,
  .storefront-hero,
  .storefront-band,
  .storefront-products,
  .storefront-footer {
    width: min(100% - 24px, 1180px);
  }

  .storefront-band,
  .storefront-footer,
  .storefront-section-head {
    display: grid;
    grid-template-columns: 1fr;
  }

  .storefront-band div + div {
    border-left: 0;
    border-top: 1px solid rgba(24, 22, 19, 0.14);
  }

  .storefront-product-grid {
    grid-template-columns: 1fr;
  }

  .storefront-footer nav {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}

/* Mobile-first storefront overrides for merchants and shoppers on phones. */
@media (max-width: 720px) {
  /* Two columns on small tablets / large phones. */
  .storefront-product-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .storefront-hero {
    padding: 48px 20px;
  }

  .storefront-hero h1 {
    font-size: clamp(28px, 8vw, 40px);
  }

  /* Cart table: stacked rendering for tiny screens. */
  .storefront-cart-table {
    font-size: 14px;
  }

  .storefront-cart-table thead,
  .storefront-cart-table__head {
    display: none;
  }

  .storefront-cart-table tr,
  .storefront-cart-table__row {
    display: block;
    padding: 12px 0;
    border-bottom: 1px solid rgba(24, 22, 19, 0.14);
  }

  .storefront-cart-table td,
  .storefront-cart-table__cell {
    display: block;
    padding: 4px 0;
  }

  .storefront-cart-table td[data-label]::before,
  .storefront-cart-table__cell[data-label]::before,
  .storefront-cart-table__product[data-label]::before {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: rgba(24, 22, 19, 0.6);
  }

  /* Larger touch targets for primary CTAs. */
  .storefront-button,
  .storefront-add-cart,
  .storefront-buy-form button {
    width: 100%;
    min-height: 48px;
  }

  /* In-card buy buttons stay compact but full-width inside cards. */
  .storefront-product .storefront-buy-form button,
  .storefront-product button {
    width: 100%;
    min-height: 44px;
  }

  /* Cart link in header keeps its compact size. */
  .storefront-header .storefront-cart {
    width: auto;
    min-height: 40px;
  }

  /* Quantity selectors */
  .storefront-qty input,
  .storefront-qty button {
    min-height: 44px;
    min-width: 44px;
    font-size: 16px;
  }

  /* Form controls — prevent iOS zoom on focus. */
  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="search"],
  input[type="number"],
  input[type="tel"],
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Product detail page: stack gallery + info on phones. */
  .storefront-product-detail {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 420px) {
  .storefront-product-grid {
    grid-template-columns: 1fr;
  }
}
