:root {
  color-scheme: light;
  --brand-primary: #111111;
  --brand-secondary: #ffffff;
  --brand-accent: #475569;
  --surface: #ffffff;
  --surface-soft: #f4f6f8;
  --ink: #171717;
  --muted: #64748b;
  --line: #dbe2ea;
  --radius: 0.5rem;
  --button-radius: 0.5rem;
  --tenant-font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-family: var(--tenant-font-family);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--surface-soft);
  color: var(--ink);
}

a { color: inherit; text-decoration: none; }

.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 800;
}

.brand-mark {
  width: 0.85rem;
  height: 0.85rem;
  background: var(--brand-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--muted);
}

.button {
  border: 0;
  border-radius: var(--button-radius);
  background: var(--brand-primary);
  color: var(--brand-secondary);
  font-weight: 700;
  cursor: pointer;
}

.button.compact {
  padding: 0.7rem 0.9rem;
}

main {
  display: grid;
  gap: 1.25rem;
}

.hero {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.hero-copy {
  display: grid;
  gap: 0.75rem;
}

.eyebrow {
  margin: 0;
  color: var(--brand-accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  max-width: 14ch;
  font-size: clamp(2rem, 8vw, 3.5rem);
  line-height: 0.98;
}

.hero p {
  margin: 0;
  max-width: 40rem;
  color: var(--muted);
}

.hero-panel {
  display: grid;
  gap: 0.35rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.hero-panel span {
  color: var(--muted);
}

.catalog-shell {
  display: grid;
  gap: 1rem;
}

.section-heading {
  display: grid;
  gap: 0.8rem;
  padding: 0 1rem;
}

.section-heading h2,
.company h2 {
  margin: 0.25rem 0 0;
  font-size: 1.35rem;
}

.filters {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
}

.filter {
  white-space: nowrap;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
  color: var(--muted);
}

.filter.is-active {
  color: var(--brand-secondary);
  border-color: var(--brand-primary);
  background: var(--brand-primary);
}

.catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  padding: 0 1rem;
}

.product-card {
  min-height: 260px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transform: translateY(12px);
  opacity: 0;
  transition: transform 400ms ease, opacity 400ms ease, box-shadow 200ms ease;
}

.product-card.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.product-card:hover {
  box-shadow: 0 18px 40px rgb(15 23 42 / 0.1);
}

.product-card img,
.product-media {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #e5e7eb;
}

.product-content {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem;
}

.product-title {
  margin: 0;
  font-size: 1rem;
}

.product-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.price {
  font-weight: 800;
  color: var(--brand-primary);
}

.empty-state {
  display: grid;
  gap: 0.45rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.empty-state p,
.company p,
.footer span {
  margin: 0;
  color: var(--muted);
}

.auth-pending #profile,
.auth-pending #orders {
  display: none;
}

.secure-shell {
  display: grid;
  gap: 0.45rem;
}

.company {
  display: grid;
  gap: 0.8rem;
  margin: 0 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 1rem;
  border-top: 1px solid var(--line);
}

.skeleton {
  min-height: 260px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, #e5e7eb, #f8fafc, #e5e7eb);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  to { background-position-x: -200%; }
}

.product-media-shell {
  position: relative;
}

.product-badge {
  position: absolute;
  left: 0.75rem;
  padding: 0.45rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: white;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.discount-badge {
  top: 0.75rem;
  background: #dc2626;
}

.stock-badge {
  bottom: 0.75rem;
  background: #ca8a04;
}

.soldout-badge {
  top: 0.75rem;
  background: #111827;
}

.product-description {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.product-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.5rem;
}

.favorite-icon {
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease;
}

.favorite-icon:hover {
  transform: scale(1.06);
}

.favorite-active {
  background: #dc2626;
  color: white;
}

.price-shell {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.price-old {
  color: var(--muted);
  text-decoration: line-through;
  font-size: 0.9rem;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.stock-label {
  font-size: 0.82rem;
  color: var(--muted);
}

.out-stock {
  color: #dc2626;
  font-weight: 700;
}

.add-cart-button {
  min-width: 7rem;
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background 180ms ease;
}

.add-cart-button:hover {
  transform: translateY(-2px);
}

.add-cart-button.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.add-cart-button.is-success {
  background: #16a34a;
}

.commerce-empty {
  min-height: 240px;
  place-items: center;
  text-align: center;
}

.empty-icon {
  font-size: 2.5rem;
}

.product-card {
  will-change: transform;
}

.product-card:active {
  transform: scale(0.99);
}

.button.secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.button.secondary:hover {
  background: color-mix(in srgb, var(--surface) 82%, var(--surface-soft));
}

.button.secondary:disabled,
.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.button.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.button:focus-visible,
.filter:focus-visible,
.favorite-icon:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand-primary) 35%, transparent);
  outline-offset: 2px;
}

.nav-actions {
  flex-wrap: wrap;
}

.commerce-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.product-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.product-actions .button {
  flex: 1 1 8rem;
}

.product-actions .button.secondary {
  flex: 0 0 auto;
}

.product-card.in-cart {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--brand-primary) 28%, transparent);
}

.favorite-icon {
  display: inline-grid;
  place-items: center;
  line-height: 1;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition:
    transform 180ms ease,
    background 180ms ease,
    color 180ms ease,
    border-color 180ms ease;
}

.favorite-icon:hover {
  transform: scale(1.06);
}

.favorite-icon.favorite-active {
  background: #dc2626;
  border-color: #dc2626;
  color: white;
}

.favorite-icon.is-loading {
  opacity: 0.72;
  pointer-events: none;
}

