/* ==========================================================================
   עסקים מומלצים לאנ"ש בכשרות מהודרת בעפולה — גיליון סגנון
   ========================================================================== */

:root {
  --bg: #fbf7f2;
  --surface: #ffffff;
  --surface-2: #f5ede4;
  --ink: #241c17;
  --ink-2: #6d5c51;
  --ink-3: #9b8878;
  --line: #e9ddd1;
  --brand: #c2452b;
  --brand-ink: #9c3620;
  --brand-soft: #fceee9;
  --ok: #2f7d4f;
  --alert: #cf2e14;

  --cat-milk: #2f6fa8;
  --cat-milk-soft: #e8f1f9;
  --cat-meat: #b03b28;
  --cat-meat-soft: #fbeae6;
  --cat-pareve: #2f7d4f;
  --cat-pareve-soft: #e6f3ea;

  --radius: 18px;
  --radius-sm: 11px;
  --shadow: 0 1px 2px rgb(60 40 25 / 6%), 0 8px 24px -12px rgb(60 40 25 / 18%);
  --shadow-lift: 0 2px 4px rgb(60 40 25 / 8%), 0 18px 38px -16px rgb(60 40 25 / 30%);
  --wrap: 1180px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15110f;
    --surface: #201a17;
    --surface-2: #2b2320;
    --ink: #f5ece4;
    --ink-2: #b6a396;
    --ink-3: #8a7768;
    --line: #362c26;
    --brand: #ff8064;
    --brand-ink: #ff9d86;
    --brand-soft: #38201a;
    --ok: #57b380;
    --alert: #ff8a70;

    --cat-milk: #7db6e8;
    --cat-milk-soft: #1c2c3a;
    --cat-meat: #f18b74;
    --cat-meat-soft: #36211c;
    --cat-pareve: #6fc294;
    --cat-pareve-soft: #1b2f24;

    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px -12px rgb(0 0 0 / 60%);
    --shadow-lift: 0 2px 4px rgb(0 0 0 / 45%), 0 18px 38px -16px rgb(0 0 0 / 70%);
  }
}

:root[data-theme="dark"] {
  --bg: #15110f;
  --surface: #201a17;
  --surface-2: #2b2320;
  --ink: #f5ece4;
  --ink-2: #b6a396;
  --ink-3: #8a7768;
  --line: #362c26;
  --brand: #ff8064;
  --brand-ink: #ff9d86;
  --brand-soft: #38201a;
  --ok: #57b380;
  --alert: #ff8a70;
  --cat-milk: #7db6e8;
  --cat-milk-soft: #1c2c3a;
  --cat-meat: #f18b74;
  --cat-meat-soft: #36211c;
  --cat-pareve: #6fc294;
  --cat-pareve-soft: #1b2f24;
}

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

/* כללי display מפורשים למטה גוברים על ברירת המחדל של [hidden]. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.6 Assistant, "Segoe UI", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3, .brand__text strong { font-family: Rubik, Assistant, system-ui, sans-serif; }

a { color: var(--brand-ink); }

.wrap {
  width: min(100% - 32px, var(--wrap));
  margin-inline: auto;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 10;
  padding: 10px 16px;
  background: var(--surface);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.skip-link:focus { inset-inline-start: 12px; }

/* ---------- סרגל עליון ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-block-end: 1px solid var(--line);
}

.topbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  font-size: 18px;
  line-height: 1;
  border-radius: 12px;
  background: var(--brand-soft);
}

.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-size: 1.02rem; font-weight: 700; }
.brand__text small { color: var(--ink-3); font-size: .78rem; }

.updated {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: .82rem;
  white-space: nowrap;
}

.updated__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

.updated__hebrew::before { content: " · "; }
.updated__hebrew:empty { display: none; }

/* ---------- כותרת ראשית ---------- */

.hero {
  padding: clamp(32px, 6vw, 60px) 0 26px;
  background:
    radial-gradient(80% 120% at 88% -25%, color-mix(in srgb, var(--brand) 22%, transparent), transparent 60%),
    radial-gradient(65% 110% at 4% -5%, color-mix(in srgb, var(--ok) 17%, transparent), transparent 58%);
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 5.2vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero__sub {
  margin: 10px 0 0;
  max-width: 58ch;
  color: var(--ink-2);
  font-size: clamp(1rem, 2.2vw, 1.13rem);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 26px;
  max-width: 560px;
}

.search__icon {
  position: absolute;
  inset-inline-start: 16px;
  font-size: .95rem;
  opacity: .55;
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 14px 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  box-shadow: var(--shadow);
}

.search input::-webkit-search-cancel-button { display: none; }
.search input:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

.search__clear {
  position: absolute;
  inset-inline-end: 12px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .75rem;
  cursor: pointer;
}

/* ---------- סינון ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  padding-block: 20px 4px;
}

.filters__group { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.filters__label {
  color: var(--ink-3);
  font-size: .8rem;
  font-weight: 600;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; }

.chip {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font: 600 .86rem/1 Assistant, sans-serif;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.chip:hover { border-color: var(--ink-3); }

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-2);
  font-size: .86rem;
  cursor: pointer;
  margin-inline-start: auto;
}

.switch[hidden] { display: none; }

/* כששני המתגים מוצגים, רק הראשון נדחף לקצה — השני צמוד אליו. */
.switch + .switch { margin-inline-start: 0; }

.switch input { position: absolute; opacity: 0; width: 0; height: 0; }

.switch__track {
  width: 38px;
  height: 22px;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  transition: background .18s;
}

.switch__thumb {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--ink-3);
  transition: transform .18s, background .18s;
}

