/* Shell-only chrome: TOC sidebar + loading state. Does not touch the book's own CSS. */
html, body { margin: 0; padding: 0; }
body { font-family: var(--sans-en, sans-serif); background: var(--paper, #F6F0E4); }

/* row-reverse puts the TOC on the right (matches the book's RTL orientation)
   without needing to reorder the markup itself. */
.shell-layout { display: flex; flex-direction: row-reverse; min-height: 100vh; }

.shell-toc {
  width: 240px; flex-shrink: 0; background: var(--wine-deep, #1E1A47);
  padding: 24px 14px; box-sizing: border-box; overflow: hidden auto;
  transition: width .2s ease, padding .2s ease;
  max-height: 100vh; position: sticky; top: 0;
}
.shell-toc.collapsed { width: 0; padding-left: 0; padding-right: 0; }
.shell-toc.collapsed h3,
.shell-toc.collapsed .toc-item { white-space: nowrap; }
.shell-toc h3 {
  color: var(--gold, #C1875A); font-size: 12px; text-transform: uppercase;
  letter-spacing: .06em; margin: 0 4px 12px 0; text-align: right;
}
.toc-item {
  display: block; width: 100%; text-align: right; background: none; border: none;
  color: #fff; padding: 10px 10px; border-radius: 8px; cursor: pointer; margin-bottom: 4px;
}
.toc-item:hover { background: rgba(255,255,255,.08); }
.toc-item.active { background: rgba(255,255,255,.14); }
.toc-item.active .toc-en { opacity: 1; }
.toc-he {
  display: block; font-size: 16px; direction: rtl;
  font-family: var(--sans-he, 'Varela Round', sans-serif); text-align: right;
}
.toc-en {
  display: block; font-size: 13px; opacity: .85; margin-top: 2px;
  font-family: var(--sans-en, 'Varela Round', sans-serif); text-align: right;
}

.shell-main { flex: 1; min-width: 0; }
#content { padding: 0; }
.loading { padding: 60px 20px; text-align: center; color: var(--ink-soft, #1D3A5C); font-size: 15px; }

/* Each unit is its own Shadow DOM host, mounted permanently (not swapped) so
   the book reads as one continuous scroll. This host element itself only
   needs a display context + a divider between units — everything else about
   how a unit looks lives inside that unit's own shadow tree. */
.book-unit { display: block; border-top: 3px double var(--paper-edge, #ECE2C9); }
.book-unit:first-child { border-top: none; }

/* Floating toggle button: fixed at the top-right so it stays reachable
   whether the TOC is open or collapsed. When the sidebar is expanded these
   buttons would otherwise land on top of its own header/items (they share
   the same right-edge real estate) -- shift them clear of it, see the
   body:has() rule below. */
.toc-toggle-btn {
  position: fixed; top: 14px; right: 14px; z-index: 600;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--wine-deep, #1E1A47); color: #fff; font-size: 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.toc-toggle-btn:hover { background: var(--wine, #2B2660); }

/* ---- fullscreen toggle ---- */
.fs-toggle-btn {
  position: fixed; top: 62px; right: 14px; z-index: 600;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--wine-deep, #1E1A47); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 0;
}
.fs-toggle-btn:hover { background: var(--wine, #2B2660); }
.fs-toggle-btn svg { width: 19px; height: 19px; display: block; }
.fs-toggle-btn .fs-exit { display: none; }
body.is-fullscreen .fs-toggle-btn .fs-enter { display: none; }
body.is-fullscreen .fs-toggle-btn .fs-exit  { display: block; }

/* ---- text-size control (A+ / A-): scales the book content only, never the
   sidebar or these floating buttons. Uses CSS zoom so text reflows to the
   column width instead of growing sideways like browser pinch-zoom. ---- */
.txt-size-btn {
  position: fixed; right: 14px; z-index: 600;
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: var(--wine-deep, #1E1A47); color: #fff;
  font-family: var(--sans-en, sans-serif); font-weight: 700; font-size: 17px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.25); padding: 0;
}
.txt-size-btn sup { font-size: 11px; line-height: 0; margin-left: 1px; }
.txt-size-btn:hover { background: var(--wine, #2B2660); }
.txt-plus  { top: 110px; }
.txt-minus { top: 158px; }

/* ---- HFH-KEYBOARD: floating Hebrew keyboard (shared with the Alphabet Book) ---- */
.kb-fab{ position:fixed; right:14px; top:206px; z-index:600; width:40px; height:40px; border-radius:50%; border:none;
  background:var(--wine-deep,#1E1A47); color:#fff; cursor:pointer; display:flex; align-items:center; justify-content:center;
  box-shadow:0 2px 8px rgba(0,0,0,.25); padding:0; }
.kb-fab:hover{ background:var(--wine,#2B2660); }
.kb-fab-icon{ width:24px; height:24px; display:block; }
.kb-panel{ position:fixed; left:0; right:0; bottom:0; background:#FFFDF6; border-top:2px solid var(--sky,#7C74D6);
  box-shadow:0 -4px 18px rgba(0,0,0,.18); z-index:650; transform:translateY(105%); transition:transform .2s ease;
  padding:10px 14px 14px; max-width:720px; margin:0 auto; border-radius:16px 16px 0 0; }
.kb-panel.open{ transform:translateY(0); }
.kb-head{ display:flex; align-items:center; justify-content:space-between; padding:2px 4px 8px; }
.kb-title{ font-family:var(--sans-en,'Varela Round',sans-serif); font-size:13px; font-weight:700; color:var(--ink-soft,#1D3A5C); }
.kb-title-he{ font-family:var(--sans-he,'Heebo',sans-serif); direction:rtl; margin-left:6px; }
.kb-close{ background:none; border:none; font-size:22px; line-height:1; color:var(--ink-soft,#1D3A5C); cursor:pointer; padding:0 6px; }
.kb-keys{ direction:ltr; }
.kb-row{ display:flex; justify-content:center; gap:4px; margin-bottom:4px; }
.kb-row:nth-child(2){ margin-inline-start:14px; }
.kb-row:nth-child(4){ margin-inline-start:28px; }
.kb-key{ flex:1; max-width:52px; height:46px; border-radius:8px; border:1px solid var(--paper-edge,#ECE2C9); background:#fff;
  display:flex; flex-direction:column; align-items:center; justify-content:center; cursor:pointer;
  transition:background .1s ease, transform .1s ease; padding:0; }
.kb-key:hover{ background:var(--gold-soft,#F1DFC8); }
.kb-key:active{ transform:scale(.94); background:var(--sky,#7C74D6); }
.kb-he{ font-family:var(--serif-he,'Heebo','Arial Hebrew',sans-serif); font-size:17px; color:var(--wine-deep,#1E1A47); line-height:1; }
.kb-en{ font-family:var(--sans-en,sans-serif); font-size:9px; color:var(--ink-soft,#1D3A5C); opacity:.6; margin-top:2px; }
.kb-row-bottom{ margin-top:4px; margin-inline-start:0 !important; }
.kb-space{ max-width:none; flex:6; font-family:var(--sans-en,sans-serif); font-size:12px; color:var(--ink-soft,#1D3A5C); }
.kb-back{ max-width:70px; flex:1.4; font-size:18px; }
@media (max-width:560px){ .kb-key{ height:38px; } .kb-he{ font-size:15px; } .kb-en{ font-size:8px; } }
/* ---- /HFH-KEYBOARD ---- */

/* These floating action buttons (TOC toggle, fullscreen, text-size, keyboard)
   sit fixed at the right edge of the viewport -- which is also where the
   (row-reversed) TOC sidebar lives. Whenever the sidebar is expanded, shift
   them left clear of it instead of letting them render on top of its own
   header/items. */
.toc-toggle-btn, .fs-toggle-btn, .txt-size-btn, .kb-fab { transition: right .2s ease; }
body:has(.shell-toc:not(.collapsed)) .toc-toggle-btn,
body:has(.shell-toc:not(.collapsed)) .fs-toggle-btn,
body:has(.shell-toc:not(.collapsed)) .txt-size-btn,
body:has(.shell-toc:not(.collapsed)) .kb-fab { right: 254px; }

/* HFH-PRINTPAGE: printed student-edition page in the sidebar TOC */
.toc-item{position:relative}
.toc-pg{display:block;font-size:11px;opacity:.7;font-family:var(--sans-en,sans-serif);margin-top:2px}

/* HFH-SECPAGE-CSS */
.toc-pg{display:block;font-size:12px;opacity:.8;margin-top:2px;direction:ltr}
.pg-go{display:flex;align-items:center;gap:6px;margin:4px 0 12px;font-family:'Varela Round',sans-serif;font-size:14px;direction:ltr}
.pg-go label{white-space:nowrap}
.pg-go input{width:78px;padding:6px 8px;border-radius:8px;border:1px solid #D9C9A8;background:#fff;color:#1E1A47;font:inherit}
.pg-go button{padding:6px 14px;border-radius:999px;border:0;background:#C1875A;color:#fff;font:inherit;cursor:pointer}
.shell-toc.collapsed .pg-go{display:none}
/* HFH-SECPAGE-CSS-END */

/* HFH-KB-NEXT */
.kb-nav{ max-width:110px; flex:2; font-family:var(--sans-en,sans-serif); font-size:13px; font-weight:600; color:#fff !important; background:var(--wine-deep,#1E1A47) !important; border-color:var(--wine-deep,#1E1A47) !important; white-space:nowrap; }

/* sample: single unit */
.pg-go{display:none !important}
