@import url('https://fonts.googleapis.com/css2?family=Frank+Ruhl+Libre:wght@400;700&family=David+Libre:wght@400;700&family=Noto+Serif+Hebrew:wght@400;700&display=swap');

/* Olam Tov library – clean white reading room in the site's navy and gold. */
body.olamtov-library-page #primary { margin: 0 !important; }
body.olamtov-library-page .entry-header { display: none !important; }
body.olamtov-library-page .ast-container, body.olamtov-library-page .site-content > .ast-container { max-width: 100% !important; padding: 0 !important; }
body.olamtov-library-page article.page, body.olamtov-library-page .ast-article-single { padding: 0 !important; background: transparent !important; box-shadow: none !important; margin: 0 !important; }
body.olamtov-library-page .entry-content > *:not(.otlib):not(link):not(script) { display: none; }

.otlib, .otlib-pop { --navy: #0b1424; --gold: #c9a227; --ink: #1f2a44; --muted: #6b7080; --line: #e6e8ec; }
.otlib { --otlib-font: "Frank Ruhl Libre", serif; --otlib-size: 22px; --otlib-line: 1.9;
	direction: rtl; color: var(--ink); background: #fff; font-family: Assistant, Arial, sans-serif; min-height: 70vh; }
.otlib a { color: var(--ink); }
.otlib button { font-family: inherit; }
.otlib.is-busy { cursor: progress; opacity: .7; }
.otlib-loading, .otlib-empty { color: var(--muted); padding: 10px 0; }
.otlib-error { background: #fdecea; color: #8a1c12; padding: 14px; border-radius: 10px; margin: 20px; }
.otlib-link { background: none; border: 0; color: var(--ink); text-decoration: underline; cursor: pointer; padding: 0 4px; font-size: inherit; }
.otlib-btn, .otlib-btn-ghost { display: inline-flex; align-items: center; gap: 6px; border-radius: 22px; padding: 7px 16px; font-size: 15px; cursor: pointer; text-decoration: none !important; }
.otlib-btn { background: var(--navy); color: #fff !important; border: 0; font-weight: 700; }
.otlib-btn-ghost { background: #fff; color: var(--ink) !important; border: 1px solid #cfd4dc; }
.otlib-btn-ghost.is-on { background: var(--gold); border-color: var(--gold); color: var(--navy) !important; font-weight: 700; }
.otlib button { box-shadow: none; text-transform: none; letter-spacing: normal; line-height: 1.3; }
.otlib-icon { width: 40px; height: 40px; min-width: 0 !important; padding: 0 !important; border: 0 !important; background: transparent !important; border-radius: 50% !important; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: inherit; flex: 0 0 auto; }
.otlib-icon svg { width: 22px; height: 22px; fill: currentColor; stroke: currentColor; stroke-width: 0; }
.otlib-pager svg { fill: none; stroke-width: 2.4; }
.otlib-icon:hover, .otlib-icon:focus-visible { background: rgba(255,255,255,.12) !important; }
.otlib-icon[disabled] { opacity: .35; cursor: default; }
.otlib-icon.is-on { background: var(--gold) !important; color: var(--navy); }
.otlib-btn, .otlib-btn-ghost, .otlib-tabs button, .otlib-search button, .otlib-link, .otlib-my-tools button { padding-top: 7px; padding-bottom: 7px; }
.otlib-tabs button { padding: 7px 16px !important; color: var(--ink) !important; background: #fff !important; border: 0 !important; border-radius: 0 !important; }
.otlib-tabs button[aria-selected=true] { background: var(--navy) !important; color: #fff !important; }
.otlib-search button { padding: 0 !important; border-radius: 0 !important; background: var(--navy) !important; color: #fff !important; }
.otlib-link { padding: 0 4px !important; background: none !important; color: var(--ink) !important; border: 0 !important; }
.otlib-btn-ghost { padding: 7px 16px !important; border-radius: 22px !important; background: #fff !important; }
.otlib-btn-ghost.is-on { background: var(--gold) !important; }
.otlib-btn { padding: 8px 18px !important; border-radius: 22px !important; background: var(--navy) !important; }
.otlib-pop-x { padding: 0 !important; background: none !important; }
.otlib-my-tools button { padding: 0 !important; color: var(--ink) !important; }
.otlib :focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* Top bar – always visible while reading. */
.otlib-bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 6px; background: var(--navy); color: #fff; padding: 6px 12px; min-height: 52px; }
body.admin-bar .otlib-bar { top: 32px; }
.otlib-bar a { color: #fff; }
.otlib-bar-title { flex: 1; min-width: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; font-size: 16px; }
.otlib-bar-title strong { font-size: 18px; }
.otlib-bar-title small { color: #c3ccdb; font-size: 13px; }
.otlib-where { color: var(--gold); font-weight: 700; }
.otlib-home-link { text-decoration: none; opacity: .85; }
.otlib-pager { display: flex; }

.otlib-panel { position: sticky; top: 52px; z-index: 45; background: #f7f5ef; border-bottom: 1px solid var(--line); padding: 14px 18px; max-height: 70vh; overflow: auto; box-shadow: 0 8px 20px rgba(0,0,0,.08); }
body.admin-bar .otlib-panel { top: 84px; }
.otlib-panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 24px; }
.otlib-panel fieldset { border: 0; margin: 0; padding: 0; }
.otlib-panel legend { font-weight: 700; margin-bottom: 6px; }
.otlib-panel label { display: flex; align-items: center; gap: 6px; margin: 3px 0; font-size: 15px; }
.otlib-panel select { font-size: 15px; padding: 5px 8px; border-radius: 6px; border: 1px solid #cfd4dc; }
.otlib-comm-list { max-height: 220px; overflow: auto; }

.otlib-speech { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; background: #fff8e1; border-bottom: 1px solid #f0e2b0; padding: 8px 16px; font-size: 15px; }
.otlib-speech small { color: var(--muted); }

.otlib-wrap { display: flex; align-items: flex-start; }
.otlib { max-width: none !important; width: 100%; }
.otlib-wrap > main { flex: 1 1 auto; min-width: 0; width: 100%; box-sizing: border-box; }
.otlib-filter, .otlib-sort select { height: 38px !important; min-height: 0 !important; box-sizing: border-box; line-height: 1.2 !important; padding-top: 0 !important; padding-bottom: 0 !important; }

/* Side bar: chapters / dafs / gates (can be hidden). */
.otlib-toc { flex: 0 0 250px; position: sticky; top: 52px; max-height: calc(100vh - 52px); overflow: auto; border-left: 1px solid var(--line); padding: 10px 12px 30px; background: #fbfbfc; font-size: 15px; }
body.admin-bar .otlib-toc { top: 84px; max-height: calc(100vh - 84px); }
.otlib-toc-hidden .otlib-toc { display: none; }
.otlib-toc-head { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.otlib-word { font-size: 13px; color: var(--muted) !important; }
.otlib-toc summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
.otlib-toc ol { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 4px; }
.otlib-toc li { margin: 0; }
.otlib-toc li a { display: block; text-align: center; padding: 4px 2px; border-radius: 6px; text-decoration: none; background: #fff; border: 1px solid var(--line); font-size: 14px; }
.otlib-toc li a:hover { border-color: var(--gold); }
.otlib-toc li a[aria-current] { background: var(--navy); color: #fff; border-color: var(--navy); }

/* The text: white page, comfortable measure. */
.otlib-read { flex: 1; min-width: 0; padding: 20px 28px 60px; }
.otlib-text { font-family: var(--otlib-font); font-size: var(--otlib-size); line-height: var(--otlib-line); max-width: 860px; margin: 0 auto; }
.otlib-has-side .otlib-text { max-width: 1300px; }
.otlib-part { font-family: Assistant, sans-serif; font-size: 20px; color: var(--muted); border-bottom: 1px solid var(--line); margin: 30px 0 10px; }
.otlib-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 6px 0; }
.otlib-has-side .otlib-row { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); border-bottom: 1px solid #f1f2f4; padding: 14px 0; }
.otlib-row.is-p, .otlib-row.is-s { margin-bottom: .6em; }
.otlib-main { text-align: justify; }
.otlib-seg { border-radius: 4px; transition: background .2s; }
.otlib-seg.is-hl { background: #fff3c4; }
.otlib-seg.is-reading { background: #e7f0ff; }
.otlib-mode-click .otlib-seg { cursor: pointer; }
.otlib-mode-click .otlib-seg:hover { background: #f6f3e8; }
/* A book without commentators: its words are plain text, nothing to click. */
.otlib-no-comms.otlib-mode-click .otlib-seg { cursor: text; }
.otlib-no-comms.otlib-mode-click .otlib-seg:hover { background: none; }
.otlib-seg.has-dh { text-decoration: underline dotted var(--gold); text-underline-offset: 6px; }
.otlib-n { font-family: Assistant, sans-serif; font-size: .5em; color: var(--gold); font-weight: 700; vertical-align: super; margin-left: 2px; user-select: none; }
.otlib-side { display: none; }
.otlib-has-side .otlib-side { display: block; font-family: var(--otlib-font); font-size: calc(var(--otlib-size) * .68); line-height: 1.7; color: #33394a; }
.otlib-c { margin: 0 0 10px; }
.otlib-c summary { font-family: Assistant, sans-serif; font-weight: 700; color: var(--navy); cursor: pointer; font-size: 15px; border-bottom: 2px solid var(--gold); display: inline-block; margin-bottom: 4px; }
.otlib-c p { margin: 0 0 6px; }
.otlib-c-item { margin-bottom: 6px; }
.otlib-foot { max-width: 860px; margin: 30px auto 0; }
.otlib-foot-pager { display: flex; justify-content: space-between; margin: 20px 0; }
.otlib-credit { font-size: 13px; color: var(--muted); }

/* "Text only" mode: the commentators open in a side sheet. */
.otlib-pop { position: fixed; z-index: 99990; display: flex; flex-direction: column; background: #fff; box-shadow: 0 12px 40px rgba(0,0,0,.25); direction: rtl; font-family: Assistant, sans-serif; overflow: hidden; resize: both; min-width: 260px; min-height: 160px; max-width: 100vw; max-height: 100vh; border-radius: 12px; }
.otlib-pop[hidden] { display: none !important; }
.otlib-pop.is-float { width: 440px; height: 60vh; }
.otlib-pop.is-right { right: 0; bottom: 0; border-radius: 0; resize: horizontal; max-width: 70vw; box-shadow: -6px 0 24px rgba(0,0,0,.15); }
.otlib-pop.is-left { left: 0; bottom: 0; border-radius: 0; resize: horizontal; max-width: 70vw; box-shadow: 6px 0 24px rgba(0,0,0,.15); }
.otlib-pop.is-top { left: 0; right: 0; border-radius: 0; resize: vertical; max-height: 75vh; box-shadow: 0 6px 24px rgba(0,0,0,.15); }
.otlib-pop.is-sheet { left: 0; right: 0; bottom: 0; height: 60vh; border-radius: 14px 14px 0 0; resize: none; }
.otlib-pop.is-dragging { opacity: .92; user-select: none; }
.otlib-pop-head { flex: 0 0 auto; display: flex; align-items: center; gap: 6px; background: var(--navy); color: #fff; padding: 6px 10px; cursor: move; user-select: none; touch-action: none; }
.otlib-pop.is-sheet .otlib-pop-head, .otlib-pop.is-right .otlib-pop-head, .otlib-pop.is-left .otlib-pop-head, .otlib-pop.is-top .otlib-pop-head { cursor: default; }
.otlib-pop-grip { color: #8f9bb0; font-size: 16px; }
.otlib-pop-title { flex: 1; min-width: 0; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.otlib-pop-tools { display: flex; gap: 2px; }
.otlib-pop-tools button { width: 30px; height: 30px; padding: 0 !important; border: 0 !important; border-radius: 6px !important; background: transparent !important; color: #c3ccdb !important; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.otlib-pop-tools button svg { width: 18px; height: 18px; fill: currentColor; }
.otlib-pop-tools button:hover, .otlib-pop-tools button[aria-pressed=true] { background: rgba(255,255,255,.14) !important; color: #fff !important; }
.otlib-pop.is-sheet .otlib-pop-tools { display: none; }
/* The close button: always visible, never only on hover. */
.otlib-pop-x { flex: 0 0 auto; width: 34px; height: 34px; padding: 0 !important; border: 2px solid rgba(255,255,255,.75) !important; border-radius: 50% !important; background: rgba(255,255,255,.12) !important; color: #fff !important; font-size: 22px !important; line-height: 1 !important; font-weight: 700; cursor: pointer; display: inline-flex !important; align-items: center; justify-content: center; opacity: 1 !important; visibility: visible !important; }
.otlib-pop-x:hover, .otlib-pop-x:focus-visible { background: var(--gold) !important; border-color: var(--gold) !important; color: var(--navy) !important; }
/* The commentators to choose from, right under the window's buttons. */
.otlib-pop-comms { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 5px; padding: 8px 10px; background: #f7f5ef; border-bottom: 1px solid var(--line); max-height: 92px; overflow-y: auto; }
.otlib-pop-comms[hidden] { display: none; }
.otlib-chip { border: 1px solid #cfd4dc !important; background: #fff !important; color: var(--ink) !important; border-radius: 14px !important; padding: 3px 11px !important; font-size: 14px !important; line-height: 1.4 !important; cursor: pointer; font-family: Assistant, sans-serif; }
.otlib-chip:hover { border-color: var(--gold) !important; }
.otlib-chip[aria-pressed=true] { background: var(--navy) !important; border-color: var(--navy) !important; color: #fff !important; font-weight: 700; }
.otlib-chip[aria-pressed=true]::before { content: "✓ "; color: var(--gold); }
.otlib-pop.is-bottom { left: 0; right: 0; bottom: 0; border-radius: 0; resize: vertical; max-height: 80vh; box-shadow: 0 -6px 24px rgba(0,0,0,.15); }
.otlib-pop.is-bottom .otlib-pop-head { cursor: default; }
body.otlib-docked-bottom .otlib-read { padding-bottom: calc(var(--otlib-dock, 300px) + 30px); }
.otlib-pop-body { flex: 1 1 auto; overflow: auto; padding: 10px 16px 16px; font-family: "Frank Ruhl Libre", serif; font-size: 18px; line-height: 1.7; }
/* A docked window makes room for itself beside or above the text. */
body.otlib-docked-right .otlib-read { margin-right: var(--otlib-dock, 420px); }
body.otlib-docked-left .otlib-read { margin-left: var(--otlib-dock, 420px); }
body.otlib-docked-top .otlib-read { padding-top: calc(var(--otlib-dock, 300px) + 20px); }
body.otlib-docked-right .otlib-toc { display: none; }
.otlib-pop-c h3 { font-family: Assistant, sans-serif; font-size: 16px; color: var(--navy); border-bottom: 2px solid var(--gold); display: inline-block; margin: 10px 0 4px; }
.otlib-pop-c p { margin: 0 0 6px; }
.otlib-pop-c p.is-match { background: #fff3c4; border-radius: 4px; }

/* Home: shelves */
.otlib-home, .otlib-results, .otlib-shelf-page { max-width: 1100px; margin: 0 auto; padding: 24px 18px 60px; }
.otlib-title { font: 400 38px/1.3 Assistant, sans-serif; color: #7a7a7a; text-align: center; margin: 10px 0 4px; }
.otlib-sub { text-align: center; color: var(--muted); margin: 0 0 20px; font-size: 17px; }
.otlib-search { display: flex; max-width: 720px; margin: 0 auto 12px; border: 2px solid var(--navy); border-radius: 30px; overflow: hidden; background: #fff; }
.otlib-search input { flex: 1; border: 0; padding: 12px 18px; font-size: 18px; min-width: 0; background: transparent; }
.otlib-search input:focus { outline: none; }
.otlib-search button { border: 0; background: var(--navy); color: #fff; width: 60px; cursor: pointer; }
.otlib-search svg { width: 22px; height: 22px; fill: currentColor; }
.otlib-scope { text-align: center; font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.otlib-scope span { display: inline-block; background: #f6eed3; color: #6b5409; border-radius: 12px; padding: 1px 10px; margin: 2px; }
.otlib-on-home .otlib-bar { display: none; }
/* Shelf tabs: one row of quiet pills. */
.otlib-shelf-tabs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 6px; }
.otlib-shelf-tabs button { border: 1px solid #cfd4dc !important; background: #fff !important; color: var(--ink) !important; border-radius: 22px !important; padding: 8px 20px !important; font-size: 17px; font-weight: 600; cursor: pointer; }
.otlib-shelf-tabs button:hover { border-color: var(--gold) !important; }
.otlib-shelf-tabs button[aria-selected=true] { background: var(--navy) !important; border-color: var(--navy) !important; color: #fff !important; }
.otlib-tools { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; justify-content: center; margin: 12px 0 26px; font-size: 15px; color: var(--muted); }
.otlib-sort { display: inline-flex; align-items: center; gap: 6px; }
.otlib-sort select { border: 1px solid #cfd4dc; border-radius: 8px; padding: 5px 8px; font-size: 15px; background: #fff; }
.otlib-filter { border: 1px solid #cfd4dc; border-radius: 22px; padding: 7px 16px; font-size: 15px; width: 260px; max-width: 100%; }
.otlib-tools .otlib-link { font-size: 15px; }
.otlib-tools .otlib-link.is-on { color: #8a6d0b !important; font-weight: 700; }
/* Books: an even grid of small cards. */
.otlib-shelf { margin-bottom: 30px; }
.otlib-shelf h2 { font-size: 20px; margin: 0 0 12px; border-bottom: 2px solid var(--gold); padding-bottom: 6px; display: flex; gap: 10px; align-items: baseline; }
.otlib-shelf h2 small { color: var(--muted); font-weight: 400; font-size: 13px; }
.otlib-group-author { font-size: 15px; font-weight: 400; color: #8a6d0b; }
.otlib-group-author::before { content: "· "; color: var(--muted); }
.otlib-books { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.otlib-books li { margin: 0; position: relative; }
.otlib-books li a { display: flex; flex-direction: column; justify-content: center; min-height: 54px; height: 100%; box-sizing: border-box; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; text-decoration: none; transition: border-color .15s, box-shadow .15s; }
.otlib-books li a:hover, .otlib-books li a:focus-visible { border-color: var(--gold); box-shadow: 0 3px 10px rgba(15,25,45,.08); }
.otlib-book-name { font-size: 16px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.otlib-book-author { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.3; }
.otlib-books.is-picking li a { padding-left: 34px; }
.otlib-books.is-picking input { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; z-index: 1; }

/* Results */
.otlib-count { color: var(--muted); font-size: 14px; }
.otlib-hit { border-bottom: 1px solid var(--line); padding: 14px 0; }
.otlib-hit h3 { margin: 0; font-size: 19px; }
.otlib-hit-meta { margin: 2px 0 6px; color: var(--muted); font-size: 14px; }
.otlib-hit-text { margin: 0; font-family: "Frank Ruhl Libre", serif; font-size: 19px; line-height: 1.7; }
.otlib-hit-text b { background: #fff3c4; }

/* Personal shelf */
.otlib-login { max-width: 460px; margin: 20px auto; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.otlib-login input { padding: 10px 14px; border: 1px solid #cfd4dc; border-radius: 22px; font-size: 16px; }
.otlib-small { color: var(--muted); font-size: 14px; }
.otlib-my { margin: 20px 0; }
.otlib-my h2 { font-size: 20px; border-bottom: 2px solid var(--gold); padding-bottom: 4px; }
.otlib-my-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid #f1f2f4; }
.otlib-my-tools button { border: 1px solid #cfd4dc; background: #fff; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; }

/* Phones and tablets */
@media (max-width: 1024px) {
	.otlib-has-side .otlib-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
	.otlib-has-side .otlib-side { border-right: 3px solid #f0e6c4; padding-right: 10px; }
	.otlib-c:not([open]) { margin-bottom: 4px; }
}
.otlib-toc-x { display: none; }
@media (max-width: 900px) {
	/* The chapter list opens as a drawer above everything (also above the site's header), with a dimmed page behind it. */
	.otlib-toc { position: fixed; top: 0; right: 0; bottom: 0; height: 100%; width: min(320px, 86vw); max-height: none; z-index: 100001; box-shadow: 0 0 0 100vmax rgba(0,0,0,.4); padding-top: 8px; }
	body.admin-bar .otlib-toc { top: 0; }
	.otlib-toc-head { position: sticky; top: -8px; background: #fbfbfc; z-index: 1; padding-top: 8px; }
	.otlib-toc-x { display: inline-flex; align-self: flex-start; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0 !important; border: 1px solid #cfd4dc !important; border-radius: 50% !important; background: #fff !important; color: var(--ink) !important; font-size: 22px !important; line-height: 1 !important; cursor: pointer; margin-bottom: 4px; }
	body.otlib-docked-right .otlib-read, body.otlib-docked-left .otlib-read { margin: 0; }
	.otlib-read { padding: 14px 14px 50px; }
	.otlib-bar-title small, .otlib-home-link, .otlib-bar-title > span[aria-hidden] { display: none; }
}
@media (max-width: 600px) {
	.otlib-title { font-size: 30px; }
	.otlib-shelf-tabs { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; padding-bottom: 4px; scrollbar-width: none; }
	.otlib-shelf-tabs button { flex: 0 0 auto; font-size: 15px; padding: 7px 14px !important; }
	.otlib-books { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
	.otlib-filter { width: 100%; }
	.otlib-bar { padding: 4px 6px; gap: 0; }
	.otlib-bar-title strong { font-size: 16px; }
}
@media print { .otlib-bar, .otlib-toc, .otlib-panel, .otlib-foot-pager, .otlib-speech { display: none !important; } }
