/* ===== Reset ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== Variables ===== */
:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #e6e6ea;
  --text: #14141a;
  --muted: #6b6b76;
  --accent: #ff4d2e;
  --accent-dark: #d93a1e;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ===== Base ===== */
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Screen-reader only ===== */
.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;
}

/* ===== Header (Gen Z gradient banner) ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-bottom: 2px solid rgba(255,255,255,.15);
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(118,75,162,.35);
}

.brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: inline-flex;
  color: #ffffff;
  filter: drop-shadow(0 0 6px rgba(255,255,255,.6));
  animation: floaty 3s ease-in-out infinite;
}

.brand-mark svg {
  display: block;
}

@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.brand-text h1 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(90deg, #fff 0%, #f0e6ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -.5px;
  line-height: 1.1;
}

.tagline {
  font-size: 11px;
  color: rgba(255,255,255,.85);
  font-weight: 500;
  letter-spacing: .3px;
}

/* ===== Container ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  width: 100%;
}

/* ===== Search ===== */
.search-section {
  margin-bottom: 14px;
}

.search-wrapper {
  position: relative;
}

#search {
  width: 100%;
  padding: 14px 44px 14px 16px;
  font-size: 16px;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}

#search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255,77,46,.12);
}

#clear-search {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

#clear-search:hover {
  color: var(--text);
  background: var(--bg);
}

/* ===== Categories ===== */
.category-section {
  overflow-x: auto;
  margin-bottom: 16px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.category-section::-webkit-scrollbar {
  display: none;
}

#category-buttons {
  display: flex;
  flex-direction: row;
  gap: 8px;
  padding-bottom: 2px;
}

.cat-btn {
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
}

.cat-btn.active {
  background: var(--text);
  color: #ffffff;
  border-color: var(--text);
}

/* ===== Product grid ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

/* ===== Product card ===== */
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,.06), 0 12px 28px rgba(0,0,0,.08);
}

.product-media {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f0f0f3;
}

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

.product-body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.product-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price {
  font-size: 15px;
  font-weight: 700;
  margin-top: auto;
}

/* ===== View deal button ===== */
.view-deal {
  display: block;
  text-align: center;
  padding: 10px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  color: #ffffff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  margin-top: 6px;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}

.view-deal:hover {
  background: var(--accent-dark);
}

.view-deal:active {
  transform: scale(.98);
}

/* ===== Empty state ===== */
#empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 48px 16px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 20px 16px;
  margin-top: 24px;
}

.footer-quotes {
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.quote {
  font-size: 13px;
  font-style: italic;
  color: var(--text);
  text-align: center;
  line-height: 1.5;
}

.quote-author {
  font-style: normal;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
}

.footer-note {
  max-width: 720px;
  margin: 14px auto 0;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  opacity: .8;
}

/* ===== Responsive ===== */
@media (min-width: 480px) {
  .product-grid {
    gap: 14px;
  }

  .product-name {
    font-size: 15px;
  }
}

@media (min-width: 700px) {
  .site-header {
    padding: 14px 24px;
  }

  .container {
    padding: 24px;
  }

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

@media (min-width: 1000px) {
  .product-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
