/* Design: "fresh and vibrant" — white base, lime accent (the htzone dot), a pastel color per category. */
:root {
  --bg: #f7f8f5;
  --surface: #ffffff;
  --text: #16181d;
  --muted: #5f6672;
  --border: #e6e8e3;
  --lime: #c6f432;
  --lime-strong: #7cc520;
  --lime-wash: #f1fbe1;
  --ink: #16181d;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(22, 24, 29, .05), 0 10px 28px rgba(22, 24, 29, .07);
  font-family: "Segoe UI", "Noto Sans Hebrew", "Arial Hebrew", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
img { display: block; max-width: 100%; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 3px solid #4f7cff; outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; padding: 0 clamp(16px, 4vw, 56px);
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 28px; font-weight: 800; letter-spacing: -.5px;
  color: var(--ink); text-decoration: none; direction: ltr;
}
.logo-dot {
  display: inline-block; width: 11px; height: 11px; margin-inline-start: 3px;
  border-radius: 50%; background: var(--lime-strong);
}
.tagline { color: var(--muted); font-size: 14px; }

/* ---------- Hero band ---------- */
.hero-band {
  background: var(--lime-wash);
  border-bottom: 1px solid #e3f2c9;
  padding: clamp(32px, 6vw, 64px) clamp(16px, 4vw, 56px) clamp(28px, 4vw, 40px);
}
.hero { max-width: 880px; margin: 0 auto; text-align: center; }
.hero h1 { margin: 0; font-size: clamp(32px, 6vw, 58px); font-weight: 800; letter-spacing: -1px; }
.hero h1 .mark {
  background: linear-gradient(transparent 62%, var(--lime) 62%);
  padding: 0 .08em;
}
.subtitle { margin: 10px 0 26px; font-size: clamp(16px, 2.2vw, 21px); color: #4d5a3c; }

.search {
  position: relative; display: flex; align-items: center;
  max-width: 820px; margin: 0 auto; padding: 6px;
  background: var(--surface); border: 2px solid var(--lime-strong); border-radius: 999px;
  box-shadow: 0 8px 24px rgba(124, 197, 32, .18);
}
.search:focus-within { box-shadow: 0 0 0 5px rgba(198, 244, 50, .55), 0 8px 24px rgba(124, 197, 32, .18); }
.search input {
  flex: 1; min-width: 0; height: 52px; padding: 0 22px;
  border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 18px; color: var(--text);
}
.search input::placeholder { color: #8a917f; }
.search input::-webkit-search-cancel-button { display: none; }
.clear {
  width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer;
}
.clear:hover { background: var(--lime-wash); }
.submit {
  display: inline-flex; align-items: center; gap: 10px;
  height: 52px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--lime); font: inherit; font-size: 18px; font-weight: 700; cursor: pointer;
  transition: transform .12s ease;
}
.submit:hover { transform: translateY(-1px); }
.submit:active { transform: translateY(0); }

.examples {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px;
  max-width: 820px; margin: 18px auto 0;
}
.examples-label { color: #4d5a3c; font-size: 14px; }
.chip {
  padding: 7px 15px; border: 0; border-radius: 999px;
  font: inherit; font-size: 14px; cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}
.chip:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(22, 24, 29, .08); }
.chip:nth-of-type(5n+1) { background: #ffe3d6; color: #8a3415; }
.chip:nth-of-type(5n+2) { background: #ddebff; color: #173f7a; }
.chip:nth-of-type(5n+3) { background: #e8deff; color: #43237f; }
.chip:nth-of-type(5n+4) { background: #fff1c2; color: #6b4a00; }
.chip:nth-of-type(5n+5) { background: #d8f3ea; color: #0f5a45; }

/* ---------- Results ---------- */
main { max-width: 1240px; margin: 0 auto; padding: 8px clamp(16px, 4vw, 56px) 64px; }
.results-head { display: flex; align-items: baseline; gap: 12px; margin: 28px 0 18px; }
.results-head h2 { margin: 0; font-size: clamp(22px, 3vw, 30px); font-weight: 800; }
.count {
  padding: 3px 10px; border-radius: 999px;
  background: var(--lime); color: #2c3a00; font-size: 14px; font-weight: 700;
}
.notice {
  margin: -6px 0 18px; padding: 10px 14px; border-radius: 12px;
  background: #fff6d6; color: #6b4a00; font-size: 14px; line-height: 1.5;
}

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 768px)  { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.card {
  --tint: #eef0f2; --tint-ink: #38404d;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
}
.card:hover { box-shadow: var(--shadow); transform: translateY(-3px); border-color: var(--lime-strong); }
.card-img { position: relative; aspect-ratio: 1 / 1; background: var(--tint); }
/* The catalog images are grey placeholders: multiply tints them with the category color. */
.card-img img { width: 100%; height: 100%; object-fit: cover; mix-blend-mode: multiply; }
.card-cat {
  position: absolute; top: 10px; inset-inline-start: 10px;
  max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .85); color: var(--tint-ink); font-size: 12px; font-weight: 600;
}
.card-body { padding: 14px 16px 18px; text-align: center; }
.card-name {
  margin: 0 0 10px; font-size: 16px; font-weight: 600; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.7em;
}
.card-price {
  display: inline-block; margin: 0; padding: 4px 14px; border-radius: 10px;
  background: var(--lime); color: #1f2a00; font-size: 20px; font-weight: 800; direction: ltr;
}

/* Category palette (class set from the category name in app.js) */
.cat-0  { --tint: #ffe3d6; --tint-ink: #8a3415; }  /* מטבח ובישול */
.cat-1  { --tint: #fff1c2; --tint-ink: #6b4a00; }  /* קפה, משקאות וגורמה */
.cat-2  { --tint: #d8f3ea; --tint-ink: #0f5a45; }  /* מוצרי חשמל לבית */
.cat-3  { --tint: #ddebff; --tint-ink: #173f7a; }  /* מחשבים ועבודה מהבית */
.cat-4  { --tint: #e8deff; --tint-ink: #43237f; }  /* סלולר, אודיו וגאדג'טים */
.cat-5  { --tint: #ffdeeb; --tint-ink: #8c1f4a; }  /* טלוויזיה, גיימינג ובידור */
.cat-6  { --tint: #f3e9dc; --tint-ink: #5e4326; }  /* בית ועיצוב */
.cat-7  { --tint: #fce4f3; --tint-ink: #7a1f5c; }  /* טיפוח ובריאות */
.cat-8  { --tint: #ddf4d0; --tint-ink: #2f5d12; }  /* ספורט, טיולים ונסיעות */
.cat-9  { --tint: #fff4b8; --tint-ink: #6a5600; }  /* תינוקות וילדים */
.cat-10 { --tint: #ffe8cc; --tint-ink: #7a4300; }  /* חיות מחמד */
.cat-11 { --tint: #e3f2d9; --tint-ink: #3d5e1e; }  /* גינה ומנגל */
.cat-12 { --tint: #e4e7ec; --tint-ink: #38404d; }  /* כלי עבודה ורכב */

/* ---------- Skeleton ---------- */
.card.skeleton .card-img,
.card.skeleton .sk-line {
  background: linear-gradient(90deg, #edf0e8 25%, #f7f9f3 37%, #edf0e8 63%);
  background-size: 400% 100%; animation: shimmer 1.2s ease infinite;
}
.sk-line { height: 14px; margin: 6px auto; border-radius: 6px; width: 80%; }
.sk-line.short { width: 40%; height: 22px; margin-top: 12px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) {
  .card.skeleton .card-img, .card.skeleton .sk-line { animation: none; }
  .card, .chip, .submit { transition: none; }
}

/* ---------- Empty / error states ---------- */
.state {
  max-width: 560px; margin: 32px auto; padding: 32px 24px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.state h2 { margin: 0 0 8px; font-size: 20px; }
.state p { margin: 0 0 16px; color: var(--muted); }
.state .retry {
  padding: 10px 22px; border: 0; border-radius: 999px;
  background: var(--ink); color: var(--lime); font: inherit; font-weight: 700; cursor: pointer;
}
.link-btn {
  border: 0; background: none; padding: 0; color: inherit; font: inherit; font-weight: 700;
  text-decoration: underline; cursor: pointer;
}

@media (max-width: 560px) {
  .tagline { display: none; }
  .search input { height: 46px; padding: 0 14px; font-size: 16px; }
  .submit { height: 46px; padding: 0 16px; }
  .submit span { display: none; }
  .card-body { padding: 10px 10px 14px; }
  .card-name { font-size: 14px; }
  .card-price { font-size: 17px; padding: 3px 10px; }
  .card-cat { font-size: 11px; top: 8px; inset-inline-start: 8px; }
}

/* ---------- Card as a button (opens the product dialog) ---------- */
.card-open {
  display: flex; flex-direction: column; flex: 1; width: 100%;
  padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: inherit; cursor: pointer;
}
.card-open:focus-visible { outline: 3px solid var(--lime-strong); outline-offset: -3px; border-radius: var(--radius); }
.card-img, .card-body { display: block; }
.card-body { display: flex; flex-direction: column; align-items: center; }
.card-name { width: 100%; }
.card-more {
  margin-top: 8px; font-size: 13px; font-weight: 600; color: #4d7a12;
  opacity: 0; transform: translateY(-2px); transition: opacity .15s ease, transform .15s ease;
}
.card:hover .card-more, .card-open:focus-visible .card-more { opacity: 1; transform: none; }
@media (hover: none) { .card-more { opacity: 1; transform: none; } }

/* ---------- Product details dialog ---------- */
body:has(.pd[open]) { overflow: hidden; }
.pd {
  width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  padding: 0; border: 0; border-radius: 24px; overflow: hidden;
  background: var(--surface); color: var(--text);
  box-shadow: 0 30px 80px rgba(22, 24, 29, .35);
}
.pd::backdrop { background: rgba(22, 24, 29, .55); backdrop-filter: blur(3px); }
.pd[open] { animation: pd-in .18s ease-out; }
@keyframes pd-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.pd-inner {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  max-height: calc(100vh - 48px); overflow-y: auto;
}
.pd-close {
  position: absolute; top: 14px; inset-inline-end: 14px; z-index: 1;
  width: 42px; height: 42px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: var(--text); font-size: 28px; line-height: 1; cursor: pointer;
  box-shadow: 0 2px 8px rgba(22, 24, 29, .15);
}
.pd-close:hover { background: var(--lime); }
.pd-media { background: var(--tint, #eef0f2); display: flex; align-items: center; justify-content: center; }
.pd-media img { width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: contain; mix-blend-mode: multiply; }

.pd-info { padding: 32px 32px 28px; display: flex; flex-direction: column; }
.pd-crumbs {
  align-self: flex-start; margin: 0 0 12px; padding: 4px 12px; border-radius: 999px;
  background: var(--lime-wash); color: #3d5a12; font-size: 13px; font-weight: 600;
}
.pd-name { margin: 0 0 6px; font-size: clamp(22px, 3vw, 28px); font-weight: 800; line-height: 1.25; }
.pd-brand { margin: 0 0 16px; color: var(--muted); font-size: 15px; }
.pd-brand span { color: var(--text); font-weight: 600; }
.pd-price {
  align-self: flex-start; margin: 0 0 18px; padding: 6px 18px; border-radius: 12px;
  background: var(--lime); color: #1f2a00; font-size: 26px; font-weight: 800; direction: ltr;
}
.pd-desc { margin: 0 0 22px; font-size: 16px; line-height: 1.75; color: #2f343c; }
.pd-subtitle { margin: 0 0 10px; font-size: 17px; font-weight: 800; }
.pd-attrs { margin: 0 0 18px; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pd-attr { display: grid; grid-template-columns: minmax(110px, 40%) 1fr; }
.pd-attr:nth-child(odd) { background: #f7f9f3; }
.pd-attr dt, .pd-attr dd { margin: 0; padding: 10px 14px; font-size: 14px; }
.pd-attr dt { color: var(--muted); font-weight: 600; }
.pd-attr dd { color: var(--text); }
.pd-sku { margin: auto 0 0; padding-top: 8px; color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  .pd { width: calc(100vw - 16px); max-height: calc(100vh - 16px); border-radius: 20px; }
  .pd-inner { grid-template-columns: 1fr; max-height: calc(100vh - 16px); }
  .pd-media img { aspect-ratio: 16 / 10; }
  .pd-info { padding: 20px 18px 22px; }
}
@media (prefers-reduced-motion: reduce) { .pd[open] { animation: none; } .card-more { transition: none; } }
