/* ============================================================
   ברכת הבית לאורנית וגיא — הבסיס המשותף לארבעת הלוחות
   כל מידה פנימית נמדדת ב-em מתוך --pw (רוחב העמוד), ולכן
   מעבר בין A3 ל-A4 לא שובר שום דבר בפריסה.
   © אופיר ברנס (Ofir Baranes) 2026 - כל הזכויות שמורות
   ============================================================ */

/* ---------- גודל העמוד ---------- */
:root {
  --pw: 297mm;          /* A3 לאורך — ברירת המחדל */
  --ph: 420mm;
  --safe: 14mm;         /* שוליים בטוחים — כלום חשוב לא נכנס לכאן */
}
html.size-a4 {
  --pw: 210mm;
  --ph: 297mm;
  --safe: 10mm;
}

@page { size: A3 portrait; margin: 0; }

/* ---------- איפוס ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

body {
  font-family: 'Heebo', 'Segoe UI', Arial, sans-serif;
  background: #efeae1;
  color: #2a2622;
  min-height: 100vh;
}

/* ---------- סרגל הכלים (מסך בלבד) ---------- */
.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  background: #1b1a18;
  color: #f4efe6;
  font-size: 15px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, .28);
}
.bar__title { font-weight: 700; margin-inline-end: auto; font-size: 16px; }
.bar a, .bar button {
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: #1b1a18;
  background: #e8dcc2;
  border: 0;
  border-radius: 10px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}
.bar a:hover, .bar button:hover { background: #f3ecdb; }
.bar button[aria-pressed="true"] { background: #b98a3b; color: #fff; }
.bar__hint { font-size: 13px; opacity: .75; width: 100%; }

/* ---------- הבמה ---------- */
.stage {
  display: flex;
  justify-content: center;
  padding: 18px 12px 34px;
}

/* ---------- הלוח עצמו ---------- */
.sheet {
  position: relative;
  width: var(--pw);
  height: var(--ph);
  overflow: hidden;
  flex: none;
  /* גודל הבסיס לכל הטיפוגרפיה — הכל נגזר מרוחב העמוד */
  font-size: calc(var(--pw) / 40);
  line-height: 1.5;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
}

/* קריטי: SVG הוא flex item שאפשר לכווץ עד 0 בגובה. בלי flex:none, עומס
   טקסט קטן מרסק את כל הקישוטים לפס דק ואי אפשר לראות למה. */
.sheet svg { flex: none; }

/* אזור התוכן — לעולם לא נוגע בקצה הנייר */
.inner {
  position: absolute;
  inset: var(--safe);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* ---------- טיפוגרפיה משותפת ---------- */
.kicker {
  font-family: 'Frank Ruhl Libre', 'David Libre', serif;
  letter-spacing: .18em;
}
.title {
  font-family: 'Suez One', 'Frank Ruhl Libre', serif;
  font-weight: 400;
  margin: 0;
  line-height: 1.1;
}
.verse {
  font-family: 'Frank Ruhl Libre', 'David Libre', serif;
  margin: 0;
}
.verse p { margin: 0; }
.script {
  font-family: 'Gveret Levin AlefAlefAlef', 'Frank Ruhl Libre', cursive;
}

/* לחסום שבירת שורה בתוך שורת ברכה — כל שורה היא יחידה שלמה */
.verse p { text-wrap: balance; }

/* ---------- כותרת תחתונה במסך ---------- */
.credit {
  text-align: center;
  font-size: 13px;
  color: #6d6459;
  padding: 0 16px 26px;
  line-height: 1.7;
}

/* ---------- הדפסה ---------- */
@media print {
  html.size-a4 { }
  body { background: #fff; }
  .no-print { display: none !important; }
  .stage { padding: 0; display: block; }
  .sheet {
    box-shadow: none;
    transform: none !important;
    margin: 0;
    page-break-after: avoid;
    break-after: avoid;
  }
}

/* ---------- מסך: התאמת הלוח לרוחב החלון (נשלט מ-fit.js) ---------- */
@media screen {
  .fitbox { position: relative; }
  .sheet { transform-origin: top center; }
}
