:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #111827;
  --text-muted: #5b6472;
  --border: #e5e7eb;
  --badge-bg: #111827;
  --badge-text: #ffffff;
  --featured-bg: #fef3c7;
  --featured-text: #92400e;
  --cta-bg: #ff9900;
  --cta-bg-hover: #f08804;
  --cta-text: #111827;
  --focus-ring: #2563eb;
  --radius-card: 16px;
  --radius-btn: 10px;
  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.05), 0 4px 12px rgba(17, 24, 39, 0.04);
  --shadow-card-hover: 0 6px 20px rgba(17, 24, 39, 0.1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.4;
}

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 14px;
}

/* Header */
.site-header {
  padding: 18px 0 10px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
}

.brand-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, #111827 0%, #374151 100%);
  color: #ffffff;
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: -0.02em;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.brand-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-tagline {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Sticky Search Bar */
.search-bar-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 246, 248, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 0 10px;
  border-bottom: 1px solid rgba(229, 231, 235, 0.8);
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  color: var(--text-muted);
  pointer-events: none;
}

#searchInput {
  width: 100%;
  height: 48px;
  padding: 0 42px 0 44px;
  font-size: 1rem; /* 16px prevents iOS Safari auto-zoom */
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#searchInput::placeholder {
  color: #8b93a1;
}

#searchInput:focus {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

/* Hide default WebKit search cancel button so our custom button is consistent */
#searchInput::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.clear-btn {
  position: absolute;
  right: 8px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: #f3f4f6;
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.clear-btn:hover {
  background: #e5e7eb;
  color: var(--text);
}

.clear-btn[hidden] {
  display: none;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  gap: 8px;
}

.results-count {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  font-size: 0.8rem;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-chip[aria-pressed="true"] {
  background: var(--featured-bg);
  color: var(--featured-text);
  border-color: #f59e0b;
}

/* Main Content & Product Grid */
.main-content {
  flex: 1;
  padding-top: 14px;
  padding-bottom: 28px;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Product Card (entire card is an anchor tag) */
.product-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-card);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
  border-color: #d1d5db;
}

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

.product-card:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.product-card.is-featured {
  border-color: #fcd34d;
}

.card-media {
  position: relative;
  background: #ffffff;
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border-bottom: 1px solid #f1f3f5;
}

.card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.badge-row {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  pointer-events: none;
}

.number-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: var(--badge-bg);
  color: var(--badge-text);
  border-radius: 999px;
}

.featured-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--featured-bg);
  color: var(--featured-text);
  border-radius: 999px;
}

.card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px;
  gap: 12px;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cta-button {
  margin-top: auto;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--cta-bg);
  color: var(--cta-text);
  font-size: 0.93rem;
  font-weight: 800;
  border-radius: var(--radius-btn);
  transition: background-color 0.14s ease;
}

.product-card:hover .cta-button {
  background: var(--cta-bg-hover);
}

/* Empty & Error State */
.empty-state {
  text-align: center;
  padding: 48px 16px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
}

.empty-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.empty-subtitle {
  margin: 6px 0 16px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.reset-btn {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  color: #ffffff;
  background: var(--badge-bg);
  border: none;
  border-radius: 10px;
  cursor: pointer;
}

.reset-btn:hover {
  opacity: 0.9;
}

/* Footer */
.site-footer {
  margin-top: auto;
  padding: 18px 0 26px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.disclosure {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Responsive Breakpoints */
@media (min-width: 520px) {
  .product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
  }

  .card-media {
    aspect-ratio: 1 / 1;
  }
}

@media (min-width: 840px) {
  .container {
    padding: 0 20px;
  }

  .product-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
  }
}
