/* פשוט נטו — one stylesheet for all locales. Logical properties only:
   the same rules render RTL for he/ar and LTR for en/fr/ru. */

:root {
  --bg: #F6F8F3;
  --ink: #1B2733;
  --muted: #44545F;
  --primary: #0E7A5F;
  --primary-ink: #0A5C48;
  --gold: #B07D1E;
  --gold-deep: #8A6113; /* 5.5:1 on white — for gold at small text sizes */
  --card: #FFFFFF;
  --wa: #25D366;
  --line: #DCE3D9;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(27, 39, 51, 0.08), 0 4px 16px rgba(27, 39, 51, 0.06);
  --font-head: 'Frank Ruhl Libre', 'Noto Serif Hebrew', serif;
  --font-body: 'Assistant', 'Noto Sans Hebrew', system-ui, sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}
html[lang="ar"] {
  --font-head: 'Noto Naskh Arabic', serif;
  --font-body: 'Noto Sans Arabic', system-ui, sans-serif;
}
html[lang="ru"] {
  --font-head: 'PT Serif', serif;
  --font-body: 'PT Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scrollbar-gutter: stable; }
body {
  margin: 0;
  background: var(--bg);
  background-image: radial-gradient(rgba(27, 39, 51, 0.045) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
html.a11y-contrast body { background-image: none; }

h1, h2, h3 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}
h1 { font-size: 1.9rem; margin-block: 0.4em 0.3em; }
main h1::after {
  content: "";
  display: block;
  width: 54px;
  height: 4px;
  border-radius: 2px;
  background: var(--primary);
  margin-block-start: 10px;
}
h2 { font-size: 1.35rem; margin-block: 1.6em 0.5em; }

a { color: var(--primary-ink); text-underline-offset: 2px; }
a:hover { color: var(--primary); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  inset-block-start: 0;
  z-index: 100;
  background: var(--card);
  color: var(--primary-ink);
  padding: 0.6em 1em;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}
.skip-link:focus { inset-inline-start: 12px; }

.wrap { max-width: 640px; margin-inline: auto; padding-inline: 18px; }

/* Header — sticky, single row: brand · (space) · languages · menu */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  background: var(--bg);
  border-block-end: 1px solid var(--line);
  padding-block: 10px;
}
.site-header .wrap { display: flex; align-items: center; gap: 12px; }
.site-header .lang-nav { margin-inline-start: auto; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.4rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-decoration: none;
}
.brand .w2 { color: var(--primary); }
.brand span { white-space: nowrap; }
.brand-logo { border-radius: 7px; display: block; }
.lang-nav { display: flex; gap: 2px; flex-wrap: wrap; }
.lang-nav a {
  font-size: 0.82rem;
  text-decoration: none;
  color: var(--muted);
  padding: 6px 8px;
  border-radius: 8px;
  min-height: 32px;
}
.lang-nav a[aria-current="true"] { color: var(--primary-ink); font-weight: 700; background: rgba(14, 122, 95, 0.09); }
.lang-nav a:hover { color: var(--primary-ink); }

/* Site menu */
.menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  min-height: 44px;
  padding: 9px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--primary-ink);
  background: var(--card);
  border: 1.5px solid var(--primary);
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}
.menu-btn:hover { background: rgba(14, 122, 95, 0.08); }
.menu-btn:active { transform: scale(0.97); }
.menu-btn[aria-expanded="true"] { background: var(--primary); color: #fff; }

.site-menu {
  position: absolute;
  inset-inline: 0;
  inset-block-start: 100%;
  z-index: 30;
  background: var(--card);
  border-block: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(27, 39, 51, 0.14);
  max-height: min(75dvh, 560px);
  overflow-y: auto;
  padding: 18px;
  animation: menu-open 200ms var(--ease);
}
.site-menu[hidden] { display: none; }
@keyframes menu-open {
  from { opacity: 0; transform: translateY(-8px); }
}
.m-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); max-width: 960px; margin-inline: auto; }
.m-title { font-weight: 700; font-size: 0.9rem; color: var(--primary-ink); margin-block: 0 4px; }
.site-menu ul { list-style: none; margin: 0; padding: 0; }
.site-menu li a {
  display: flex;
  align-items: center;
  min-height: 40px;
  padding-block: 4px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.95rem;
}
.site-menu li a:hover { color: var(--primary-ink); }
.site-menu li a[aria-current="page"] { color: var(--primary-ink); font-weight: 700; }
.m-extra { max-width: 960px; margin-inline: auto; margin-block-start: 14px; border-block-start: 1px dashed var(--line); padding-block-start: 12px; }
.m-langs { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-block-end: 10px; }
.m-langs a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.9rem;
}
.m-langs a[aria-current="true"] { border-color: var(--primary); color: var(--primary-ink); font-weight: 700; }
.m-legal { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 0.88rem; }
.m-legal a { color: var(--muted); min-height: 40px; display: inline-flex; align-items: center; }

