/* Public storefront.
   One radius rule: 6px for controls and panels, 4px for images. */

.commerce-shell { flex: 1; display: flex; flex-direction: column; min-height: 100vh; background: var(--color-paper); }

/* Header */
.sf-header { background: var(--color-shell); color: var(--color-surface); }
.sf-header__bar {
  max-width: var(--layout-page-max-width); margin: 0 auto; padding: 0.7rem 1.25rem;
  display: flex; align-items: center; gap: 1.5rem;
}
.sf-brand {
  font-family: var(--font-display); font-weight: 700; font-size: 1.45rem;
  color: var(--color-surface); text-decoration: none; letter-spacing: -0.02em;
}
.sf-brand:hover { color: var(--color-surface); }
.sf-search { flex: 1; display: flex; min-width: 0; border-radius: var(--radius); overflow: hidden; background: var(--color-surface); }
.sf-search input[type="search"] {
  flex: 1; min-width: 0; border: 0; padding: 0.6rem 0.85rem; font-size: 0.95rem; color: var(--color-shell); background: var(--color-surface);
}
.sf-search input:focus-visible { outline-offset: -2px; }
.sf-search button {
  border: 0; background: var(--color-accent); color: var(--color-surface); padding: 0 1.2rem; font-weight: 600;
}
.sf-search button:hover { background: var(--color-accent-deep); }
.sf-header__actions { display: flex; align-items: center; gap: 1.1rem; white-space: nowrap; margin-left: auto; }
.sf-header__actions a, .sf-linkbtn {
  color: var(--shell-text); text-decoration: none; font-size: 0.9rem; background: none; border: 0; padding: 0;
}
.sf-header__actions a:hover, .sf-linkbtn:hover { color: var(--color-surface); text-decoration: underline; }
.sf-cart {
  border: 1px solid var(--shell-line-strong); border-radius: var(--radius); padding: 0.35rem 0.9rem; font-weight: 600;
  color: var(--color-surface); text-decoration: none; font-size: 0.9rem; white-space: nowrap;
}
.sf-cart:hover { color: var(--color-surface); background: var(--shell-hover); }
.sf-menu-toggle { display: none; }
.sf-categories { border-top: 1px dashed var(--shell-line-strong); }
.sf-categories__row {
  max-width: var(--layout-page-max-width); margin: 0 auto; padding: 0.55rem 1.25rem;
  display: flex; gap: 1.4rem; overflow-x: auto; scrollbar-width: thin;
}
.sf-categories__row a { color: var(--shell-text); text-decoration: none; font-size: 0.86rem; white-space: nowrap; }
.sf-categories__row a:hover { color: var(--color-surface); text-decoration: underline; }
.sf-categories__row a.is-active { color: var(--color-surface); font-weight: 600; text-decoration: underline; text-decoration-color: var(--color-accent-bright); text-decoration-thickness: 2px; text-underline-offset: 0.35em; }

.sf-main { flex: 1; width: 100%; max-width: var(--layout-page-max-width); margin: 0 auto; padding: 1.25rem 1.25rem 3rem; }

/* Footer */
.sf-footer { background: var(--color-shell); color: var(--shell-text-mute); font-size: 0.88rem; }
.sf-footer__inner {
  max-width: var(--layout-page-max-width); margin: 0 auto; padding: 1.8rem 1.25rem;
  display: flex; justify-content: space-between; gap: 2rem; flex-wrap: wrap;
}
.sf-footer__brand { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; color: var(--color-surface); }
.sf-footer p { margin: 0.3rem 0 0; max-width: 34ch; }
.sf-footer nav { display: flex; flex-direction: column; gap: 0.4rem; }
.sf-footer a { color: var(--shell-text); }
.sf-footer__legal { border-top: 1px dashed var(--shell-line-strong); text-align: center; padding: 0.9rem; font-size: 0.8rem; }

.commerce-breadcrumb { font-size: 0.85rem; color: var(--color-ink-mute); margin-bottom: 0.8rem; }
.commerce-breadcrumb a { color: var(--color-ink-soft); text-decoration: none; }
.commerce-breadcrumb a:hover { color: var(--color-accent); }

/* Home */
.sf-hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2.5rem; align-items: center;
  padding: 1rem 0 2rem; border-bottom: 1px dashed var(--color-ink-mute);
}
.sf-hero h1 { font-size: clamp(1.9rem, 3.4vw, 2.7rem); margin-bottom: 0.6rem; }
.sf-hero p { color: var(--color-ink-soft); font-size: 1.05rem; max-width: 46ch; margin-bottom: 1.25rem; }
.sf-search--lg { border: 2px solid var(--color-shell); max-width: 540px; }
.sf-search--lg input { padding: 0.8rem 1rem; }
.sf-search--lg button { padding: 0 1.6rem; }
.sf-hero__browse .sf-section__title { margin-bottom: 0.6rem; }
.sf-section { padding: 1.8rem 0 0; }
.sf-section__title { font-size: 1.15rem; margin-bottom: 0.9rem; }
.sf-shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); border-top: 1px solid var(--color-line); border-left: 1px solid var(--color-line); background: var(--color-surface); }
.sf-shortcuts a {
  padding: 1rem 1.1rem; border-right: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line);
  color: var(--color-shell); font-weight: 600; text-decoration: none;
}
.sf-shortcuts .sf-shortcuts__all { color: var(--color-accent); }
.sf-shortcuts a:hover { background: var(--color-accent-wash); color: var(--color-accent-deep); }
.sf-steps ol { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; counter-reset: s; }
.sf-steps li { counter-increment: s; color: var(--color-ink-soft); }
.sf-steps li::before { content: counter(s); display: block; font-family: var(--font-display); font-weight: 700; font-size: 1.6rem; color: var(--color-accent); }
.sf-steps strong { color: var(--color-shell); display: block; }

