/* ============================================================
   מחשבונים — Premium calculator site
   © אופיר ברנס (Ofir Baranes) 2026 - כל הזכויות שמורות
   ============================================================ */

:root {
  --bg: #f5f7fb;
  --bg-soft: #eef1f8;
  --card: #ffffff;
  --card-border: #e6e9f2;
  --text: #131a2b;
  --text-soft: #5b6478;
  --text-mut: #8a93a8;
  --brand: #3b5bff;
  --brand-2: #6d4bff;
  --brand-soft: #eaeeff;
  --accent: #00c2a8;
  --good: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(19,26,43,.04), 0 8px 24px rgba(19,26,43,.06);
  --shadow-lg: 0 12px 40px rgba(40,52,110,.14);
  --radius: 18px;
  --radius-sm: 12px;
  --max: 1120px;
  --grad: linear-gradient(135deg, var(--brand), var(--brand-2));
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --bg-soft: #0f1530;
    --card: #141b34;
    --card-border: #232c4d;
    --text: #eef1fb;
    --text-soft: #aab3cc;
    --text-mut: #7b85a3;
    --brand: #6d8bff;
    --brand-2: #9a7bff;
    --brand-soft: #1b2547;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-lg: 0 18px 50px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  direction: rtl;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 20px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 64px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.25rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo .mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--grad);
  display: grid; place-items: center; color: #fff; font-size: 1.2rem; box-shadow: 0 6px 16px rgba(59,91,255,.35);
}
.header-search { margin-inline-start: auto; position: relative; flex: 1; max-width: 360px; }
.header-search input {
  width: 100%; height: 42px; border-radius: 999px; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text); padding: 0 44px 0 18px; font-size: .95rem; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.header-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.header-search .ico { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); color: var(--text-mut); }

/* ---------- Hero ---------- */
.hero { padding: 56px 0 30px; text-align: center; }
.hero h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.hero h1 .g { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.hero p { color: var(--text-soft); font-size: clamp(1rem, 2.4vw, 1.2rem); max-width: 620px; margin: 16px auto 0; }
.hero .big-search { max-width: 560px; margin: 28px auto 0; position: relative; }
.hero .big-search input {
  width: 100%; height: 58px; border-radius: 16px; border: 1px solid var(--card-border);
  background: var(--card); color: var(--text); padding: 0 56px 0 20px; font-size: 1.05rem; font-family: inherit; box-shadow: var(--shadow);
}
.hero .big-search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft), var(--shadow); }
.hero .big-search .ico { position: absolute; inset-inline-start: 20px; top: 50%; transform: translateY(-50%); color: var(--text-mut); font-size: 1.2rem; }

/* ---------- Category chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 22px 0 8px; }
.chip {
  border: 1px solid var(--card-border); background: var(--card); color: var(--text-soft);
  padding: 7px 16px; border-radius: 999px; font-size: .9rem; cursor: pointer; transition: all .15s; font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active { background: var(--grad); color: #fff; border-color: transparent; box-shadow: 0 6px 16px rgba(59,91,255,.3); }

/* ---------- Grid of calculators ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; padding: 24px 0 10px; }
.card {
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s, border-color .18s; position: relative; overflow: hidden;
}
.card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--grad); opacity: 0; transition: opacity .18s; }
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: transparent; text-decoration: none; }
.card:hover::before { opacity: 1; }
.card .emoji { font-size: 1.9rem; width: 52px; height: 52px; border-radius: 14px; background: var(--brand-soft); display: grid; place-items: center; }
.card h3 { font-size: 1.12rem; font-weight: 700; color: var(--text); }
.card p { font-size: .9rem; color: var(--text-soft); flex: 1; }
.card .cat { font-size: .78rem; color: var(--brand); font-weight: 600; }
.card.hidden { display: none; }
.no-results { text-align: center; color: var(--text-mut); padding: 40px 0; display: none; }

/* ---------- Calculator page ---------- */
.breadcrumb { font-size: .85rem; color: var(--text-mut); padding: 18px 0 0; }
.breadcrumb a { color: var(--text-soft); }
.calc-head { padding: 14px 0 8px; }
.calc-head .emoji { font-size: 2.4rem; }
.calc-head h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 800; letter-spacing: -.02em; margin-top: 6px; }
.calc-head .sub { color: var(--text-soft); font-size: 1.05rem; margin-top: 6px; max-width: 680px; }