.switch input:checked + .switch__track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch__track .switch__thumb { background: #fff; transform: translateX(-16px); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--brand); outline-offset: 2px; }

.resultbar {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-block: 18px 12px;
}

.resultbar__count { margin: 0; color: var(--ink-3); font-size: .87rem; }

.linkbtn {
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand-ink);
  font: 600 .87rem Assistant, sans-serif;
  cursor: pointer;
  text-decoration: underline;
}

/* ---------- רשת הכרטיסים ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(292px, 1fr));
  gap: 18px;
  padding-block-end: 56px;
}

.card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}

@media (hover: hover) {
  .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
}

.card--inactive { opacity: .82; }
.card--inactive .card__thumb { filter: grayscale(1); }

.card__thumb {
  position: relative;
  display: grid;
  place-items: center;
  height: 92px;
  font-size: 3rem;
  line-height: 1;
  /* --card-accent נקבע ב-JS לפי הקטגוריה, כדי לתת לרשת גיוון ורמז ויזואלי. */
  background:
    radial-gradient(60% 120% at 50% 130%, color-mix(in srgb, var(--card-accent, var(--brand)) 26%, transparent), transparent 70%),
    linear-gradient(135deg,
      color-mix(in srgb, var(--card-accent, var(--brand)) 13%, var(--surface)),
      color-mix(in srgb, var(--card-accent, var(--brand)) 5%, var(--surface)));
}

.card__thumb img { width: 100%; height: 100%; object-fit: cover; }

.card__ribbon {
  position: absolute;
  top: 10px;
  inset-inline-end: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  color: var(--bg);
  font: 600 .72rem/1 Assistant, sans-serif;
  backdrop-filter: blur(4px);
}

.card__body { display: flex; flex-direction: column; gap: 10px; padding: 16px; flex: 1; }

.card__name { margin: 0; font-size: 1.11rem; font-weight: 700; line-height: 1.3; }

.card__tags { display: flex; flex-wrap: wrap; gap: 6px; }

.tag {
  padding: 3px 9px;
  border-radius: 7px;
  font: 600 .76rem/1.5 Assistant, sans-serif;
  background: var(--surface-2);
  color: var(--ink-2);
}

.tag--milk   { background: var(--cat-milk-soft);   color: var(--cat-milk); }
.tag--meat   { background: var(--cat-meat-soft);   color: var(--cat-meat); }
.tag--pareve { background: var(--cat-pareve-soft); color: var(--cat-pareve); }
.tag--sukkah { background: var(--cat-pareve-soft); color: var(--cat-pareve); }

.card__line {
  display: flex;
  gap: 8px;
  color: var(--ink-2);
  font-size: .89rem;
  line-height: 1.5;
}

.card__line span:first-child { flex: none; opacity: .7; }

/* טקסט שסומן ב-*כוכביות* בגיליון, במקביל לקטעים האדומים בקובץ המקורי. */
.mark {
  color: var(--alert);
  font-weight: 700;
}

.card__note {
  margin: 0;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: .83rem;
  line-height: 1.55;
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: auto;
  padding-top: 4px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font: 600 .83rem/1 Assistant, sans-serif;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}

.btn:hover { background: var(--surface-2); border-color: var(--ink-3); }

.btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.btn--primary:hover { background: color-mix(in srgb, var(--brand) 85%, #000); border-color: transparent; }

.btn--ghost { background: none; }

/* ---------- מצבים ---------- */

.state {
  padding: 46px 16px;
  text-align: center;
  color: var(--ink-3);
}

.state--empty span { display: block; font-size: 2rem; margin-bottom: 6px; }
.state--empty p { margin: 0 0 14px; }
.state--error { color: var(--cat-meat); }

/* ---------- הודעת מידע ---------- */

.notice {
  margin-block: 22px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.notice summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 14px 18px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.notice summary::-webkit-details-marker { display: none; }

.notice p {
  margin: 0;
  padding: 0 18px 18px;
  color: var(--ink-2);
  font-size: .9rem;
  line-height: 1.7;
}

@media (max-width: 640px) {
  .filters { gap: 12px; }
  .switch { margin-inline-start: 0; }
  .grid { grid-template-columns: 1fr; }

  /* הסרגל העליון דביק — חובה שיישאר בשורה אחת ולא יבלע חצי מסך. */
  .filters__group { width: 100%; }
  .filters__label { width: 100%; }

  .brand__text strong {
    max-width: 44vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .brand__text small { display: none; }
  .updated { padding: 5px 10px; font-size: .76rem; }
  .updated__hebrew { display: none; }
  .updated__text { display: inline-flex; gap: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
