/* ============================================================
   RONEN — base.css
   Reset + טיפוגרפיה גלובלית. תלוי ב-tokens.css.
   אין כאן רכיבים ואין פריסה — רק היסודות.
   ============================================================ */

/* ---------- Reset ---------- */

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

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--body-size);
  line-height: var(--body-lh);
  font-weight: var(--fw-regular);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd { margin: 0; }

ul, ol { margin: 0; padding: 0; }

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button { background: none; border: 0; padding: 0; cursor: pointer; }

/* ---------- כותרות / Headings ----------
   ⚠️ משקל 400 בכל הכותרות. Fb Coherenti Sans הוא גופן תצוגה כבד —
   400 הוא "המראה המודגש". 700+ מפעיל faux-bold ונראה שבור. */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--fw-regular);
  color: var(--color-action);
  /* ⚠️ text-wrap: balance שובר טקסט קצר בקופסאות — ראה recurring-fixes */
  text-wrap: initial;
}

h1 { font-size: var(--h1-size); line-height: var(--h1-lh); letter-spacing: var(--h1-tracking); }
h2 { font-size: var(--h2-size); line-height: var(--h2-lh); letter-spacing: var(--h2-tracking); }
h3 { font-size: var(--h3-size); line-height: var(--h3-lh); letter-spacing: var(--h3-tracking); }
h4 { font-size: var(--h4-size); line-height: var(--h4-lh); letter-spacing: var(--h4-tracking); }
h5 { font-size: var(--h5-size); line-height: var(--h5-lh); letter-spacing: var(--h5-tracking); }
h6 { font-size: var(--h6-size); line-height: var(--h6-lh); letter-spacing: var(--h6-tracking); }

/* ---------- פסקאות / Paragraphs ---------- */

p { font-size: var(--p-l); line-height: var(--p-l-lh); }
p + p { margin-top: var(--p-l-gap); }

.p-xl { font-size: var(--p-xl); line-height: var(--p-xl-lh); }
.p-l  { font-size: var(--p-l);  line-height: var(--p-l-lh); }
.p-m  { font-size: var(--p-m);  line-height: var(--p-m-lh); }
.p-s  { font-size: var(--p-s);  line-height: var(--p-s-lh); }

/* ---------- קישורים / Links ---------- */

a {
  color: var(--color-link);
  text-decoration: none;
  transition: color var(--transition-fast), opacity var(--transition-fast);
}

a:hover { opacity: .78; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--color-action);
  outline-offset: 2px;
  border-radius: var(--radius-2xs);
}

/* ---------- רשימות / Lists ---------- */

ul, ol { list-style: none; }

.prose ul, .prose ol { padding-inline-start: 1.25em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: var(--space-2xs); }

/* ---------- טבלאות ותוכן זורם ---------- */

.prose { color: var(--color-text); }
.prose h2, .prose h3, .prose h4 { margin-top: var(--space-l); margin-bottom: var(--space-s); }

/* ⚠️ סולם כותרות למסמכים ארוכים (מאמרים, מדיניות, נגישות).
   בלי זה h2 יורש 56px/-4px מהסולם התצוגתי — גודל של כותרת סקשן,
   שמנפח מסמך בן עשרה פרקים ומקרטע מול טקסט של 18px. */
.prose h2 { font-size: 32px; line-height: 1.25; letter-spacing: -0.5px; }
.prose h3 { font-size: 24px; line-height: 1.3;  letter-spacing: -0.25px; }
.prose h4 { font-size: 20px; line-height: 1.35; letter-spacing: 0; }
.prose h2 + h3, .prose h3 + h4 { margin-top: var(--space-s); }
.prose p + p { margin-top: var(--p-l-gap); }
.prose a { text-decoration: underline; text-underline-offset: 3px; }

table { border-collapse: collapse; width: 100%; }

/* ---------- נגישות / Accessibility ----------
   ⚠️ אף פעם לא להסתיר עם left:-9999px — זה יוצר overflow אופקי אמיתי
   ושובר את פריסת ה-RTL. clip בלבד. */

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ⚠️ הסקיפ-לינק מוסתר עם clip (דרך .screen-reader-text) ולא עם offset שלילי.
   `inset-inline-start: -9999rem` נהפך ב-RTL להיסט חיובי ענק ויוצר
   overflow אופקי אמיתי שמותח את המסמך. */
.skip-link:focus {
  position: fixed !important;
  inset-block-start: var(--space-2xs);
  inset-inline-start: var(--space-2xs);
  z-index: var(--z-modal);
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  padding: var(--pad-s) var(--pad-l);
  overflow: visible !important;
  clip: auto !important;
  clip-path: none !important;
  background: var(--color-action);
  color: var(--color-on-action);
  border-radius: var(--radius-2xs);
}

/* ---------- בחירת טקסט ---------- */

::selection {
  background: var(--color-action);
  color: var(--color-on-action);
}