.calc-layout { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: start; padding: 18px 0; }
@media (max-width: 820px) { .calc-layout { grid-template-columns: 1fr; } }

.panel { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.05rem; margin-bottom: 16px; color: var(--text); }

.field { margin-bottom: 16px; }
.field label { display: block; font-size: .9rem; font-weight: 600; color: var(--text-soft); margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--text-mut); font-size: .82rem; }
.field input[type=number], .field input[type=text], .field input[type=date], .field select {
  width: 100%; height: 48px; border-radius: var(--radius-sm); border: 1px solid var(--card-border);
  background: var(--bg-soft); color: var(--text); padding: 0 14px; font-size: 1.05rem; font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--card); }
.field .row { display: flex; gap: 10px; }
.field .row > * { flex: 1; }

.seg { display: flex; gap: 6px; background: var(--bg-soft); border-radius: var(--radius-sm); padding: 5px; border: 1px solid var(--card-border); }
.seg button { flex: 1; border: none; background: transparent; color: var(--text-soft); height: 38px; border-radius: 9px; cursor: pointer; font-family: inherit; font-size: .92rem; font-weight: 600; transition: all .15s; }
.seg button.active { background: var(--card); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- Results ---------- */
.results { position: sticky; top: 84px; }
.result-main { background: var(--grad); color: #fff; border-radius: var(--radius); padding: 26px; text-align: center; box-shadow: 0 14px 36px rgba(59,91,255,.32); }
.result-main .lbl { font-size: .95rem; opacity: .9; }
.result-main .val { font-size: clamp(2rem, 7vw, 2.8rem); font-weight: 800; line-height: 1.1; margin-top: 4px; letter-spacing: -.02em; }
.result-rows { margin-top: 6px; }
.result-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 4px; border-bottom: 1px dashed var(--card-border); }
.result-row:last-child { border-bottom: none; }
.result-row .rl { color: var(--text-soft); font-size: .95rem; }
.result-row .rv { font-weight: 700; font-size: 1.05rem; }
.result-row.hl .rv { color: var(--good); }
.result-note { font-size: .82rem; color: var(--text-mut); margin-top: 14px; line-height: 1.5; }

.copy-btn { margin-top: 14px; width: 100%; height: 46px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: var(--card); color: var(--text-soft); cursor: pointer; font-family: inherit; font-weight: 600; transition: all .15s; }
.copy-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- Article / FAQ ---------- */
.article { padding: 28px 0 10px; max-width: 760px; }
.article h2 { font-size: 1.5rem; margin: 26px 0 12px; letter-spacing: -.01em; }
.article h3 { font-size: 1.15rem; margin: 20px 0 8px; }
.article p, .article li { color: var(--text-soft); font-size: 1.02rem; margin-bottom: 12px; }
.article ul, .article ol { padding-inline-start: 22px; }
.faq-item { border: 1px solid var(--card-border); border-radius: var(--radius-sm); margin-bottom: 10px; background: var(--card); overflow: hidden; }
.faq-item summary { padding: 16px 18px; font-weight: 600; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; color: var(--text); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: '+'; font-size: 1.4rem; color: var(--brand); font-weight: 400; }
.faq-item[open] summary::after { content: '−'; }
.faq-item .faq-body { padding: 0 18px 16px; color: var(--text-soft); }

/* ---------- Related ---------- */
.related { padding: 10px 0 30px; }
.related h2 { font-size: 1.3rem; margin-bottom: 14px; }
.more-link { margin-top: 16px; }
.more-link a { color: var(--brand); font-weight: 700; font-size: .95rem; }
.more-link a:hover { text-decoration: underline; }

/* ---------- Category hub page ---------- */
.cat-header h2 a { color: inherit; }
.cat-header h2 a:hover { color: var(--brand); }
a.count { text-decoration: none; transition: filter .15s; }
a.count:hover { filter: brightness(1.12); }
.cat-page-head { display: flex; align-items: center; gap: 18px; margin: 14px 0 22px; padding: 18px 20px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.cat-page-head::after { content: ''; position: absolute; inset-inline-end: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.cat-page-head .cat-img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex-shrink: 0; background: var(--brand-soft); }
.cat-page-head .cat-emoji { width: 72px; height: 72px; border-radius: 14px; display: grid; place-items: center; font-size: 2.2rem; background: var(--brand-soft); flex-shrink: 0; }
.cat-page-head h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -.01em; }
.cat-page-head .sub { color: var(--text-soft); font-size: .98rem; margin-top: 4px; }
.cat-links { display: flex; flex-wrap: wrap; gap: 10px; }
.cat-link { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; background: var(--card); border: 1px solid var(--card-border); border-radius: 999px; font-weight: 600; font-size: .92rem; color: var(--text-soft); transition: border-color .15s, color .15s; }
.cat-link:hover { border-color: var(--brand); color: var(--brand); }
.cat-link .ce { font-size: 1.1rem; }

/* ---------- Ad slots ---------- */
.ad-slot { margin: 26px auto; text-align: center; min-height: 90px; display: flex; align-items: center; justify-content: center; }
.ad-slot.placeholder { background: var(--bg-soft); border: 1px dashed var(--card-border); border-radius: var(--radius-sm); color: var(--text-mut); font-size: .8rem; }

/* ---------- Footer ---------- */
.site-footer { margin-top: auto; border-top: 1px solid var(--card-border); background: var(--bg-soft); padding: 34px 0; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: center; }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .9rem; }
.site-footer a { color: var(--text-soft); }
.site-footer .copy { color: var(--text-mut); font-size: .82rem; width: 100%; padding-top: 14px; border-top: 1px solid var(--card-border); margin-top: 6px; }

