/* Shared commerce recipes load after template layout rules. Templates own
   composition, not alternative field/button/elevation implementations. */
body { font-size: var(--sf-type-body); line-height: var(--sf-line-height-body); }
.section-head h1, .section-head h2 { font-size: var(--sf-type-title); }

.button, .button-secondary, .button-quiet,
.template-market .button, .template-market .button-secondary {
  min-height: var(--sf-action-height);
  padding: var(--sf-space-2) var(--sf-space-4);
  border-radius: var(--sf-shape-full);
  font-size: var(--sf-type-label);
  font-weight: 650;
  line-height: 1.4;
  transition: background-color var(--sf-motion-fast) var(--sf-easing);
}
.button:hover { background: color-mix(in srgb, var(--sf-color-primary) 92%, var(--sf-color-on-primary)); }
.button-secondary { color: var(--sf-color-primary-foreground); border-color: var(--sf-color-outline); background: transparent; }
.button-secondary:hover, .button-quiet:hover { background: var(--sf-color-primary-container); }
.button:disabled { color: var(--muted); background: var(--line); opacity: 1; }
.button-quiet { padding-inline: var(--sf-space-4); }

/* Keep actions on the input baseline, not stretched across the field's label. */
.classic-catalog-toolbar, .classic-quantity-row { align-items: end; }
.classic-hero-search { align-items: center; }
.classic-catalog-toolbar .field { min-inline-size: 0; }
.classic-hero-search .button, .gallery-catalog-search .button { flex-shrink: 0; }

.field input, .field textarea, .field select, .search-input,
.template-market .field input, .template-market .field textarea,
.template-market .field select, .template-market .search-input {
  min-height: var(--sf-action-height);
  border-radius: var(--sf-control-radius);
  border-color: var(--sf-color-outline);
  padding: var(--sf-space-3) var(--sf-space-4);
  background: var(--surface);
}

/* Use the same control height where a field and an action share a row. */
.classic-catalog-toolbar .field :is(input, select),
.classic-quantity-row .field input,
.classic-hero-search input,
.gallery-catalog-search input[type="search"] {
  min-block-size: var(--sf-action-height);
  padding-block: var(--sf-space-2);
  line-height: 1.4;
}

.field input:focus-visible, .field textarea:focus-visible,
.field select:focus-visible, .search-input:focus-visible {
  outline: 2px solid var(--sf-color-primary);
  outline-offset: 1px;
  border-color: transparent;
}
.field .input-validation-error { border-color: var(--danger); }
.field .input-validation-error:focus-visible { outline-color: var(--danger); }