/* Listing */
.sf-listing { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 2rem; align-items: start; }
.sf-filters { position: sticky; top: 1rem; }
.sf-filters__store label { display: block; font-size: 0.8rem; color: var(--color-ink-mute); margin-bottom: 0.25rem; }
.sf-filters__title { font-size: 0.95rem; margin: 1.4rem 0 0.5rem; padding-top: 1rem; border-top: 1px dashed var(--color-ink-mute); }
.sf-catlist { list-style: none; margin: 0; padding: 0; }
.sf-catlist a { display: block; padding: 0.3rem 0.5rem; color: var(--color-ink-soft); text-decoration: none; font-size: 0.9rem; border-left: 3px solid transparent; }
.sf-catlist .is-child a { padding-left: 1.3rem; font-size: 0.85rem; }
.sf-catlist a:hover { color: var(--color-shell); background: var(--color-line-soft); }
.sf-catlist a.is-active { color: var(--color-accent-deep); font-weight: 600; border-left-color: var(--color-accent); background: var(--color-accent-wash); }
.sf-results__head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 0.5rem 1rem; }
.sf-sort { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; }
.sf-sort .form-select { width: auto; }
.sf-results__head h1 { font-size: 1.5rem; margin-bottom: 0.1rem; }
.sf-results__count { color: var(--color-ink-soft); font-size: 0.88rem; margin-bottom: 1rem; }

.sf-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  border-top: 1px solid var(--color-line); border-left: 1px solid var(--color-line); background: var(--color-surface);
}
.sf-item {
  display: flex; flex-direction: column; gap: 0.15rem; padding: 0.9rem;
  border-right: 1px solid var(--color-line); border-bottom: 1px solid var(--color-line);
  color: var(--color-shell); text-decoration: none;
}
.sf-item:hover { background: var(--tint-1); }
.sf-item:hover .sf-item__name { color: var(--color-accent); text-decoration: underline; }
.sf-item__img {
  aspect-ratio: 1 / 1; background: var(--color-line-soft); border-radius: var(--radius-sm); margin-bottom: 0.5rem;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  color: var(--color-ink-mute); font-size: 0.8rem; text-align: center; padding: 0.5rem;
}
.sf-item__img img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.sf-item__name { font-weight: 600; font-size: 0.95rem; line-height: 1.3; }
.sf-item__cat { font-size: 0.78rem; color: var(--color-ink-mute); }
.sf-item__price { font-size: 1.15rem; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: auto; padding-top: 0.4rem; }
.sf-item__price small { font-size: 0.78rem; font-weight: 500; color: var(--color-ink-mute); }
.sf-item__stock { font-size: 0.8rem; color: var(--color-ok); }
.sf-item__stock--out { color: var(--color-danger); margin-top: auto; padding-top: 0.4rem; }
.sf-item.is-out .sf-item__img, .sf-item.is-out .sf-item__name { opacity: 0.6; }

