/* ==========================================================================
   זוהר על הפרשה — /zohar and /zohar/<slug>
   Night blue and gold for the section, bordeaux for titles, cream paper for the
   reading sheet. The Zohar's own words are set in the book face (reader tools,
   server/lib/reader-tools.js); the explanation woven between them is set in the
   site face, a little smaller and quieter, so the eye can follow either one.
   ========================================================================== */
.rbz {
  --z-bord: #7e022b; --z-bord-2: #5c011f; --z-gold: #c9a24a; --z-gold-2: #ecd08c;
  --z-night: #13203b; --z-night-2: #0c1628; --z-cream: #fbf6ea;
  --rd-bg: #fbf8f1; --rd-paper: #ffffff; --rd-ink: #1b1713; --rd-pe: #545a62; --rd-mut: #6f6458; --rd-line: #ebe2cf;
  --rd-soft: rgba(126, 2, 43, .07); --rd-acc: #7e022b; --rd-head: #7e022b;
  background: var(--rd-bg); color: var(--rd-ink); direction: rtl;
  transition: background .25s, color .25s;
}
.rbz[data-theme="parchment"] {
  --rd-bg: #efe2c2; --rd-paper: #f7edd5; --rd-ink: #2a1b0b; --rd-pe: #5f4b31; --rd-mut: #77603f; --rd-line: #d9c497;
  --rd-soft: rgba(106, 69, 19, .1); --rd-head: #7a1a1a;
  background-image: radial-gradient(1200px 600px at 80% 0%, rgba(255,255,255,.45), transparent 60%),
                    radial-gradient(900px 700px at 0% 100%, rgba(150,110,50,.12), transparent 60%);
}
.rbz[data-theme="dark"] {
  --rd-bg: #0e1320; --rd-paper: #151c2c; --rd-ink: #efe8da; --rd-pe: #a9b0bb; --rd-mut: #9aa3b0; --rd-line: #263049;
  --rd-soft: rgba(236, 208, 140, .1); --rd-acc: #ecd08c; --rd-head: #ecd08c;
}
.rbz *, .rbz *::before, .rbz *::after { box-sizing: border-box; }
.rbz a { color: inherit; }
.rbz .rbz-wrap { max-width: 1240px; margin: 0 auto; padding: 0 28px; }
@media (max-width: 640px) { .rbz .rbz-wrap { padding: 0 16px; } }
body.rb-body .rbz h1, body.rb-body .rbz h2, body.rb-body .rbz h3 { font-family: 'almoni-tzar', sans-serif; }