@media (max-width: 759px) {
  .site-header .lang-nav { display: none; } /* languages live in the menu on mobile */
  .menu-btn { margin-inline-start: auto; }
}

.updated {
  display: inline-block;
  font-size: 0.82rem;
  color: var(--primary-ink);
  background: rgba(14, 122, 95, 0.09);
  border-radius: 999px;
  padding: 2px 12px;
  margin-block-end: 10px;
}

.lead { font-size: 1.02rem; max-width: 65ch; }
.tagline { font-weight: 600; color: var(--primary-ink); margin-block: -4px 12px; }

/* Key facts (בקצרה) */
.keyfacts {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-block: 18px;
}
.keyfacts h2 { margin-block: 0 0.3em; font-size: 1.05rem; }
.keyfacts ul { margin: 0; padding-inline-start: 1.2em; }
.keyfacts li { margin-block: 4px; }

/* Calculator card */
.calc {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-block: 20px;
}
.field { margin-block-end: 14px; }
.field label { display: block; font-weight: 600; margin-block-end: 5px; }
.field input, .field select {
  width: 100%;
  min-height: 48px;
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
}
.field input:focus, .field select:focus { border-color: var(--primary); outline: 2px solid var(--primary); outline-offset: 1px; }
.field .hint { font-size: 0.85rem; color: var(--muted); margin-block-start: 4px; }
.field-error { color: #A4262C; font-size: 0.88rem; font-weight: 600; margin-block: 6px 0; }
.field input.has-error, .field select.has-error { border-color: #A4262C; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 10px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 150ms var(--ease), transform 150ms var(--ease);
}
.btn:hover { background: var(--primary-ink); }
.btn:active { transform: scale(0.98); }

/* The receipt (תלוש) — signature element. No ad ever enters it. */
.receipt {
  position: relative;
  background: var(--card);
  border-radius: var(--radius) var(--radius) 0 0;
  box-shadow: var(--shadow);
  padding: 22px 22px 26px;
  margin-block: 26px 34px;
  filter: drop-shadow(0 6px 10px rgba(27, 39, 51, 0.07));
}
.receipt::after { /* perforated tear-off edge */
  content: "";
  position: absolute;
  inset-inline: 0;
  inset-block-end: -9px;
  height: 10px;
  background:
    linear-gradient(-45deg, transparent 7px, var(--card) 0) 0 0 / 14px 100%,
    linear-gradient(45deg, transparent 7px, var(--card) 0) 7px 0 / 14px 100%;
  background-repeat: repeat-x;
}
.receipt[hidden] { display: none; }
.receipt .r-title {
  font-size: 0.85rem;
  letter-spacing: normal;
  color: var(--muted);
  border-block-end: 1px dashed var(--line);
  padding-block-end: 8px;
  margin-block-end: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.result-big {
  font-family: var(--font-head);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  color: var(--gold);
  line-height: 1.1;
  margin-block: 6px 2px;
  unicode-bidi: isolate;
  direction: ltr;
  text-align: center;
}
.result-label { text-align: center; color: var(--muted); margin-block-end: 14px; }
.punchline { text-align: center; font-weight: 600; margin-block: 0 14px; }

.r-rows { border-block-start: 1px dashed var(--line); padding-block-start: 10px; }
.r-row { display: flex; justify-content: space-between; gap: 12px; padding-block: 3px; font-size: 0.95rem; }
.r-row .num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.r-row.total { font-weight: 700; border-block-start: 1px dashed var(--line); margin-block-start: 6px; padding-block-start: 8px; }

/* "what if you'd invested this in an index?" strip (compound calculator) */
.r-compare { border-block-start: 1px dashed var(--line); margin-block-start: 10px; padding-block-start: 10px; }
.r-compare-t { font-weight: 700; margin-block: 0 6px; }
.r-compare .r-row small { color: var(--muted); font-weight: 400; }
.r-compare .r-row.best .num { color: var(--gold-deep); font-weight: 700; }

/* The result "prints" out of the machine — motion conveys the moment. */
.receipt.printing { animation: receipt-print 450ms var(--ease) both; }
.receipt.printing .punchline:not([hidden]) { animation: stamp 250ms var(--ease) 250ms both; }
.receipt.printing .share-wa:not([hidden]) { animation: rise-in 250ms var(--ease) 380ms both; }
.receipt.printing .r-rows { animation: rise-in 300ms var(--ease) 150ms both; }
@keyframes receipt-print {
  0% { clip-path: inset(0 0 88% 0); transform: translateY(-12px); }
  100% { clip-path: inset(0 0 -20px 0); transform: none; }
}
@keyframes stamp {
  0% { opacity: 0; transform: scale(1.25); }
  100% { opacity: 1; transform: none; }
}
@keyframes rise-in {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: none; }
}

.share-wa[hidden] { display: none; }
.share-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  margin-block-start: 16px;
  font-weight: 700;
  font-size: 1rem;
  color: #063;
  color: #05391F;
  background: var(--wa);
  border-radius: 10px;
  text-decoration: none;
  transition: filter 150ms var(--ease), transform 150ms var(--ease);
}
.share-wa:hover { filter: brightness(1.05); color: #05391F; }
.share-wa:active { transform: scale(0.98); }
.share-wa svg { flex: none; }

/* Affiliate card — labeled, never inside the receipt (§9.4) */
.affiliate {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-block: 24px;
}
.affiliate .aff-label { font-size: 0.78rem; color: var(--muted); margin-block: 0 6px; }
.affiliate .aff-title { font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; margin-block: 0 4px; }
.affiliate .btn { margin-block-start: 10px; }

/* Expandable chart */
.chart-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-block: 18px;
}
.chart-box[hidden] { display: none; }
.chart-box summary { font-weight: 700; cursor: pointer; min-height: 40px; display: flex; align-items: center; color: var(--primary-ink); }
.chart-box[open] summary { margin-block-end: 8px; }
.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; font-family: var(--font-body); }
.ch-line { transition: opacity 200ms var(--ease); }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 0.85rem; color: var(--muted); margin-block-end: 6px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; }
.chart-tip {
  position: absolute;
  inset-block-start: 2px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  padding: 4px 10px;
  border-radius: 6px;
  pointer-events: none;
  white-space: nowrap;
  direction: ltr;
}