.panel {
  display: grid;
  gap: 0.75rem;
  margin: 1rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.75rem;
}

.summary-card {
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  display: grid;
  gap: 0.25rem;
}

.summary-label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 800;
}

.checkout-preview {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.stack {
  display: grid;
  gap: 0.75rem;
}

.commerce-item {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.commerce-item-row {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}

.commerce-item-media {
  width: 5rem;
  aspect-ratio: 1;
  border-radius: 0.85rem;
  overflow: hidden;
  background: var(--surface);
  flex-shrink: 0;
}

.commerce-item-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.commerce-item-body {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  flex: 1;
}

.item-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.item-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.qty-controls,
.item-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.qty-pill {
  min-width: 2.4rem;
  text-align: center;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-weight: 700;
}

body.overlay-open {
  overflow: hidden;
}

.overlay-shell {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  align-items: end;
  padding: 0;
  background: rgb(15 23 42 / 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.overlay-shell.is-open {
  opacity: 1;
  pointer-events: auto;
}

.overlay-panel {
  width: 100%;
  max-height: min(92vh, 100%);
  overflow: auto;
  background: var(--surface);
  border-top-left-radius: 1.1rem;
  border-top-right-radius: 1.1rem;
  border: 1px solid var(--line);
  box-shadow: 0 -20px 60px rgb(15 23 42 / 0.18);
  transform: translateY(20px);
  transition: transform 180ms ease;
}

.overlay-shell.is-open .overlay-panel {
  transform: translateY(0);
}

.detail-panel,
.checkout-panel {
  padding: 1rem;
}

.detail-close {
  display: inline-flex;
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.detail-layout,
.checkout-layout {
  display: grid;
  gap: 1rem;
}

.detail-gallery {
  display: grid;
  gap: 0.75rem;
}

.detail-hero-media {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.detail-hero-media img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(4rem, 1fr));
  gap: 0.55rem;
}

.detail-thumb {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  background: var(--surface);
  cursor: pointer;
}

.detail-thumb.is-active {
  border-color: var(--brand-primary);
}

.detail-thumb img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.detail-content,
.detail-copy {
  display: grid;
  gap: 0.8rem;
}

.detail-kicker {
  color: var(--brand-accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.detail-content h2,
.checkout-copy h2 {
  margin: 0;
  font-size: clamp(1.45rem, 5vw, 2.2rem);
  line-height: 1.02;
}

.detail-description {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.detail-price {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.detail-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--brand-primary) 12%, var(--surface));
  color: var(--brand-primary);
  font-size: 0.8rem;
  font-weight: 700;
}

.detail-stock {
  font-weight: 700;
}

.detail-attributes {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.detail-attribute {
  display: grid;
  gap: 0.18rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.detail-attribute dt {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-attribute dd {
  margin: 0;
  font-weight: 600;
}

.detail-actions {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.detail-cta-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
}

.detail-primary {
  min-height: 3rem;
}

.detail-skeleton {
  min-height: 22rem;
}

.checkout-copy,
.checkout-aside {
  display: grid;
  gap: 0.9rem;
}

.checkout-aside {
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  align-content: start;
}

.checkout-summary {
  display: grid;
  gap: 0.75rem;
}

.checkout-line,
.checkout-total {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.checkout-total {
  padding-top: 0.75rem;
  border-top: 1px solid var(--line);
}

.checkout-form {
  display: grid;
  gap: 0.8rem;
}

.field-grid {
  display: grid;
  gap: 0.8rem;
}

.field {
  display: grid;
  gap: 0.35rem;
}

.field span {
  font-size: 0.86rem;
  font-weight: 700;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 0.9rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
}

.field textarea {
  resize: vertical;
}

.checkout-submit-row {
  display: grid;
  gap: 0.5rem;
}

.checkout-success {
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 88%, var(--surface));
}

.checkout-success h3 {
  margin: 0;
}

.checkout-error {
  margin: 0;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 600;
}

#profile,
#orders {
  display: grid;
  gap: 1rem;
  padding: 0 1rem 1rem;
}

.auth-pending #profile,
.auth-pending #orders {
  display: none;
}

@media (max-width: 640px) {
  .product-actions .button {
    width: 100%;
  }

  .commerce-item-row {
    flex-direction: column;
  }

  .commerce-item-media {
    width: 100%;
  }

  .qty-controls,
  .item-actions {
    width: 100%;
  }

  .checkout-preview {
    align-items: flex-start;
  }

  .detail-actions,
  .checkout-aside {
    position: sticky;
    bottom: 0;
  }
}

@media (max-width: 640px) {
  .product-card {
    min-height: auto;
  }

  .product-content {
    gap: 0.55rem;
  }

  .product-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .add-cart-button {
    width: 100%;
  }

  .favorite-icon {
    width: 2rem;
    height: 2rem;
  }
}

@media (min-width: 760px) {
  .navbar,
  .hero,
  .section-heading,
  .catalog,
  .footer {
    padding-inline: 2rem;
  }

  .hero {
    grid-template-columns: minmax(0, 1fr) 18rem;
    align-items: end;
    min-height: 18rem;
  }

  .section-heading {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .catalog {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .company {
    grid-template-columns: minmax(16rem, 0.7fr) 1fr;
    align-items: end;
    margin-inline: 2rem;
  }

  .overlay-shell {
    place-items: center;
    padding: 2rem;
  }

  .overlay-panel {
    max-width: 68rem;
    border-radius: 1.2rem;
    transform: translateY(12px);
  }

  .detail-layout,
  .checkout-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
    align-items: start;
  }

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

  .detail-cta-row {
    grid-template-columns: 1fr auto;
  }
}
