/* ============================================================
   Booni — שפת עיצוב משותפת לכל הדפים.
   RTL עברית.

   ערכת נושא: `color-scheme` + `light-dark()`, ולא שכפול של כל
   הפלטה בתוך media query. הטוגל בסרגל מציב `data-theme` על <html>,
   ובלי JS הדפדפן עדיין מקבל את ההעדפה של המערכת.
   ============================================================ */

:root {
  color-scheme: light dark;

  --bg:         light-dark(#faf9f7, #131317);
  --surface:    light-dark(#ffffff, #1c1c21);
  --surface-2:  light-dark(#f4f2ee, #232329);
  --ink:        light-dark(#1b1b1f, #f0efec);
  --muted:      light-dark(#6b6b75, #9b9ba5);
  --line:       light-dark(#e6e3de, #2e2e36);
  --accent:     light-dark(#2e6f5b, #4d9e83);
  --accent-ink: light-dark(#ffffff, #0e1a16);
  --accent-soft:light-dark(#eaf3ef, #1a2a25);
  --gold:       light-dark(#c8a15a, #d4b075);
  --danger:     light-dark(#b4443a, #e0736a);
  --danger-soft:light-dark(#fbeceb, #2a1a19);
  --ok: var(--accent);

  --radius: 10px;
  --radius-lg: 16px;
  /* כל שכבת צל בוחרת בנפרד — פסיק בתוך light-dark() מפריד ארגומנטים */
  --shadow-1: light-dark(rgba(20, 20, 25, .05), rgba(0, 0, 0, .3));
  --shadow-2: light-dark(rgba(20, 20, 25, .14), rgba(0, 0, 0, .5));
  --shadow-3: light-dark(rgba(20, 20, 25, .22), rgba(0, 0, 0, .6));
  --shadow:    0 1px 2px var(--shadow-1), 0 8px 24px -12px var(--shadow-2);
  --shadow-lg: 0 2px 4px var(--shadow-1), 0 24px 48px -20px var(--shadow-3);
  --font: "Heebo", -apple-system, "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  direction: rtl;
  text-align: right;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: clamp(26px, 4.5vw, 40px); }
h2 { font-size: clamp(20px, 3vw, 26px); }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 20px; }
.wrap-narrow { max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* ── סרגל עליון ────────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  position: sticky; top: 0; z-index: 30;
}
.topbar .brand {
  font-weight: 800; font-size: 20px; letter-spacing: -.02em;
  color: var(--ink); text-decoration: none;
}
.topbar .brand span { color: var(--accent); }
.topbar .spacer { flex: 1; }
.topbar .who { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--muted); }
.topbar .who img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }

/* ── כרטיסים ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-sub { color: var(--muted); font-size: 14px; margin: 4px 0 0; }

/* ── כפתורים ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  font: inherit; font-weight: 600; font-size: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.07); background: var(--accent); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.big { padding: 14px 28px; font-size: 16px; border-radius: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }

.btn-google { background: var(--surface); border-color: var(--line); font-weight: 600; }
.btn-google svg { width: 19px; height: 19px; flex: none; }

/* ── טפסים ─────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--danger); margin-inline-start: 2px; }
.field .hint { font-size: 13px; color: var(--muted); margin-top: 5px; }

.input, textarea.input, select.input {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input.invalid { border-color: var(--danger); }
textarea.input { resize: vertical; min-height: 120px; line-height: 1.7; }
.input::placeholder { color: var(--muted); opacity: .7; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 620px) { .grid-2 { grid-template-columns: 1fr; } }

.check {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
  transition: border-color .15s, background .15s;
}
.check:hover { border-color: var(--accent); }
.check input { margin: 3px 0 0; accent-color: var(--accent); flex: none; width: 17px; height: 17px; }
.check.on { border-color: var(--accent); background: var(--accent-soft); }
.check .t { font-weight: 600; font-size: 14px; }
.check .s { font-size: 13px; color: var(--muted); }

/* ── שונות ─────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--muted);
}
.pill.ok { background: var(--accent-soft); color: var(--accent); }
.pill.warn { background: var(--danger-soft); color: var(--danger); }

.note {
  padding: 13px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 14px;
}
.note.warn { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.note.ok { border-color: var(--accent); background: var(--accent-soft); }

.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.center { text-align: center; }
.hidden { display: none !important; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* טוסט */
#toast {
  position: fixed; inset-inline: 0; bottom: 22px;
  display: flex; justify-content: center;
  pointer-events: none; z-index: 90;
}
#toast .msg {
  background: var(--ink); color: var(--bg);
  padding: 11px 20px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
#toast .msg.show { opacity: 1; transform: none; }
#toast .msg.bad { background: var(--danger); color: #fff; }

/* ספינר */
.spin {
  width: 16px; height: 16px; flex: none;
  border: 2px solid currentColor; border-top-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--muted); }

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

/* ── לוגו הסטודיו ──────────────────────────────────────────── */
.studio-logo { max-width: 180px; max-height: 76px; width: auto; height: auto; display: block; }
.studio-logo.center { margin-inline: auto; }

/* ── ערכת נושא + נגישות ────────────────────────────────────── */

/* מיקוד תמיד נראה. אי אפשר לנווט בטאב במסך שהמיקוד בו בלתי נראה. */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; inset-inline-start: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: var(--accent-ink);
  padding: 10px 18px; border-radius: 0 0 var(--radius) 0; font-weight: 700;
}
.skip-link:focus { inset-inline-start: 0; }

#booni-tools {
  position: fixed; inset-inline-start: 14px; bottom: 14px; z-index: 80;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
}
.tool-btn {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  font-size: 20px; line-height: 1;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow); cursor: pointer;
}
.tool-btn:hover { background: var(--surface-2); }

#a11y-panel {
  width: min(300px, calc(100vw - 28px));
  padding: 16px;
  border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: var(--surface); box-shadow: var(--shadow-lg);
  max-height: min(70vh, 560px); overflow: auto;
}
#a11y-panel h3 { font-size: 15px; margin-bottom: 10px; }
.a11y-row { display: flex; gap: 6px; margin-bottom: 8px; }
.a11y-row button {
  flex: 1; padding: 9px 6px;
  font: inherit; font-size: 13.5px; font-weight: 600;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer;
}
.a11y-row button[aria-pressed="true"] {
  background: var(--accent-soft); border-color: var(--accent); color: var(--accent);
}
.a11y-row button:hover { border-color: var(--accent); }
.a11y-label { font-size: 12.5px; color: var(--muted); margin: 12px 0 5px; font-weight: 600; }

/* גודל טקסט — על <html>, כך שכל היחידות היחסיות גדלות איתו */
html[data-a11y-size="1"] { font-size: 112.5%; }
html[data-a11y-size="2"] { font-size: 125%; }
html[data-a11y-size="3"] { font-size: 140%; }

/* ניגודיות גבוהה — שחור/לבן מלא, בלי צללים ובלי גווני ביניים */
html[data-a11y-contrast="on"] {
  --bg: light-dark(#ffffff, #000000);
  --surface: light-dark(#ffffff, #000000);
  --surface-2: light-dark(#ffffff, #000000);
  --ink: light-dark(#000000, #ffffff);
  --muted: light-dark(#000000, #ffffff);
  --line: light-dark(#000000, #ffffff);
  --accent: light-dark(#00396b, #ffe600);
  --accent-ink: light-dark(#ffffff, #000000);
  --accent-soft: light-dark(#ffffff, #000000);
  --danger: light-dark(#8b0000, #ff8a80);
  --danger-soft: light-dark(#ffffff, #000000);
  --shadow: none; --shadow-lg: none;
}
html[data-a11y-contrast="on"] img:not(.keep-color) { filter: grayscale(1) contrast(1.2); }

html[data-a11y-links="on"] a { text-decoration: underline !important; font-weight: 700; }

/* גופן קריא — Arial רחב יותר ומרווח, מומלץ לדיסלקציה */
html[data-a11y-readable="on"] body,
html[data-a11y-readable="on"] .input,
html[data-a11y-readable="on"] .btn {
  font-family: Arial, Verdana, sans-serif !important;
  letter-spacing: .02em;
  word-spacing: .12em;
  line-height: 1.9;
}

html[data-a11y-motion="off"] *,
html[data-a11y-motion="off"] *::before,
html[data-a11y-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