/* Content sections */
.content { max-width: 65ch; }
.content p { text-wrap: pretty; }

/* Data tables */
.table-wrap { overflow-x: auto; }
.table-wrap table { border-collapse: collapse; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap th, .table-wrap td { padding: 8px 14px; text-align: start; border-block-end: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table-wrap th { font-weight: 700; color: var(--primary-ink); font-size: 0.9rem; }
.table-wrap tr:last-child td { border-block-end: 0; }

/* FAQ */
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-block: 8px;
}
.faq summary { font-weight: 600; cursor: pointer; min-height: 32px; }
.faq details[open] summary { margin-block-end: 6px; }

/* Cluster strip (מחשבונים נוספים) */
.cluster { margin-block: 28px; }
.cluster ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.cluster a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  text-decoration: none;
  font-weight: 600;
  transition: border-color 150ms var(--ease);
}
.cluster a:hover { border-color: var(--primary); }

/* Home page calculator list */
.calc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.calc-list a {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  text-decoration: none;
  color: var(--ink);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}
.calc-list a:hover { transform: translateY(-2px); }
.calc-list .t { display: block; font-family: var(--font-head); font-weight: 700; font-size: 1.15rem; color: var(--primary-ink); }
.calc-list .d { display: block; color: var(--muted); font-size: 0.92rem; margin-block-start: 4px; max-width: 60ch; }

/* Sources & disclaimer */
.sources { font-size: 0.9rem; color: var(--muted); }
.sources ul { padding-inline-start: 1.2em; }
.disclaimer {
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  margin-block: 24px;
}

/* Footer */
.site-footer {
  margin-block-start: 48px;
  border-block-start: 1px solid var(--line);
  padding-block: 24px 90px;
  font-size: 0.88rem;
  color: var(--muted);
}
.site-footer nav { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-block-end: 10px; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--primary-ink); }

/* Accessibility widget — user-preference comfort tool (class toggles only,
   never mutates content DOM). Real compliance lives in the markup itself. */
.a11y-btn {
  position: fixed;
  inset-inline-start: 14px;
  inset-block-end: 14px;
  z-index: 40;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.a11y-panel {
  position: fixed;
  inset-inline-start: 14px;
  inset-block-end: 70px;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  width: min(280px, calc(100vw - 28px));
}
.a11y-panel[hidden] { display: none; }
.a11y-panel h2 { margin-block: 0 8px; font-size: 1rem; }
.a11y-panel button {
  display: block;
  width: 100%;
  min-height: 44px;
  font: inherit;
  text-align: start;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  margin-block: 6px;
  cursor: pointer;
}
.a11y-panel button[aria-pressed="true"] {
  border-color: var(--primary);
  background: rgba(14, 122, 95, 0.09);
  font-weight: 700;
}

/* Widget preference classes */
html.a11y-text-130 { font-size: 130%; }
html.a11y-contrast { --bg: #FFFFFF; --ink: #000000; --muted: #222f38; --line: #667; }
html.a11y-links a { text-decoration: underline; outline: 1px solid var(--primary-ink); outline-offset: 1px; }
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

@media print {
  .a11y-btn, .a11y-panel, .site-footer nav, .lang-nav, .share-wa { display: none; }
}