.section-title { font-size: 1.4rem; font-weight: 700; margin: 18px 0 4px; }

/* ---------- Skip link (a11y) ---------- */
.skip-link { position: absolute; right: -9999px; top: 8px; background: var(--brand); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 200; }
.skip-link:focus { right: 12px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- Category sections (homepage) ---------- */
.cat-section { padding: 8px 0 4px; }
.cat-header { display: flex; align-items: center; gap: 16px; margin: 28px 0 14px; padding: 14px 18px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.cat-header::after { content: ''; position: absolute; inset-inline-end: 0; top: 0; bottom: 0; width: 4px; background: var(--grad); }
.cat-header .cat-img { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; flex-shrink: 0; background: var(--brand-soft); }
.cat-header .cat-emoji { width: 72px; height: 72px; border-radius: 14px; display: grid; place-items: center; font-size: 2.2rem; background: var(--brand-soft); flex-shrink: 0; }
.cat-header h2 { font-size: 1.4rem; font-weight: 800; letter-spacing: -.01em; }
.cat-header p { color: var(--text-soft); font-size: .95rem; margin-top: 2px; }
.cat-header .count { margin-inline-start: auto; background: var(--brand-soft); color: var(--brand); font-weight: 700; font-size: .85rem; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.cat-section.hidden, .cat-header .count { } /* placeholder */
.cat-section.hidden { display: none; }

/* ---------- Cookie consent ---------- */
.cookie-banner { position: fixed; inset-inline: 16px; bottom: 16px; max-width: 560px; margin-inline: auto; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 18px 20px; z-index: 150; display: none; }
.cookie-banner.show { display: block; animation: cookieUp .3s cubic-bezier(.34,1.56,.64,1); }
@keyframes cookieUp { from { transform: translateY(20px); opacity: 0; } }
.cookie-banner p { font-size: .9rem; color: var(--text-soft); margin-bottom: 12px; }
.cookie-banner .row { display: flex; gap: 10px; flex-wrap: wrap; }
.cookie-banner button { flex: 1; min-width: 120px; height: 44px; border-radius: var(--radius-sm); font-family: inherit; font-weight: 700; cursor: pointer; border: 1px solid var(--card-border); transition: all .15s; }
.cookie-banner .accept { background: var(--grad); color: #fff; border-color: transparent; }
.cookie-banner .accept:hover { filter: brightness(1.05); }
.cookie-banner .decline { background: var(--card); color: var(--text-soft); }
.cookie-banner .decline:hover { border-color: var(--brand); }
.cookie-banner a { font-weight: 600; }

/* ---------- Accessibility widget (self-contained, used until UserWay is set) ---------- */
.a11y-btn { position: fixed; inset-inline-start: 18px; bottom: 18px; width: 56px; height: 56px; border-radius: 50%; background: var(--grad); color: #fff; border: none; cursor: pointer; box-shadow: var(--shadow-lg); z-index: 160; font-size: 1.6rem; display: grid; place-items: center; transition: transform .15s; }
.a11y-btn:hover { transform: scale(1.08); }
.a11y-panel { position: fixed; inset-inline-start: 18px; bottom: 84px; width: 300px; max-width: calc(100vw - 36px); background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 161; padding: 18px; display: none; }
.a11y-panel.show { display: block; animation: cookieUp .25s cubic-bezier(.34,1.56,.64,1); }
.a11y-panel h3 { font-size: 1.05rem; margin-bottom: 4px; }
.a11y-panel .sub { font-size: .8rem; color: var(--text-mut); margin-bottom: 14px; }
.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y-grid button { background: var(--bg-soft); border: 1px solid var(--card-border); border-radius: var(--radius-sm); padding: 12px 8px; font-family: inherit; font-size: .82rem; font-weight: 600; color: var(--text); cursor: pointer; transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.a11y-grid button .i { font-size: 1.3rem; }
.a11y-grid button:hover { border-color: var(--brand); color: var(--brand); }
.a11y-grid button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.a11y-reset { margin-top: 10px; width: 100%; height: 40px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: var(--card); color: var(--text-soft); font-family: inherit; font-weight: 600; cursor: pointer; }
.a11y-reset:hover { border-color: var(--danger); color: var(--danger); }
.a11y-statement { margin-top: 8px; text-align: center; font-size: .8rem; }

/* ---------- Feedback widget ---------- */
.fb-btn { position: fixed; inset-inline-end: 18px; bottom: 18px; height: 46px; padding: 0 18px; border-radius: 999px; background: var(--card); color: var(--text-soft); border: 1px solid var(--card-border); cursor: pointer; box-shadow: var(--shadow); z-index: 155; font-family: inherit; font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: 7px; transition: all .15s; }
.fb-btn:hover { border-color: var(--brand); color: var(--brand); transform: translateY(-2px); }
.fb-modal { position: fixed; inset: 0; background: rgba(8,16,32,.55); z-index: 200; display: none; align-items: center; justify-content: center; padding: 18px; }
.fb-modal.show { display: flex; }
.fb-card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 24px; width: 100%; max-width: 420px; }
.fb-card h3 { font-size: 1.2rem; margin-bottom: 4px; }
.fb-card .sub { color: var(--text-mut); font-size: .88rem; margin-bottom: 16px; }
.fb-stars { display: flex; gap: 6px; justify-content: center; margin-bottom: 14px; direction: ltr; }
.fb-stars button { background: none; border: none; font-size: 2rem; cursor: pointer; filter: grayscale(1); opacity: .5; transition: all .12s; line-height: 1; }
.fb-stars button.on { filter: none; opacity: 1; transform: scale(1.12); }
.fb-card textarea { width: 100%; min-height: 90px; border-radius: var(--radius-sm); border: 1px solid var(--card-border); background: var(--bg-soft); color: var(--text); padding: 12px; font-family: inherit; font-size: .98rem; resize: vertical; }
.fb-card textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.fb-row { display: flex; gap: 10px; margin-top: 14px; }
.fb-row button { flex: 1; height: 46px; border-radius: var(--radius-sm); font-family: inherit; font-weight: 700; cursor: pointer; border: 1px solid var(--card-border); transition: all .15s; }
.fb-row .send { background: var(--grad); color: #fff; border-color: transparent; }
.fb-row .send:hover { filter: brightness(1.05); }
.fb-row .cancel { background: var(--card); color: var(--text-soft); }
.fb-ok { text-align: center; color: var(--good); font-weight: 700; padding: 12px 0; }

/* a11y body modes */
body.a11y-contrast { --bg: #000; --bg-soft: #111; --card: #000; --card-border: #fff; --text: #fff; --text-soft: #ffff00; --text-mut: #fff; --brand: #ffff00; --brand-2: #ffff00; --brand-soft: #222; }
body.a11y-contrast .result-main, body.a11y-contrast .cat-header::after, body.a11y-contrast .card::before { background: #ffff00 !important; color: #000 !important; }
body.a11y-links a { text-decoration: underline !important; color: var(--brand) !important; font-weight: 700 !important; }
body.a11y-readable, body.a11y-readable * { font-family: Arial, sans-serif !important; letter-spacing: .03em; }
body.a11y-grayscale { filter: grayscale(1); }
body.a11y-bigcursor, body.a11y-bigcursor * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M5 2l14 7-6 2-2 6z'/%3E%3C/svg%3E") 4 4, auto !important; }
