:root {
  --page-bg: #f7f8fc;
  --surface: #ffffff;
  --ink: #07143d;
  --muted: #6c738b;
  --border: #dfe3ec;
  --purple: #5822d8;
  --purple-dark: #4619bc;
  --purple-soft: #eee8ff;
  --focus: #7b45ef;
  --radius-card: 12px;
  --radius-control: 10px;
  --content-max: 1200px;
  --page-padding: 12px;
  --grid-gap: 12px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  min-width: 0;
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.storefront-loading .site-header,
body.storefront-loading .page-shell,
body.storefront-loading .site-footer {
  visibility: hidden;
}

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

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header,
.page-shell,
.footer-legal {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
}

.site-header {
  padding: 14px var(--page-padding) 4px;
}

.header-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.store-name {
  min-width: 0;
  font-size: clamp(1rem, 4.7vw, 1.55rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.035em;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.search-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1.5px solid #bda6fb;
  border-radius: 13px;
  background: var(--surface);
  color: var(--purple);
  cursor: pointer;
}

.search-toggle img {
  width: 28px;
  height: 28px;
}

.search-toggle[aria-expanded="true"] {
  border-color: var(--purple);
  background: var(--purple-soft);
}

.search-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 14px;
}

.search-panel input {
  min-width: 0;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 0 14px;
  color: var(--ink);
}

.search-panel input::placeholder {
  color: #888da0;
}

.search-submit,
.empty-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  background: var(--purple);
  color: #ffffff;
  font-weight: 750;
}

.search-submit {
  padding: 0 18px;
  cursor: pointer;
}

.category-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.category-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--surface);
  padding: 0 4px;
  color: var(--ink);
  font-size: clamp(0.7rem, 3.25vw, 0.9rem);
  font-weight: 750;
  text-align: center;
}

.category-tab[aria-current="page"] {
  border-color: var(--purple);
  background: var(--purple);
  color: #ffffff;
}

.page-shell {
  min-height: calc(100svh - 114px);
  padding: 8px var(--page-padding) 42px;
}

.results-status {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.catalog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--grid-gap);
}

.product-card {
  display: flex;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(34, 27, 84, 0.045);
  flex-direction: column;
}

.product-image-stage {
  display: flex;
  width: 100%;
  aspect-ratio: 1 / 1.12;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: #ffffff;
}

.product-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 180ms ease;
}

.product-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 8px;
}

.product-title {
  display: -webkit-box;
  min-height: 2.5em;
  margin: 0;
  overflow: hidden;
  font-size: clamp(0.85rem, 3.65vw, 0.98rem);
  font-weight: 780;
  line-height: 1.25;
  letter-spacing: -0.018em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.product-merchant {
  min-height: 1.3em;
  margin: 6px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-price {
  margin: 12px 0 8px;
  font-size: clamp(1.05rem, 4.4vw, 1.25rem);
  font-weight: 850;
  line-height: 1;
  letter-spacing: -0.035em;
}

.deal-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: auto;
  border-radius: 8px;
  background: var(--purple);
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 800;
}

.empty-state {
  max-width: 520px;
  margin: 46px auto;
  text-align: center;
}

.empty-state h1 {
  margin: 0;
  font-size: 1.45rem;
}

.empty-state p {
  margin: 10px 0 20px;
  color: var(--muted);
  line-height: 1.5;
}

.empty-action {
  padding: 0 18px;
}

.site-footer {
  width: 100%;
  border-top: 1px solid var(--border);
}

.footer-legal {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 24px var(--page-padding) 32px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.footer-legal p {
  margin: 0;
}

.store-name:focus-visible,
.search-toggle:focus-visible,
.search-panel input:focus-visible,
.search-submit:focus-visible,
.category-tab:focus-visible,
.product-card:focus-visible,
.empty-action:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 3px;
}

@media (hover: hover) {
  .store-name:hover {
    color: var(--purple);
  }

  .search-toggle:hover,
  .category-tab:hover {
    border-color: var(--purple);
  }

  .search-submit:hover,
  .empty-action:hover,
  .deal-button:hover {
    background: var(--purple-dark);
  }

  .product-card:hover {
    border-color: #bba7ef;
    box-shadow: 0 10px 28px rgba(52, 34, 122, 0.11);
  }

  .product-card:hover .product-image {
    transform: scale(1.025);
  }
}

@media (min-width: 360px) {
  :root {
    --page-padding: 14px;
  }

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

@media (min-width: 768px) {
  :root {
    --page-padding: 24px;
    --grid-gap: 18px;
  }

  .site-header {
    padding-top: 22px;
  }

  .search-panel {
    max-width: 620px;
    margin-right: 0;
    margin-left: auto;
  }

  .category-tabs {
    max-width: 720px;
  }

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

  .product-card-body {
    padding: 12px;
  }

  .product-title {
    font-size: 0.98rem;
  }

  .product-price {
    font-size: 1.35rem;
  }

  .footer-legal {
    flex-direction: row;
    justify-content: space-between;
    gap: 20px;
  }
}

@media (min-width: 1100px) {
  .catalog-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

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