/* Details */
.sf-detail {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 320px; gap: 0 2rem; align-items: start;
  grid-template-areas: "gallery head buy" "gallery body buy";
  grid-template-rows: auto 1fr;
}
.sf-gallery { grid-area: gallery; }
.sf-detail__head { grid-area: head; }
.sf-detail__body { grid-area: body; padding-top: 0.5rem; }
.sf-buy { grid-area: buy; }
.sf-gallery__main {
  aspect-ratio: 1 / 1; background: var(--color-surface); border: 1px solid var(--color-line); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.sf-gallery__main img { width: 100%; height: 100%; object-fit: contain; }
.sf-gallery__main--empty { color: var(--color-ink-mute); }
.sf-gallery__thumbs { display: flex; gap: 0.5rem; margin-top: 0.6rem; flex-wrap: wrap; }
.sf-thumb { width: 64px; height: 64px; padding: 0; border: 1px solid var(--color-line); border-radius: var(--radius-sm); background: var(--color-surface); overflow: hidden; }
.sf-thumb:hover { border-color: var(--color-accent); }
.sf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sf-detail__head h1 { font-size: 1.6rem; margin-bottom: 0.2rem; }
.sf-detail__meta { color: var(--color-ink-mute); margin-bottom: 1rem; }
.sf-detail__h { font-size: 0.95rem; margin: 1.5rem 0 0.5rem; padding-top: 0.9rem; border-top: 1px dashed var(--color-ink-mute); }
.sf-specs { display: grid; grid-template-columns: 9rem 1fr; gap: 0.4rem 1rem; margin: 0; }
.sf-specs dt { color: var(--color-ink-mute); font-weight: 500; }
.sf-specs dd { margin: 0; }

.sf-buy {
  position: sticky; top: 1rem; background: var(--color-surface); border: 1px solid var(--color-line);
  border-top: 3px solid var(--color-accent); border-radius: var(--radius); padding: 1.1rem;
}
.sf-buy__price { font-size: 1.9rem; font-weight: 700; font-family: var(--font-display); font-variant-numeric: tabular-nums; line-height: 1.1; }
.sf-buy__price small { font-family: var(--font-family-base); font-size: 0.85rem; font-weight: 500; color: var(--color-ink-mute); }
.sf-buy__stock { color: var(--color-ok); font-size: 0.9rem; margin: 0.3rem 0 1rem; }
.sf-buy__stock--out { color: var(--color-danger); }
.sf-buy__label { display: block; font-size: 0.8rem; color: var(--color-ink-soft); margin-bottom: 0.25rem; }
.sf-stepper { display: flex; width: 9.5rem; border: 1px solid var(--color-line); border-radius: var(--radius); overflow: hidden; margin-bottom: 0.9rem; }
.sf-stepper button { width: 2.4rem; border: 0; background: var(--color-line-soft); font-size: 1.1rem; }
.sf-stepper button:hover { background: var(--color-line); }
.sf-stepper input { flex: 1; min-width: 0; border: 0; text-align: center; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.sf-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; }

@media (max-width: 991.98px) {
  .sf-detail { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "gallery head" "gallery buy" "body body"; grid-template-rows: auto auto; }
  .sf-buy { position: static; }

}
@media (max-width: 767.98px) {
  /* Phone header: brand + cart + account toggle on row 1, search on row 2, account links only when opened */
  .sf-header__bar { flex-wrap: wrap; gap: 0.6rem; padding: 0.6rem 1rem; }
  .sf-brand { order: 1; margin-right: auto; }
  .sf-cart { order: 2; }
  .sf-menu-toggle {
    order: 3; display: inline-block; min-height: 2.2rem; padding: 0.35rem 0.8rem; font-size: 0.9rem; font-weight: 600;
    color: #fff; background: transparent; border: 1px solid var(--shell-line-strong); border-radius: var(--radius);
  }
  .sf-search { order: 4; flex-basis: 100%; }
  .sf-header__actions { order: 5; flex-basis: 100%; display: none; flex-direction: column; align-items: stretch; gap: 0; }
  .sf-header.is-open .sf-header__actions { display: flex; }
  .sf-header__actions a, .sf-header__actions .sf-linkbtn { padding: 0.7rem 0.25rem; border-top: 1px solid var(--shell-line); text-align: left; }
  .sf-header__actions form { display: block; }
  .sf-header__actions .sf-linkbtn { width: 100%; }
  .sf-categories__row { padding: 0.55rem 1rem; }
  .sf-main { padding-left: 1rem; padding-right: 1rem; }
  .sf-hero, .sf-listing, .sf-steps ol { grid-template-columns: minmax(0, 1fr); }
  .sf-detail { grid-template-columns: minmax(0, 1fr); grid-template-areas: "head" "gallery" "buy" "body"; grid-template-rows: auto; }
  .sf-detail__head { margin-bottom: 0.9rem; }
  .sf-gallery { margin-bottom: 1rem; }
  .sf-buy { margin-bottom: 0.5rem; }
  .sf-filters { position: static; }
  /* the header category strip already covers this on phones */
  .sf-filters__title, .sf-catlist { display: none; }
  .sf-grid { grid-template-columns: repeat(2, 1fr); }
  .sf-specs { grid-template-columns: 7rem 1fr; }

}

/* One radius for storefront buttons (components.css uses a larger one) */
.sf-main .btn { border-radius: var(--radius); padding-top: 0.6rem; padding-bottom: 0.6rem; }

/* Color / selling unit options on the product page */
.sf-options { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sf-option {
  display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.75rem; border: 1px solid var(--color-line);
  border-radius: var(--radius); background: var(--color-surface); color: var(--color-shell); text-decoration: none; font-size: 0.9rem;
}
.sf-option:hover { border-color: var(--color-ink-soft); color: var(--color-shell); }
.sf-option.is-selected { border-color: var(--color-accent); background: var(--color-accent-wash); font-weight: 600; }
.sf-option.is-unavailable { color: var(--color-ink-mute); border-style: dashed; }
.sf-swatch { width: 14px; height: 14px; border-radius: var(--radius-sm); border: 1px solid rgba(0,0,0,0.2); }

/* A product with no photo should not push the price below the fold on phones */
@media (max-width: 767.98px) {
  .sf-gallery__main--empty { aspect-ratio: auto; padding: 1.4rem 1rem; font-size: 0.9rem; }

}
