/* SOUL flipbook, template v4 (D15 4.5.1, 4.5.7, 4.5.10): v3's style and, at its end, the load failure, the print button and
   its hidden frame. v3 (D12 §9.3.8, D13 §13): v2's style (v1 and the loading bar), and at its end the phone header
   with visible labels. The contents drawer starts closed in page.html; the pinch zoom is in viewer.js. */
/* the hidden attribute wins over the buttons' own display (e.g. "לשמוע סיכום" while a map has no voice) */
[hidden] { display: none !important; }
  /* every color of the page is a variable. The default is Yossef's choice (04.11.2026): palette 1 (Segulot Yossef black
     and gold) with the top of the summary window in the blue of the map's summary box. The other palettes stay for
     themes.html (?theme=<name>). Sources: BRAND\logos\brand_colors.txt, the black-and-gold buttons of the Segulot
     Yossef site (#17202b, #cbae75, #f4dcaa), and the summary box of the map PDF (#E8F0FB / #23386D, user-rules 266). */
  :root { --hdr:#17202b; --hdrInk:#f4dcaa; --accent:#cbae75; --accentInk:#17202b; --bgA:#fffdf8; --bgB:#f3eee4; --ink:#1d1d1f; --muted:#6d665b;
          --navInk:#17202b; --navEdge:#d8ccb2; --ghost:rgba(244,220,170,.14);
          --pan:#17202b; --panInk:#f4dcaa; --panSoft:#f8efdd; --panDeep:#17202b; --panLine:#e2d3b3; --panTrack:#ece3cf; --panShadow:rgba(23,32,43,.30);
          --topBg:#E8F0FB; --topInk:#23386D; --topLine:#c9d8f0; --mark:#cbae75; --markGlow:rgba(203,174,117,.55); }
  [data-theme="black-gold"] { --topBg:var(--panSoft); --topInk:var(--panDeep); --topLine:var(--panLine); }
  [data-theme="black-gold-blue"] { --pan:#2459AC; --panInk:#fff; --panSoft:#E8F0FB; --panDeep:#23386D; --panLine:#c9d8f0; --panTrack:#dde6f5; --panShadow:rgba(35,56,109,.28);
          --bgB:#f1ede6; --muted:#6a665f; }
  [data-theme="star-navy"] { --hdr:#23386D; --hdrInk:#fff; --accent:#C29B70; --accentInk:#16213f; --bgA:#fff; --bgB:#eef2f8; --ink:#1c2233; --muted:#5d6577;
          --navInk:#23386D; --navEdge:#c9d3e6; --ghost:rgba(255,255,255,.12);
          --pan:#2459AC; --panInk:#fff; --panSoft:#E8F0FB; --panDeep:#23386D; --panLine:#c9d8f0; --panTrack:#dde6f5; --panShadow:rgba(35,56,109,.28); }
  [data-theme="sky"] { --hdr:#0b4f86; --hdrInk:#fff; --accent:#A8DBEF; --accentInk:#0b3558; --bgA:#fff; --bgB:#eaf5fb; --ink:#14222f; --muted:#56687a;
          --navInk:#0b4f86; --navEdge:#bcdcee; --ghost:rgba(255,255,255,.14);
          --pan:#0073BC; --panInk:#fff; --panSoft:#e6f4fb; --panDeep:#0b3d66; --panLine:#bfe0f1; --panTrack:#d6ebf6; --panShadow:rgba(0,70,120,.25);
          --topBg:var(--panSoft); --topInk:var(--panDeep); --topLine:var(--panLine); }
  [data-theme="paper-gold"] { --hdr:#faf7f1; --hdrInk:#292238; --accent:#87612d; --accentInk:#fff; --bgA:#fff; --bgB:#f6f1e7; --ink:#292238; --muted:#6c6458;
          --navInk:#5a4320; --navEdge:#dfd7ca; --ghost:#efe7d8;
          --pan:#87612d; --panInk:#fff; --panSoft:#fbf5ea; --panDeep:#4e3816; --panLine:#e6d8bf; --panTrack:#efe5d2; --panShadow:rgba(80,60,20,.20);
          --topBg:var(--panSoft); --topInk:var(--panDeep); --topLine:var(--panLine); --mark:#87612d; }
  [data-theme="graphite"] { --hdr:#2c2f33; --hdrInk:#f2ede3; --accent:#C29B70; --accentInk:#1f2124; --bgA:#fbfbfa; --bgB:#ecebe8; --ink:#202124; --muted:#666;
          --navInk:#2c2f33; --navEdge:#d4d2cd; --ghost:rgba(255,255,255,.10);
          --pan:#3a3e44; --panInk:#fff; --panSoft:#f3f1ec; --panDeep:#24272b; --panLine:#dcd8cf; --panTrack:#e6e3dc; --panShadow:rgba(0,0,0,.25);
          --topBg:var(--panSoft); --topInk:var(--panDeep); --topLine:var(--panLine); --mark:#C29B70; }
  [data-theme="teal"] { --hdr:#0e3a4a; --hdrInk:#eaf6f9; --accent:#d8b27a; --accentInk:#0e3a4a; --bgA:#fff; --bgB:#e9f2f4; --ink:#16252b; --muted:#5a6b71;
          --navInk:#0e3a4a; --navEdge:#c4dbe1; --ghost:rgba(255,255,255,.12);
          --pan:#13667f; --panInk:#fff; --panSoft:#e7f3f6; --panDeep:#0e3a4a; --panLine:#c3dee6; --panTrack:#d5e9ee; --panShadow:rgba(14,58,74,.25);
          --topBg:var(--panSoft); --topInk:var(--panDeep); --topLine:var(--panLine); --mark:#d8b27a; }
  [data-theme="current"] { --hdr:#3B1F73; --hdrInk:#fff; --accent:#D9A21B; --accentInk:#3B1F73; --bgA:#fff; --bgB:#f4f1f8; --ink:#222; --muted:#6B6B7B;
          --navInk:#3B1F73; --navEdge:#d9d2e6; --ghost:rgba(255,255,255,.12);
          --pan:#2459AC; --panInk:#fff; --panSoft:#E8F0FB; --panDeep:#23386D; --panLine:#c9d8f0; --panTrack:#dde6f5; --panShadow:rgba(35,56,109,.28);
          --topBg:var(--panSoft); --topInk:var(--panDeep); --topLine:var(--panLine); --mark:#D9A21B; }

  * { box-sizing: border-box; }
  html, body { margin: 0; min-height: 100%; background: radial-gradient(circle at 50% 30%, var(--bgA) 0, var(--bgB) 70%) fixed; color: var(--ink);
               font-family: "Segoe UI", Arial, sans-serif; }
  /* the header and the toolbar stay at the top while the page scrolls */
  #top { position: sticky; top: 0; z-index: 20; }
  header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--hdr); color: var(--hdrInk); border-bottom: 3px solid var(--accent); }
  header .name { font-weight: 700; font-size: 17px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  header .name small { font-weight: 400; opacity: .8; margin-inline-start: 6px; }
  .btn { border: 0; border-radius: 22px; padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
  .btn.gold { background: var(--accent); color: var(--accentInk); }
  .btn.ghost { background: var(--ghost); color: var(--hdrInk); }
  .btn.blue { background: var(--pan); color: var(--panInk); }
  .btn:focus-visible, .tb button:focus-visible, .hl:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
  /* the toolbar: flipping and zoom */
  .tb { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; padding: 7px 10px; background: rgba(255,253,248,.94);
        border-bottom: 1px solid var(--navEdge); backdrop-filter: blur(6px); }
  .tb button { min-width: 38px; height: 36px; padding: 0 10px; border-radius: 10px; background: #fff; color: var(--navInk); border: 1px solid var(--navEdge);
               font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
  .tb button:hover:not(:disabled) { border-color: var(--accent); }
  .tb button:disabled { opacity: .35; cursor: default; }
  .tb .sep { width: 1px; height: 24px; background: var(--navEdge); margin: 0 6px; }
  .tb .info { color: var(--muted); font-size: 14px; min-width: 128px; text-align: center; font-variant-numeric: tabular-nums; }
  .tb .zoomv { min-width: 58px; font-variant-numeric: tabular-nums; }
  .chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; padding: 8px 10px 0; min-height: 42px; }
  .chip { background: var(--panSoft); color: var(--panDeep); border: 1px solid var(--accent); border-radius: 18px; padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
  .chip.on { background: var(--topBg, var(--panSoft)); color: var(--topInk, var(--panDeep)); border-color: var(--topInk, var(--pan)); }
  /* the book: a fixed size computed by the page (fit, or fit × zoom); when it is wider than the screen it scrolls */
  /* overscroll-behavior-x: a sideways swipe at the edge turns the page and must not take the browser back a page */
  html, body { overscroll-behavior-x: none; }
  #stage { overflow-x: auto; overscroll-behavior-x: none; padding: 12px 10px 30px; }
  #stage.panelroom { padding-bottom: 46vh; }
  #bookwrap { margin: 0 auto; position: relative; }
  #bookwrap > div { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
  /* StPageFlip 2.0.7 styles ".sft__wrapper" (a typo) and sizes the wrapper only with autoSize: the book has a fixed size here */
  #bookwrap .stf__wrapper { position: relative; width: 100%; height: 100%; }
  /* the library sets touch-action: pan-y on the book; zoomed on a touch screen the finger must pan sideways too */
  #bookwrap.pan .stf__parent { touch-action: pan-x pan-y; }
  /* zoomed with a mouse: the page is grabbed and moved */
  #bookwrap.grab { cursor: grab; }
  #bookwrap.grabbing { cursor: grabbing; }
  #loading { padding: 80px 0; color: var(--muted); text-align: center; }
  .pg { background: #fff; position: relative; overflow: hidden; }
  .pg canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  /* the summary box on the page: invisible until hovered; marked while it is the summary in the window */
  .hl { position: absolute; z-index: 2; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; border-radius: 4px;
        outline: 2px solid transparent; outline-offset: 3px; transition: outline-color .2s, box-shadow .2s, background-color .2s; scroll-margin: 140px 20px 46vh; }
  .hl:hover { outline-color: rgba(203,174,117,.7); }
  .hl.cur { outline: 3px solid var(--mark); background: rgba(203,174,117,.10); box-shadow: 0 0 0 6px var(--markGlow); }
  .hl.cur.playing { animation: pulse 1.8s ease-in-out infinite; }
  .hl .tag { position: absolute; inset-inline-start: 0; top: 0; transform: translateY(calc(-100% - 6px)); background: var(--hdr); color: var(--hdrInk);
             font: 600 12px/1 "Segoe UI", Arial, sans-serif; padding: 5px 9px; border-radius: 10px; white-space: nowrap; opacity: 0; transition: opacity .2s; pointer-events: none; }
  .hl.cur .tag { opacity: 1; }
  @keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--markGlow); } 50% { box-shadow: 0 0 0 10px rgba(203,174,117,.18); } }
  @media (prefers-reduced-motion: reduce) { .hl.cur.playing { animation: none; } }
  /* the summary panel: a floating window on a computer, a sheet at the bottom on a phone */
  #panel { position: fixed; z-index: 30; inset-inline-end: 18px; bottom: 18px; width: 380px; max-width: calc(100vw - 24px);
           background: #fff; border: 1px solid var(--pan); border-radius: 16px; box-shadow: 0 16px 50px var(--panShadow); overflow: hidden;
           transform: translateY(130%); transition: transform .28s ease; }
  #panel.open { transform: translateY(0); }
  #panel.side { inset-inline-end: auto; inset-inline-start: 18px; }
  #panel .top { background: var(--topBg, var(--panSoft)); padding: 12px 14px 10px; border-bottom: 1px solid var(--topLine, var(--panLine)); display: flex; gap: 8px; align-items: flex-start; }
  #panel .title { flex: 1; color: var(--topInk, var(--panDeep)); font-weight: 700; font-size: 16px; line-height: 1.35; }
  #panel .count { color: var(--muted); font-size: 12px; font-weight: 400; display: block; margin-top: 2px; }
  #panel .x { background: transparent; border: 0; font-size: 20px; color: var(--topInk, var(--panDeep)); cursor: pointer; line-height: 1; }
  #lines { padding: 14px 16px 6px; min-height: 150px; max-height: 38vh; overflow: auto; font-family: David, "Frank Ruhl Libre", Georgia, serif; font-size: 19px; line-height: 1.6; }
  #lines p { margin: 0 0 6px; opacity: .18; transform: translateY(6px); transition: opacity .45s ease, transform .45s ease; }
  #lines p.on { opacity: 1; transform: none; }
  #lines p.now { color: var(--topInk, var(--panDeep)); }
  .player { display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
  /* the voice: male or female (Yossef 05.11.2026: "כפתור שהלקוח בוחר קול גברי \ נשי") */
  .voices { display: flex; align-items: center; gap: 6px; padding: 8px 14px 0; }
  .voices .vlabel { font-size: 13px; color: var(--muted); margin-inline-end: 2px; }
  .voices button { border: 1px solid var(--panLine); background: #fff; color: var(--panDeep); border-radius: 16px; padding: 4px 12px;
                   font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
  .voices button[aria-checked="true"] { background: var(--pan); color: var(--panInk); border-color: var(--pan); }
  .play { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--pan); color: var(--panInk); font-size: 20px; cursor: pointer; flex: none; }
  .prog { flex: 1; height: 6px; background: var(--panTrack); border-radius: 3px; cursor: pointer; position: relative; direction: ltr; }
  .prog i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--pan); border-radius: 3px; }
  .time { font-size: 12px; color: var(--muted); direction: ltr; min-width: 70px; text-align: center; }
  .pnav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 6px 14px 8px; }
  .pnav .btn { background: #fff; color: var(--panDeep); border: 1px solid var(--panLine); }
  .pnav .btn:disabled { opacity: .35; cursor: default; }
  .pfoot { display: flex; gap: 8px; align-items: center; padding: 4px 14px 14px; flex-wrap: wrap; }
  .pfoot select { flex: 1; min-width: 150px; padding: 7px; border-radius: 10px; border: 1px solid var(--panLine); font: inherit; font-size: 14px; color: var(--panDeep); background: #fff; }
  .pfoot input { accent-color: var(--pan); }
  .pfoot label { font-size: 13px; color: var(--muted); display: flex; gap: 4px; align-items: center; }
  .note { margin: 18px auto 0; max-width: 760px; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.5; padding: 0 12px; }
  .tb button.on { background: var(--panSoft); border-color: var(--accent); }
  /* the links inside the PDF (its table of contents, the site links on the cover), clickable as in a PDF reader */
  .lnk { position: absolute; z-index: 2; display: block; border: 0; padding: 0; margin: 0; background: transparent; cursor: pointer; border-radius: 3px; }
  .lnk:hover, .lnk:focus-visible { background: rgba(36,89,172,.10); outline: 1px solid rgba(36,89,172,.4); }
  /* where a jump landed: a short gold line at the heading, fading out */
  .flash { position: absolute; z-index: 3; inset-inline: 3%; height: 0; border-top: 3px solid var(--mark); box-shadow: 0 0 0 5px var(--markGlow);
           pointer-events: none; animation: flash 1.8s ease-out forwards; }
  @keyframes flash { 0%, 55% { opacity: 1; } 100% { opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { .flash { animation-duration: 2.5s; } }
  /* the side panel: the table of contents. Right in Hebrew, left in English (the start side) */
  .layout { display: flex; align-items: flex-start; }
  .content { flex: 1; min-width: 0; }
  #side { position: sticky; top: var(--topH, 108px); height: calc(100vh - var(--topH, 108px)); width: 290px; flex: none; display: flex; flex-direction: column;
          background: #fffdf8; border-inline-end: 1px solid var(--navEdge); }
  #side.closed { display: none; }
  #side .head { display: flex; align-items: stretch; border-bottom: 1px solid var(--navEdge); }
  #side .sidet { flex: 1; padding: 12px 16px 10px; font-weight: 700; font-size: 15px; color: var(--hdr); border-bottom: 3px solid var(--accent); }
  #side .xs { display: none; background: none; border: 0; font-size: 20px; padding: 0 12px; cursor: pointer; color: var(--hdr); }
  #side .list { flex: 1; overflow: auto; padding: 6px 0 24px; }
  .ent { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 14px; border: 0; border-inline-start: 3px solid transparent; background: none;
         font: inherit; font-size: 14px; color: var(--ink); text-align: start; cursor: pointer; line-height: 1.35; }
  .ent:hover { background: #f6efe1; }
  .ent.l1 { font-weight: 700; color: var(--hdr); margin-top: 6px; }
  .ent.l1 .num { display: inline-block; min-width: 30px; padding: 1px 5px; margin-inline-end: 4px; border-radius: 4px; background: var(--hdr); color: var(--hdrInk); font-size: 12px; text-align: center; }
  .ent.l2 { padding-inline-start: 30px; }
  .ent.l3 { padding-inline-start: 48px; font-size: 13px; color: var(--muted); padding-block: 5px; }
  .ent.l3.here { color: var(--ink); }
  .ent.here { background: var(--panSoft); border-inline-start-color: var(--accent); }
  .ent .tt { flex: 1; }
  .ent .pn { color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }
  .ent .say { border: 0; background: none; padding: 2px 4px; font-size: 14px; cursor: pointer; border-radius: 6px; opacity: .8; }
  .ent .say:hover { opacity: 1; background: var(--topBg, var(--panSoft)); }
  #scrim { display: none; }
  @media (max-width: 1099px) {
    #side { position: fixed; z-index: 45; top: 0; bottom: 0; inset-inline-start: 0; height: auto; width: min(320px, 86vw); box-shadow: 0 0 40px rgba(0,0,0,.25); }
    #side .xs { display: block; }
    #scrim { position: fixed; inset: 0; z-index: 44; background: rgba(23,32,43,.35); }
    #scrim.on { display: block; }
  }
  @media (max-width: 700px) {
    header { padding: 8px 10px; }
    header .name small { display: none; }
    header .btn span.t { display: none; }
    .tb { gap: 4px; padding: 6px 6px; }
    .tb .wide, .tb .t { display: none; }
    .tb .sep { margin: 0 2px; }
    .tb .info { min-width: 0; font-size: 13px; }
    .tb button { min-width: 34px; padding: 0 8px; }
    #stage { padding: 8px 0 24px; }
    #panel { inset-inline: 0; bottom: 0; width: auto; max-width: none; border-radius: 16px 16px 0 0; }
    #lines { font-size: 18px; max-height: 26vh; min-height: 110px; }
  }
/* v2: the loading bar (Yossef 06.11.2026: "PROGRESS BAR עם %") */
#loading { display: flex; flex-direction: column; align-items: center; gap: 12px; }
#loading .ld-t { font-size: 16px; }
#loading .ld-bar { width: min(360px, 80vw); height: 10px; border-radius: 6px; background: var(--panTrack, #e8e2d4); overflow: hidden; }
#loading .ld-bar i { display: block; height: 100%; width: 0; background: var(--accent, #cbae75); transition: width .2s ease-out; }
#loading .ld-p { font-size: 14px; font-variant-numeric: tabular-nums; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { #loading .ld-bar i { transition: none; } }
/* v3: the header buttons (Yossef 06.11.2026: "בטלפון לא מבינים את הכפתורים למעלה ... הכפתורים לא ברורים ולא רואים את
   הלייבל"). An icon and a word, on every screen: the full label on a computer ("⬇ הורדת PDF", "🔊 לשמוע סיכום"), a short
   one on a phone ("⬇ PDF", "🔊 לשמוע סיכום"). The download button gets an edge so it reads as a button on the dark header. */
header .btn .s { display: none; }
header .btn .i { font-size: 15px; line-height: 1; }
header .btn { white-space: nowrap; flex: none; }
.btn.ghost { border: 1px solid rgba(244,220,170,.55); }
@media (max-width: 700px) {
  header { gap: 8px; }
  header .name { font-size: 15px; min-width: 0; }
  header .btn { padding: 7px 11px; font-size: 13px; gap: 5px; }
  header .btn span.t { display: none; }
  header .btn span.s { display: inline; }
}
@media (max-width: 360px) {
  header .btn { padding: 6px 9px; }
}
/* v4 (CLAUDE 09.11.2026, D15 4.5.7, C56): a load that failed: the reason and "לנסות שוב", in place of the bar */
#loading .ld-err { font-size: 16px; color: var(--ink); max-width: min(460px, 86vw); line-height: 1.55; }
#loading .ld-retry { display: inline-block; padding: 8px 18px; border-radius: 22px; background: var(--accent); color: var(--accentInk);
                     font-weight: 600; text-decoration: none; }
#loading .ld-retry:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }
.page-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center; background: var(--paper, white); color: var(--ink); z-index: 2; }
.page-error p { max-width: 32ch; line-height: 1.55; }
/* v4 (D15 4.5.10): "הדפסת PDF" beside the download, the same look; busy while the PDF loads for printing */
header .btn[aria-busy="true"] { opacity: .7; cursor: progress; }
/* the frame that prints map.pdf: in the page (a frame that is display:none does not print) but never seen */
.printframe { position: absolute; width: 0; height: 0; border: 0; visibility: hidden; }
/* a phone: every header button keeps its short label (Yossef's rule for phone header buttons); on the narrowest screens
   the print button drops its icon instead, so the four buttons still fit (CLAUDE 09.11.2026) */
@media (max-width: 380px) {
  header #print span.i { display: none; }
  header .btn { padding: 6px 8px; gap: 4px; }
}