/* ---- head (both pages) ------------------------------------------------- */
.rbz-hero {
  position: relative; overflow: hidden; color: #fff; padding: 44px 0 46px; text-align: center;
  background:
    radial-gradient(2px 2px at 12% 30%, rgba(236,208,140,.75), transparent 60%),
    radial-gradient(1.5px 1.5px at 22% 72%, rgba(255,255,255,.55), transparent 60%),
    radial-gradient(2px 2px at 78% 24%, rgba(236,208,140,.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 64%, rgba(255,255,255,.5), transparent 60%),
    radial-gradient(1.5px 1.5px at 64% 82%, rgba(236,208,140,.55), transparent 60%),
    radial-gradient(1.5px 1.5px at 40% 16%, rgba(255,255,255,.45), transparent 60%),
    radial-gradient(700px 320px at 50% 0%, rgba(201,162,74,.22), transparent 70%),
    linear-gradient(160deg, var(--z-night), var(--z-night-2) 70%);
  border-bottom: 3px solid var(--z-gold);
}
.rbz-hero::after {
  content: ''; position: absolute; inset: 10px; pointer-events: none;
  border: 1px solid rgba(236, 208, 140, .32); border-radius: 4px;
}
.rbz-hero .rbz-wrap { position: relative; z-index: 1; }
.rbz-crumbs { font-size: 16px; color: rgba(255,255,255,.7); margin-bottom: 14px; }
.rbz-crumbs a { color: rgba(255,255,255,.85); text-decoration: none; }
.rbz-crumbs a:hover { color: #fff; }
.rbz-crumbs i { font-style: normal; opacity: .5; margin: 0 7px; }
.rbz-bsd { display: block; font-size: 14px; color: var(--z-gold-2); opacity: .85; margin-bottom: 6px; }
body.rb-body .rbz-hero h1 {
  font-size: clamp(38px, 6vw, 68px); line-height: 1.04; margin: 0 0 12px; font-weight: 600; color: #fff;
  text-wrap: balance; letter-spacing: .2px;
}
.rbz-lead { margin: 0 auto; max-width: 56ch; font-size: 20px; line-height: 1.55; color: rgba(255,255,255,.86); text-wrap: balance; }
.rbz-orn { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; color: var(--z-gold-2); font-size: 15px; }
.rbz-orn i { display: block; width: 70px; height: 1px; background: linear-gradient(90deg, transparent, var(--z-gold)); }
.rbz-orn i:last-child { background: linear-gradient(270deg, transparent, var(--z-gold)); }
.rbz-kicker {
  display: inline-block; font-size: 16px; color: var(--z-gold-2); text-decoration: none;
  border: 1px solid rgba(236, 208, 140, .55); border-radius: 999px; padding: 2px 14px; margin: 0 4px 12px;
}
.rbz-kicker.is-week { background: var(--z-gold-2); color: var(--z-night); border-color: var(--z-gold-2); font-weight: 600; }
.rbz-sub { margin: 0 0 6px; font-size: 22px; color: var(--z-gold-2); }
.rbz-meta { margin: 0; font-size: 17px; color: rgba(255,255,255,.75); }
.rbz-hero--page { padding: 34px 0 38px; }
@media (max-width: 640px) {
  .rbz-hero { padding: 30px 0 32px; }
  .rbz-hero--page { padding: 24px 0 26px; }
  .rbz-crumbs { margin-bottom: 8px; font-size: 15px; }
  .rbz-kicker { margin-bottom: 8px; }
}

/* ---- the section page: this week's parasha ------------------------------ */
.rbz-weekwrap { padding: 30px 0 6px; }
.rbz-week {
  position: relative; display: block; max-width: 760px; margin: 0 auto; text-decoration: none; text-align: center;
  background: var(--z-cream); color: #1b1713; border: 3px double var(--z-gold); border-radius: 18px;
  padding: 26px 26px 24px; box-shadow: 0 14px 34px -22px rgba(19, 32, 59, .55);
  transition: transform .18s, box-shadow .18s;
}
.rbz-week::before {
  content: '✦'; position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px; line-height: 30px; border-radius: 50%;
  background: var(--z-night); color: var(--z-gold-2); font-size: 14px;
}
.rbz-week:hover { transform: translateY(-2px); box-shadow: 0 18px 38px -20px rgba(19, 32, 59, .6); }
.rbz-week .k { display: block; font-size: 16px; color: #8a6a24; letter-spacing: .3px; margin-bottom: 4px; }
.rbz-week .h { display: block; font-size: clamp(30px, 4.4vw, 44px); font-weight: 600; color: var(--z-bord); line-height: 1.1; }
.rbz-week .s { display: block; font-size: 19px; color: #8a6a24; margin-top: 2px; }
.rbz-week .q {
  display: block; max-width: 34em; margin: 14px auto 0; font-size: 22px; line-height: 1.5; color: #2b2520;
  font-family: var(--rb-book-font, 'Frank Ruhl Libre', serif);
}
body.rb-body .rbz-week .q { font-family: var(--rb-book-font, 'Frank Ruhl Libre', serif); }
.rbz-week .q::before { content: '״'; color: var(--z-gold); }
.rbz-week .q::after { content: '״'; color: var(--z-gold); }
.rbz-week .m { display: block; margin-top: 10px; font-size: 16px; color: #6f6458; }
.rbz-week .go {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 16px; padding: 9px 22px; border-radius: 999px;
  background: var(--z-bord); color: #fff; font-size: 18px; font-weight: 600;
}
.rbz-week .go i { font-style: normal; }
.rbz-week:hover .go { background: var(--z-bord-2); }

/* ---- the section page: the books and their parashot --------------------- */
.rbz-books { padding: 18px 0 70px; }
.rbz-book { margin-top: 30px; }
body.rb-body .rbz-book h2 {
  display: flex; align-items: center; gap: 14px; margin: 0 0 16px; font-size: 27px; font-weight: 600; color: var(--z-night);
}
.rbz[data-theme="dark"] .rbz-book h2 { color: var(--z-gold-2); }
.rbz-book h2::before, .rbz-book h2::after { content: ''; flex: 1 1 auto; height: 1px; background: linear-gradient(90deg, transparent, var(--z-gold)); }
.rbz-book h2::after { background: linear-gradient(270deg, transparent, var(--z-gold)); }
.rbz-tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); }
.rbz-tile {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 3px; min-height: 118px;
  padding: 16px 16px 14px; border-radius: 16px; text-decoration: none;
  background: #fff; border: 1px solid #eadfc6; box-shadow: 0 6px 16px -14px rgba(19, 32, 59, .5);
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.rbz-tile:hover { transform: translateY(-2px); border-color: var(--z-gold); box-shadow: 0 12px 22px -16px rgba(19, 32, 59, .55); }
.rbz-tile .wm {
  position: absolute; inset-inline-end: 8px; bottom: -14px; font-size: 84px; line-height: 1; font-weight: 700;
  color: var(--z-gold); opacity: .13; pointer-events: none; font-family: var(--rb-book-font, serif);
}
body.rb-body .rbz-tile .wm { font-family: var(--rb-book-font, 'Frank Ruhl Libre', serif); }
.rbz-tile .t { position: relative; font-size: 25px; font-weight: 600; color: var(--z-bord); line-height: 1.15; }
.rbz-tile .s { position: relative; font-size: 15px; color: #8a6a24; line-height: 1.3; }
.rbz-tile .c { position: relative; margin-top: auto; padding-top: 8px; font-size: 15px; color: #7a7064; }
.rbz-tile .badge {
  position: absolute; top: 10px; inset-inline-end: 10px; font-size: 13px; font-weight: 600; padding: 1px 10px;
  border-radius: 999px; background: var(--z-gold-2); color: var(--z-night);
}
.rbz-tile.is-week { background: linear-gradient(160deg, var(--z-night), var(--z-night-2)); border-color: var(--z-gold); }
.rbz-tile.is-week .t { color: #fff; }
.rbz-tile.is-week .s { color: var(--z-gold-2); }
.rbz-tile.is-week .c { color: rgba(255,255,255,.75); }
.rbz-tile.is-week .wm { opacity: .2; }
.rbz-tile.is-moed { background: linear-gradient(160deg, #fff, #fbf3e4); }
@media (max-width: 640px) {
  .rbz-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .rbz-tile { min-height: 104px; padding: 13px 13px 11px; }
  .rbz-tile .t { font-size: 22px; }
  .rbz-tile .wm { font-size: 70px; }
  .rbz-week { padding: 24px 18px 22px; }
  .rbz-week .q { font-size: 20px; }
  .rbz-lead { font-size: 18px; }
}

/* ---- a parasha: layout --------------------------------------------------- */
.rbz-layout { display: grid; grid-template-columns: 290px minmax(0, 780px); justify-content: center; gap: 34px; padding-top: 28px; padding-bottom: 70px; }
.rbz-toc { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 96px); overflow: auto; }
.rbz-toc details {
  background: var(--rd-paper); border: 1px solid var(--rd-line); border-radius: 16px; padding: 14px 14px 10px;
}
.rbz-toc summary {
  cursor: pointer; list-style: none; font-size: 19px; font-weight: 600; color: var(--rd-head); padding: 2px 4px 8px;
  border-bottom: 1px solid var(--rd-line); display: flex; align-items: center; justify-content: space-between;
}
.rbz-toc summary::-webkit-details-marker { display: none; }
.rbz-toc summary::after { content: '▾'; font-size: 14px; color: var(--rd-mut); transition: transform .2s; }
.rbz-toc details:not([open]) summary { border-bottom: 0; padding-bottom: 2px; }
.rbz-toc details:not([open]) summary::after { transform: rotate(90deg); }
.rbz-toc ol { list-style: none; margin: 8px 0 0; padding: 0; }
.rbz-toc li a {
  display: flex; gap: 10px; align-items: baseline; padding: 7px 6px; border-radius: 10px; text-decoration: none;
  font-size: 16px; line-height: 1.4; color: var(--rd-ink);
}
.rbz-toc li a:hover, .rbz-toc li a.is-on { background: var(--rd-soft); color: var(--rd-acc); }
.rbz-toc li b { flex: 0 0 auto; min-width: 26px; font-size: 14px; color: var(--z-gold); font-weight: 700; }
@media (max-width: 1099px) {
  .rbz-layout { grid-template-columns: minmax(0, 760px); gap: 18px; padding-top: 20px; }
  .rbz-toc { position: static; max-height: none; }
}

/* ---- the sticky reading bar ---------------------------------------------- */
.rbz-bar {
  position: sticky; top: 54px; z-index: 20; display: flex; align-items: center; justify-content: center;
  gap: 8px 10px; flex-wrap: wrap; padding: 9px 12px; margin-bottom: 18px;
  background: var(--rd-bg); background: color-mix(in srgb, var(--rd-bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border: 1px solid var(--rd-line); border-radius: 14px;
}
@media (max-width: 999px) { .rbz-bar { top: 72px; } }
/* on a phone the tools stay at the top of the text (two rows would take a third of the screen while reading);
   the choices are remembered, so they are set once */
@media (max-width: 640px) { .rbz-bar { position: relative; top: auto; padding: 8px 6px; } }
/* the explanation switch: a half-filled dot while the explanation shows, an outline when it is hidden */
.rbz-petool .sw-pe { background: linear-gradient(90deg, #ffffff 50%, #9aa0a8 50%) !important; }
.rbz-petool [aria-pressed="false"] .sw-pe { background: transparent !important; border-color: currentColor !important; }

/* ---- the sheet and the text ------------------------------------------------ */
.rbz-sheet {
  position: relative; background: var(--rd-paper); border: 1px solid var(--rd-line); border-radius: 18px;
  padding: 40px 48px 30px; box-shadow: 0 18px 40px -34px rgba(19, 32, 59, .6);
}
.rbz-sheet::before {
  content: ''; position: absolute; inset: 9px; border: 1px solid var(--rd-line); border-radius: 12px; pointer-events: none;
}
.rbz[data-theme="parchment"] .rbz-sheet { box-shadow: 0 18px 40px -30px rgba(90, 60, 20, .55); }
@media (max-width: 640px) { .rbz-sheet { padding: 24px 18px 20px; border-radius: 14px; } .rbz-sheet::before { inset: 6px; } }
.rbz-text { position: relative; font-size: var(--reader-size, 22px); transition: font-size .18s; }
.rbz-sec { scroll-margin-top: 140px; }
.rbz .rbz-h, body.rb-body .rbz .rbz-h {
  display: flex; gap: 12px; align-items: flex-start; margin: 0 0 .55em; font-family: 'almoni-tzar', sans-serif;
  font-size: 1.12em; line-height: 1.35; font-weight: 700; color: var(--rd-head); text-wrap: balance;
}
.rbz .rbz-h b {
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 1.7em; height: 1.7em;
  margin-top: .02em; padding: 0 .3em; border-radius: 999px; font-size: .68em; font-weight: 700;
  color: var(--z-night); background: var(--z-gold-2); border: 1px solid var(--z-gold);
}
.rbz[data-theme="dark"] .rbz-h b { color: var(--z-night); }
.rbz .rbz-p, body.rb-body .rbz .rbz-p {
  margin: 0 0 .9em; line-height: 1.95; text-align: justify; text-justify: inter-word; color: var(--rd-ink);
}
@media (max-width: 640px) { .rbz .rbz-p, body.rb-body .rbz .rbz-p { text-align: start; } }
/* the Zohar's own words: the book face, full ink */
.rbz .rbz-p .z, body.rb-body .rbz .rbz-p span.z {
  font-family: var(--rb-book-font); font-size: calc(1em * var(--rb-book-scale, 1)); font-weight: 500; color: var(--rd-ink);
}
/* the explanation: the site face, a little smaller and quieter */
.rbz .rbz-p .pe, body.rb-body .rbz .rbz-p span.pe {
  font-family: 'almoni-tzar', sans-serif; font-size: .86em; font-weight: 400; color: var(--rd-pe); padding-inline: 2px;
}
.rbz.no-pe .rbz-p .pe { display: none; }
.rbz.no-pe .rbz-p { text-align: start; }
.rbz-sep { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 1.6em 0 1.5em; color: var(--z-gold); font-size: 14px; opacity: .85; }
.rbz-sep i { display: block; width: 90px; height: 1px; background: linear-gradient(90deg, transparent, var(--z-gold)); }
.rbz-sep i:last-child { background: linear-gradient(270deg, transparent, var(--z-gold)); }
.rbz-stamp {
  display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 30px auto 4px; padding-top: 16px;
  border-top: 1px solid var(--rd-line); font-size: 15px; color: var(--rd-mut); text-align: center;
}
.rbz-stamp b { color: var(--rd-head); font-weight: 600; }
.rbz-printnote { display: none; }

/* ---- previous / next ------------------------------------------------------- */
.rbz-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; }
.rbz-pn a {
  display: flex; flex-direction: column; gap: 2px; padding: 14px 18px; border-radius: 14px; text-decoration: none;
  background: var(--rd-paper); border: 1px solid var(--rd-line); transition: border-color .15s, transform .15s;
}
.rbz-pn a:hover { border-color: var(--z-gold); transform: translateY(-1px); }
.rbz-pn .l { font-size: 15px; color: var(--rd-mut); }
.rbz-pn .t { font-size: 21px; font-weight: 600; color: var(--rd-head); }
.rbz-pn-prev .l::before { content: '→ '; }
.rbz-pn-next { text-align: left; }
.rbz-pn-next .l::after { content: ' ←'; }
.rbz-all { text-align: center; margin: 20px 0 0; font-size: 18px; }
.rbz-all a { color: var(--rd-acc); font-weight: 600; }

/* ---- print: the text only, on white, marked for geniza ---------------------- */
@media print {
  .rb-hdr, .rb-foot, .rbz-crumbs, .rbz-toc, .rbz-bar, .rbz-pn, .rbz-all, .rbz-kicker { display: none !important; }
  .rbz, .rbz-sheet { background: #fff !important; box-shadow: none !important; border: 0 !important; }
  .rbz-sheet::before { display: none; }
  .rbz-hero { background: #fff !important; color: #000 !important; border: 0; padding: 0 0 10px; }
  .rbz-hero::after { display: none; }
  body.rb-body .rbz-hero h1 { color: #7e022b !important; font-size: 26pt; }
  .rbz-sub, .rbz-meta, .rbz-bsd { color: #333 !important; }
  .rbz-layout { display: block; padding: 0; }
  .rbz-text { font-size: 15pt; }
  .rbz-printnote { display: block; text-align: center; font-size: 10pt; color: #555; margin: 0 0 8pt; }
  .rbz-sheet { padding: 0; }
}