.classic-product-card, .template-market .classic-product-card,
.template-showcase .classic-product-card {
  border-radius: var(--sf-card-radius);
  background: var(--sf-color-surface-container);
  box-shadow: none;
}
.classic-product-card:hover { transform: none; border-color: var(--sf-color-outline); }
.template-showcase .gallery-lead-product .classic-product-card,
.template-showcase .gallery-lead-product-second .classic-product-card { background: var(--sf-color-surface-container); }
.classic-product-body { padding: var(--sf-space-4); gap: var(--sf-space-2); }
.classic-product-media { background: var(--sf-color-surface-container-low); }
.classic-detail-media { border-radius: var(--sf-pane-radius); box-shadow: none; }
.classic-detail-buy, .template-market .classic-detail-buy, .template-market .summary-card {
  border: 1px solid var(--sf-color-outline-variant);
}
.classic-detail-buy, .summary-card, .checkout-form, .tracking-card, .success-card,
.template-showcase .classic-detail-buy, .template-showcase .summary-card,
.template-showcase .checkout-form, .template-showcase .tracking-card, .template-showcase .success-card {
  background: var(--sf-color-surface-container);
  border-radius: var(--sf-pane-radius);
  box-shadow: none;
  padding: var(--sf-space-6);
}
.classic-catalog-toolbar { background: var(--sf-color-surface-container-low); border-radius: var(--sf-pane-radius); }
.gallery-workspace { background: var(--sf-color-surface-container-low); box-shadow: none; }
.gallery-sidebar { background: var(--sf-color-surface-container-low); }
.summary-card, .template-market .summary-card, .template-showcase .summary-card,
.tracking-result, .template-showcase .tracking-result {
  background: var(--sf-color-surface-container-high);
}
.template-showcase .gallery-page-frame, .template-showcase .gallery-privacy-frame {
  border-radius: var(--sf-pane-radius);
  background: var(--sf-color-surface-container-low);
  box-shadow: none;
}
.classic-option-chip, .gallery-main-story a {
  min-height: var(--sf-action-height);
  border-radius: var(--sf-shape-full);
}
.classic-option-chip:hover { transform: none; }
.classic-option-chip.is-selected, .classic-option-chip[aria-checked="true"],
.template-showcase .classic-option-chip.is-selected, .template-showcase .classic-option-chip[aria-checked="true"] {
  color: var(--sf-color-on-primary-container);
  background: var(--sf-color-primary-container);
  border-color: var(--sf-color-primary);
}
.classic-option-chip:focus-visible { outline: 2px solid var(--sf-color-primary); outline-offset: 2px; }
.classic-hero-search { box-shadow: none; }
.availability { border-radius: var(--sf-shape-xs); }
.cart-item { border: 1px solid var(--line); border-radius: var(--sf-card-radius); padding: var(--sf-space-4); }
.cart-item:first-child, .cart-item:last-child, .cart-item:only-child { border-radius: var(--sf-card-radius); border: 1px solid var(--line); }
.quantity-control { border-radius: var(--sf-shape-full); }
.quantity-control button { width: var(--sf-action-height); height: var(--sf-action-height); }
.quantity-control button:hover { background: var(--sf-color-primary-container); }
.remove-button { min-height: var(--sf-action-height); padding-inline: var(--sf-space-3); }
.classic-quick-add, .icon-button, .icon-text-button, .classic-cart-link {
  min-height: var(--sf-action-height);
  min-width: var(--sf-action-height);
  border-radius: var(--sf-shape-full);
}
.classic-desktop-nav a[aria-current="page"], .classic-mobile-nav a[aria-current="page"] {
  color: var(--sf-color-on-primary-container);
  background: var(--sf-color-primary-container);
  border-radius: var(--sf-shape-full);
}
.success-symbol { color: var(--sf-color-on-success); }
.cart-count { color: var(--sf-color-on-primary-container); background: var(--sf-color-primary-container); }
.toast {
  max-width: min(420px, calc(100% - 32px));
  color: var(--sf-color-inverse-on-surface);
  background: var(--sf-color-inverse-surface);
  border-radius: var(--sf-shape-sm);
  box-shadow: var(--sf-shadow-floating);
}

/* Let the workspace wash show through Classic's text-only hero. Keep
   branded banners, cover images, artwork, and selected and hover states. */
.template-classic .classic-hero:not(.has-hero-image) { background: transparent; }
.template-classic .classic-hero:not(.has-hero-image)::before { background: none; }
html[data-surface-style="neutral"] .gallery-main-story:not(.has-hero-image) {
  background: var(--sf-color-surface-container-high);
}
html[data-surface-style="neutral"] .template-showcase .classic-product-media,
html[data-surface-style="neutral"] .template-showcase .classic-detail-media,
html[data-surface-style="neutral"] .template-showcase .cart-thumb-fallback {
  background: var(--sf-color-surface-container-low);
}

@media (max-width: 720px) {
  .classic-header-row { gap: var(--sf-space-2); }
  .classic-brand { min-width: 0; }
  .classic-brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .classic-header-actions { gap: var(--sf-space-1); flex-shrink: 0; }
  .classic-detail-buy, .summary-card, .checkout-form, .tracking-card, .success-card,
  .template-showcase .classic-detail-buy, .template-showcase .summary-card,
  .template-showcase .checkout-form, .template-showcase .tracking-card, .template-showcase .success-card {
    padding: var(--sf-space-4);
    margin-inline: 0;
  }
  .cart-item-side { grid-template-columns: 1fr auto; gap: var(--sf-space-2); }
  .cart-item-side .remove-button { grid-column: 2; }
  .classic-mobile-nav { bottom: max(8px, env(safe-area-inset-bottom)); box-shadow: var(--sf-shadow-floating); }
  .toast { inset-inline: var(--sf-space-4); inset-block-end: calc(88px + env(safe-area-inset-bottom)); }
  body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
}

@media (max-width: 430px) {
  .classic-quantity-row, .template-showcase .classic-quantity-row { grid-template-columns: minmax(0, 1fr); }
  .classic-quantity-row .field { max-width: 140px; }
  .classic-quantity-row .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
