/* מגזין פאר התורה: עיצוב הגיליון, לפי הגיליונות של המוסד (קלף, סרטים סגולים וטורקיז עם מסגרת זהב, תמונות עגולות). עמוד = A4 */
.mg-viewport { position: relative; overflow: hidden; margin-top: 12px; }
.mg-doc { width: 794px; transform-origin: top right; display: grid; gap: 18px; }
.mg-page {
  --fs: 10.5pt; --ink: #2a1c0c; --purple: #57206b; --purple2: #7b3592; --teal: #0d5e5c; --teal2: #17807a; --gold: #c9a34a; --gold2: #f3d77f; --parch: #f7eed6; --parch2: #ead9ae;
  position: relative; width: 794px; height: 1123px; overflow: hidden; box-sizing: border-box; padding: 26px 28px;
  background: radial-gradient(ellipse at 15% 0%, rgba(255,255,255,.85), transparent 55%), linear-gradient(170deg, #cfe5f0 0%, #e9f2ea 45%, #dfeccf 100%);
  color: var(--ink); font: var(--fs)/1.5 'Heebo', Arial, sans-serif; direction: rtl; text-align: right; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
.mg-page p { margin: 0 0 .55em; }
.mg-page img { display: block; }
.mg-over { outline: 3px dashed #c0392b; outline-offset: -3px; }

/* כותרת השער */
.mg-mast { position: relative; margin: -26px -28px 10px; }
.mg-mast img { width: 100%; height: auto; }
.mg-badge { position: absolute; left: 3.2%; top: 29%; width: 11.6%; height: 30%; display: grid; place-content: center; text-align: center; background: radial-gradient(#fbf6e6, #f2e7c6); border-radius: 46%; color: #0d6a3a; font-family: 'Frank Ruhl Libre', serif; font-weight: 700; line-height: 1.12; }
.mg-badge b { font-size: 14px; }
.mg-badge span { font-size: 17px; }

/* קופסאות */
.mg-box { position: relative; background: linear-gradient(180deg, var(--parch), #f3e6c3); border: 2px solid var(--gold); border-radius: 18px; padding: 12px 14px 10px; margin-bottom: 12px; box-shadow: inset 0 0 18px rgba(160,120,40,.25), 0 3px 8px rgba(0,0,0,.12); }
.mg-box--plain { background: linear-gradient(180deg, #fbf5e4, #f5ead0); }
.mg-box--blue { border-color: #2c4f8c; box-shadow: inset 0 0 0 4px #e9eef8, inset 0 0 18px rgba(44,79,140,.25); }
.mg-scroll { position: relative; background: linear-gradient(90deg, var(--parch2), var(--parch) 8%, var(--parch) 92%, var(--parch2)); border-radius: 12px; border: 2px solid var(--gold); padding: 34px 14px 12px; margin: 22px 0 14px; box-shadow: 0 3px 10px rgba(0,0,0,.15); }
.mg-scroll > .mg-rib { position: absolute; top: -18px; right: 50%; transform: translateX(50%); }

/* כותרות בסרט */
.mg-bh { display: flex; align-items: center; gap: 10px; margin: -4px -2px 8px; }
.mg-rib { display: inline-flex; align-items: center; justify-content: center; min-width: 150px; padding: 5px 22px; border-radius: 999px; border: 2px solid var(--gold); background: linear-gradient(180deg, var(--purple2), var(--purple)); box-shadow: 0 0 0 2px #fff3 inset, 0 2px 6px rgba(0,0,0,.25); }
.mg-rib span { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: calc(var(--fs) * 1.75); color: var(--gold2); text-shadow: 0 1px 0 #3a1048; white-space: nowrap; }
.mg-bh--teal .mg-rib { background: linear-gradient(180deg, var(--teal2), var(--teal)); }
.mg-bh--teal .mg-rib span { text-shadow: 0 1px 0 #053; }
.mg-rib--big span { font-size: calc(var(--fs) * 2.1); }
.mg-by { display: grid; line-height: 1.25; margin-top: 3px; padding-inline-start: 6px; }
.mg-by b { font-size: calc(var(--fs) * 1.1); color: #3a2a12; }
.mg-by small { font-size: calc(var(--fs) * .9); color: #5a4a2a; }
.mg-face { flex: none; width: 66px; height: 66px; border-radius: 50%; overflow: hidden; border: 3px solid var(--gold); box-shadow: 0 0 0 2px #fff8e0, 0 2px 6px rgba(0,0,0,.3); background: #e9dcb8; }
.mg-face img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.18); }
.mg-face--empty { background: radial-gradient(#f3e7c7, #d9c38f); }
.mg-title { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: calc(var(--fs) * 1.55); line-height: 1.2; color: var(--purple); margin: 4px 0 6px; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 4px; }
.mg-sub { font-family: 'Frank Ruhl Libre', serif; font-size: calc(var(--fs) * 1.3); color: var(--purple); margin: 6px 0 4px; text-align: center; }
.mg-cols { column-count: 2; column-gap: 18px; column-rule: 1px solid #d9c592; text-align: justify; }
.mg-cols--3 { column-count: 3; }
.mg-more { margin-top: 6px; text-align: center; font-weight: 800; color: #fff; background: var(--purple); border-radius: 999px; padding: 2px 10px; font-size: calc(var(--fs) * .95); }
.mg-small { font-size: calc(var(--fs) * .9); color: #4a3a1a; text-align: center; margin-top: 4px; }
.mg-sign { font-weight: 800; text-align: left; }

/* שער */
.mg-cover { display: grid; grid-template-columns: 1fr 180px; gap: 12px; height: calc(100% - 255px); }
.mg-main { min-width: 0; overflow: hidden; }
.mg-side { order: 2; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.mg-side__cap { font-family: 'Frank Ruhl Libre', serif; font-weight: 700; font-size: calc(var(--fs) * 1.5); line-height: 1.15; color: var(--purple); text-align: center; text-shadow: 0 1px 0 #fff; }
.mg-side__photos { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.mg-side__photos img { width: 100%; flex: 1 1 0; min-height: 0; object-fit: cover; border-radius: 12px; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.mg-shabbat { display: grid; justify-items: center; gap: 0; padding: 10px 6px; border-radius: 16px; border: 2px solid var(--gold); background: linear-gradient(180deg, #fbf3dc, #efdfb4); text-align: center; line-height: 1.15; }
.mg-shabbat b { font-family: 'Frank Ruhl Libre', serif; color: var(--purple); font-size: calc(var(--fs) * 1.5); }
.mg-shabbat strong { font-family: 'Frank Ruhl Libre', serif; color: var(--purple); font-size: calc(var(--fs) * 2); margin-bottom: 4px; }
.mg-shabbat span { font-weight: 800; color: #3a2a12; margin-top: 4px; }
.mg-shabbat em { font-style: normal; font-family: 'Rubik', 'Heebo', sans-serif; font-weight: 800; font-size: calc(var(--fs) * 1.6); color: var(--purple); }

/* עמודים 2 ו-3 */
.mg-grid2 { display: grid; grid-template-columns: 1fr 232px; grid-template-areas: "b a"; gap: 12px; height: 100%; }
.mg-p2 .mg-grid2 { grid-template-columns: 232px 1fr; grid-template-areas: "a b"; }
.mg-p3 .mg-grid2 { grid-template-columns: 1fr 1fr; }
.mg-colA { grid-area: a; min-width: 0; }
.mg-colB { grid-area: b; min-width: 0; }
.mg-quiz { height: calc(100% - 12px); box-sizing: border-box; }
.mg-quiz__q p { margin-bottom: .45em; }
.mg-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mg-pair .mg-face { width: 52px; height: 52px; }
.mg-pair .mg-rib { min-width: 0; padding: 4px 12px; }
.mg-riddle { text-align: center; font-weight: 700; color: #2c4f8c; }
.mg-portrait { float: left; width: 38%; margin: 4px 0 6px 10px; border-radius: 10px; filter: grayscale(.2); }
.mg-table { width: 100%; border-collapse: separate; border-spacing: 0 3px; font-size: calc(var(--fs) * .95); }
.mg-table th, .mg-table td { padding: 3px 6px; text-align: center; }
.mg-table thead th { color: var(--purple); font-family: 'Frank Ruhl Libre', serif; font-size: calc(var(--fs) * 1.2); }
.mg-table tbody th { color: #fff; background: linear-gradient(180deg, var(--purple2), var(--purple)); border-radius: 0 10px 10px 0; white-space: nowrap; }
.mg-table tbody td { background: #fffaf0; border-top: 1px solid #ead8a8; border-bottom: 1px solid #ead8a8; }
.mg-table tbody td:last-child { border-radius: 10px 0 0 10px; }
.mg-table--b td { text-align: right; }
.mg-list { margin: 0; padding-inline-start: 18px; }

/* עמוד 4 */
.mg-ghead { margin: -26px -28px 8px; }
.mg-ghead img { width: 100%; }
.mg-gal h3 { font-family: 'Frank Ruhl Libre', serif; font-size: calc(var(--fs) * 1.6); color: #1f3d7a; text-align: center; margin: 4px 0 6px; }
.mg-gal__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.mg-gal__grid--1 { grid-template-columns: 1fr; } .mg-gal__grid--2 { grid-template-columns: 1fr 1fr; } .mg-gal__grid--3 { grid-template-columns: repeat(3, 1fr); }
.mg-gal__grid img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border: 3px solid #fff; border-radius: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.mg-gal__grid--1 img, .mg-gal__grid--2 img { aspect-ratio: 16/9; }
.mg-cont { margin-top: 8px; }

/* טופס העריכה */
.mg-ed { padding-block: 10px; }
.mg-ed__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mg-ed__t { flex: 1; display: flex; align-items: baseline; gap: 10px; border: 0; background: none; color: var(--text); font: inherit; text-align: start; cursor: pointer; padding: 6px 0; }
.mg-ed__t b { font-size: 17px; }
.mg-ed__t small { color: var(--muted); }
.mg-ed.open { border-color: var(--accent); }
.mg-ed__body { display: grid; gap: 12px; margin-top: 8px; }
.mg-ph { display: flex; align-items: center; gap: 10px; }
.mg-ph img, .mg-ph .mg-face { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.mg-ph .chip-btn { cursor: pointer; }
.mg-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.mg-thumbs span { position: relative; }
.mg-thumbs img { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; }
.mg-thumbs button { position: absolute; inset: auto 4px 4px auto; height: 30px; padding: 0 8px; }
.mg-stars { display: grid; gap: 6px; }
.mg-stars__row { display: grid; grid-template-columns: 70px repeat(3, minmax(0, 1fr)); gap: 6px; align-items: center; }
.mg-stars__row--2 { grid-template-columns: 70px 1fr; }
.mg-stars__row input { min-height: 42px; padding: 6px 10px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 15px; min-width: 0; }
.mg-galed { display: grid; gap: 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }

@media print {
  @page { size: A4; margin: 0; }
  body.mg-printing * { visibility: hidden; }
  body.mg-printing #mg-doc, body.mg-printing #mg-doc * { visibility: visible; }
  body.mg-printing #mg-doc { position: absolute; inset: 0 0 auto 0; transform: none !important; gap: 0; }
  body.mg-printing .mg-page { width: 210mm; height: 297mm; box-shadow: none; page-break-after: always; break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  body.mg-printing .mg-over { outline: 0; }
  body.mg-printing .mg-viewport { height: auto !important; overflow: visible; }
}
