/* גופן הממשק: Yiddishkeit AlefAlefAlef (אאא - בית לטיפוגרפיה עברית), רישיון חינמי: הטמעה באתר עד מיליון צפיות בחודש, חובת קרדיט, אסור להפיץ את קובץ הפונט (לכן הקובץ לא נשמר במאגר ציבורי) */
@font-face {
  font-family: 'Yiddishkeit AlefAlefAlef';
  src: url('/fonts/YiddishkeitAlefAlefAlef-Bold.woff') format('woff');
  font-weight: 100 900; font-style: normal; font-display: swap; size-adjust: 128%;
}

/* גופן התכנים: Drugulin CLM, פרויקט Culmus, רישיון GNU GPL עם חריג גופנים (מותר להטמיע ולהפיץ, ראו Drugulin-CLM-GNU-GPL.txt).
   קיים רק במשקל מודגש, ולכן מוצהר לכל המשקלים כדי שהדפדפן לא יוסיף הדגשה מלאכותית. */
@font-face { font-family: 'Drugulin CLM'; src: url('/fonts/drugulinclm-bold-webfont.woff') format('woff'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Drugulin CLM'; src: url('/fonts/drugulinclm-bolditalic-webfont.woff') format('woff'); font-weight: 100 900; font-style: italic; font-display: swap; }

/* גאוני ישראל - עיצוב
   כיוון: עמוד שער של ספר. נייר אבן ירושלמית קרירה, דיו כחול כהה, אדום כתבי יד לדגשים בלבד.
   מסגרות כפולות, קווים דקים, פינות ישרות, בלי צללים וקפיצות. */
:root {
  --paper: #ecebe6;
  --sheet: #f7f6f2;
  --wash: #e2e0d8;
  --ink: #1b1d24;
  --ink-soft: #454857;
  --muted: #737684;
  --rule: #c3c0b5;
  --navy: #1c2740;
  --navy-2: #2e4373;
  --stone: #d9d5c8;
  --rubric: #8a2b2b;
  --mark: rgba(46, 67, 115, .15);
  --mark-active: rgba(46, 67, 115, .32);
  --shadow: 0 10px 30px rgba(20, 30, 55, .2);
  --ease: cubic-bezier(.22, .8, .24, 1);
  --hero-image: url('/hero.jpg');
  --content-font: 'Drugulin CLM', 'Frank Ruhl Libre', 'David', serif;
  --ui-font: 'Yiddishkeit AlefAlefAlef', 'Alef', 'Heebo', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--ui-font); font-size: 15px; line-height: 1.6;
}
a { color: var(--navy-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--ui-font); line-height: 1.25; color: var(--navy); }
.work-body :is(h1, h2, h3), .editor :is(h1, h2, h3) { font-family: inherit; }
:focus-visible { outline: 2px solid var(--navy-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ספר מונפש: רצועה של 9 פריימים (כל פריים 512 יחידות) שמוזזת בצעדים. פריים 1 הוא מצב המנוחה. */
.bk { overflow: hidden !important; }
@keyframes bookFlipOnce { to { transform: translateX(-4608px); } }
@keyframes bookFlipHover { to { transform: translateX(-4608px); } }
@keyframes bookFlipLoop { to { transform: translateX(-4608px); } }
.book-once .book-sheet { animation: bookFlipOnce 1.44s steps(9) 1 .1s backwards paused; } /* בכניסה, כשמסך הטעינה נעלם */
body.ready .book-once .book-sheet { animation-play-state: running; }
.brand:hover .book-sheet, .hero-logo:hover .book-sheet { animation: bookFlipHover 1.44s steps(9) 1; } /* ריחוף */
.book-loop .book-sheet { animation: bookFlipLoop 1.44s steps(9) infinite; } /* טעינה */

/* מסך טעינה ראשוני */
#splash {
  position: fixed; inset: 0; z-index: 200; display: grid; place-content: center; justify-items: center; gap: 22px;
  background: var(--navy); color: var(--stone); transition: opacity .6s ease .05s, visibility .6s ease .05s;
  animation: splashFailsafe .01s 10s forwards; /* אם הסקריפט נכשל, המסך נעלם בכל זאת */
}
#splash.done { opacity: 0; visibility: hidden; pointer-events: none; }
#splash > svg { width: min(280px, 64vw); height: auto; overflow: visible; filter: drop-shadow(0 12px 22px rgba(0, 0, 0, .45)); }
.splash-name { font-family: var(--ui-font); font-size: 1.7rem; color: #f4f2ec; }
html.seen #splash { display: none; }
@keyframes splashFailsafe { to { opacity: 0; visibility: hidden; pointer-events: none; } }
/* טעינה איטית בין דפים */
.loading-veil { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; background: rgba(236, 235, 230, .84); color: var(--navy); }
.loading-veil > svg { width: 170px; height: auto; overflow: visible; filter: drop-shadow(0 8px 14px rgba(20, 30, 55, .35)); }

/* פסי גלילה בעיצוב האתר */
.note-card, .drawer-body, .np-list, .pop, .modal .box { scrollbar-width: thin; scrollbar-color: #a7acbd transparent; }
.note-card::-webkit-scrollbar, .drawer-body::-webkit-scrollbar, .np-list::-webkit-scrollbar, .pop::-webkit-scrollbar { width: 9px; }
.note-card::-webkit-scrollbar-track, .drawer-body::-webkit-scrollbar-track, .np-list::-webkit-scrollbar-track, .pop::-webkit-scrollbar-track { background: transparent; }
.note-card::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb, .np-list::-webkit-scrollbar-thumb, .pop::-webkit-scrollbar-thumb {
  background: #a7acbd; border: 3px solid transparent; background-clip: padding-box; border-radius: 6px;
}
.note-card::-webkit-scrollbar-thumb:hover, .drawer-body::-webkit-scrollbar-thumb:hover { background: var(--navy-2); background-clip: padding-box; }

/* סרגל עליון */
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 18px;
  padding: 8px clamp(14px, 4vw, 40px); background: var(--navy); color: #eceae3;
  border-bottom: 4px double rgba(236, 234, 227, .35);
}
.brand { display: flex; align-items: center; line-height: 0; }
.brand:hover { text-decoration: none; }
.logo-sm { height: 46px; width: auto; display: block; }
.logo-lg { width: min(400px, 80vw); height: auto; display: block; margin: 0 auto; filter: drop-shadow(0 6px 12px rgba(0, 0, 0, .4)); }
.hero-logo { margin: 0 0 8px; }
.topbar nav { display: flex; gap: 20px; margin-inline-start: 14px; flex: 1; }
.topbar nav a { color: #b9bfd1; font-size: .95rem; padding: 4px 0; border-bottom: 1px solid transparent; }
.topbar nav a:hover { color: #fff; border-bottom-color: #b9bfd1; text-decoration: none; }
.topbar .spacer { flex: 1; }
.bell { position: relative; background: none; border: 0; color: #eceae3; padding: 6px 8px; display: grid; place-items: center; }
.bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.bell:hover { color: #fff; }
.bell .badge {
  position: absolute; top: 0; inset-inline-start: -2px; background: var(--rubric); color: #fff;
  font-size: .68rem; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px;
}

/* כפתורים */
.btn {
  display: inline-block; text-decoration: none; background: var(--navy); color: #f4f2ec; border: 1px solid var(--navy);
  border-radius: 2px; padding: 7px 18px; font-family: var(--ui-font); transition: background .15s, color .15s, border-color .15s;
}
.btn:hover { background: var(--navy-2); border-color: var(--navy-2); text-decoration: none; }
.btn.ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn.ghost:hover { background: var(--navy); color: #f4f2ec; }
.btn.danger { background: var(--rubric); border-color: var(--rubric); }
.btn.danger:hover { background: #6f2020; border-color: #6f2020; }
.topbar .btn.ghost { color: #eceae3; border-color: rgba(236, 234, 227, .5); }
.topbar .btn.ghost:hover { background: #eceae3; color: var(--navy); }
.btn.small { padding: 3px 13px; font-size: .88rem; }
.icon-btn { background: none; border: 0; font-size: 1.1rem; color: var(--muted); padding: 4px 8px; }
.icon-btn:hover { color: var(--ink); }
.linkish { background: none; border: 0; color: var(--navy-2); padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: .88rem; font-family: var(--ui-font); }
.linkish.danger { color: var(--rubric); }

/* כללי */
.page { max-width: 1040px; margin: 0 auto; padding: 34px clamp(14px, 4vw, 32px) 90px; }
.page.reading { max-width: 880px; }
.muted { color: var(--muted); font-size: .9rem; }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  color: #f4f2ec; font-weight: 700; font-size: .85rem; flex: none; font-family: var(--ui-font);
}
.avatar.lg { width: 44px; height: 44px; font-size: 1.2rem; }
.who { display: flex; align-items: center; gap: 8px; }
.who .meta { font-size: .8rem; color: var(--muted); line-height: 1.3; }
.who .name { font-weight: 700; color: var(--ink); font-size: .92rem; }
.edited { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.empty { text-align: center; padding: 60px 0; color: var(--muted); }

/* שער: דף ראשי */
.hero {
  position: relative; padding: 92px clamp(14px, 4vw, 40px) 84px; text-align: center; color: #f4f2ec;
  background:
    linear-gradient(rgba(18, 27, 48, .5), rgba(18, 27, 48, .74)),
    var(--hero-image) center / cover,
    var(--navy);
}
.hero::before { content: ''; position: absolute; inset: 14px; border: 1px solid rgba(244, 242, 236, .55); pointer-events: none; }
.hero::after { content: ''; position: absolute; inset: 20px; border: 1px solid rgba(244, 242, 236, .22); pointer-events: none; }
.hero p {
  margin: 0 auto; max-width: 34rem; color: var(--stone); font-family: var(--ui-font); font-size: 1.3rem; line-height: 1.5;
  text-shadow: 0 1px 10px rgba(0, 0, 0, .65);
}

/* תוכן עניינים: רשימת המערכות */
.toc { max-width: 780px; margin: 0 auto; border-top: 1px solid var(--rule); }
.toc-row { display: block; padding: 20px 4px 18px; border-bottom: 1px solid var(--rule); color: inherit; }
.toc-row:hover { text-decoration: none; }
.toc-line { display: flex; align-items: baseline; gap: 12px; }
.toc-title { font-family: var(--content-font); font-size: 1.3rem; font-weight: 700; color: var(--navy); line-height: 1.25; }
.toc-leader { flex: 1; min-width: 24px; border-bottom: 2px dotted var(--rule); transform: translateY(-5px); }
.toc-author { font-size: .95rem; color: var(--ink-soft); white-space: nowrap; }
.toc-desc {
  margin: 6px 0 4px; font-family: var(--content-font); font-size: .98rem; line-height: 1.4; word-spacing: -.04em; color: var(--ink-soft); text-align: justify;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.toc-date { font-size: .8rem; color: var(--muted); }
.toc-row:hover .toc-title { color: var(--rubric); }
.toc-row:hover .toc-leader { border-bottom-style: solid; border-bottom-width: 1px; border-color: var(--rubric); }

.toc-actions { max-width: 780px; margin: 0 auto 20px; display: flex; justify-content: flex-start; }

/* מערכה */
.work-head { text-align: center; }
.work-head h1 { font-family: var(--content-font); font-size: clamp(1.6rem, 3.6vw, 2.3rem); line-height: 1.2; margin: 6px 0 12px; }
.work-head .who { justify-content: center; }
.orn { display: flex; align-items: center; gap: 12px; margin: 18px auto; max-width: 280px; }
.orn::before, .orn::after { content: ''; flex: 1; border-top: 1px solid var(--rule); }
.orn i { width: 7px; height: 7px; background: var(--rubric); transform: rotate(45deg); }
.work-head .desc {
  max-width: 40rem; margin: 0 auto 12px; font-family: var(--content-font); font-size: 1.02rem; line-height: 1.4; word-spacing: -.04em; color: var(--ink-soft);
  text-align: justify; text-align-last: center;
}
.work-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin: 14px 0 26px; }
.work-body {
  font-family: var(--content-font); font-size: 1.06rem; line-height: 1.45; word-spacing: -.04em; background: var(--sheet);
  border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: 5px; padding: clamp(16px, 4vw, 38px); text-align: justify; text-justify: inter-word;
  margin: 0 5px;
}
.work-body h2, .work-body h3 { text-align: start; }
.work-body p { margin: 0 0 .45em; }
.work-body :is(h2, h3) { margin: .7em 0 .3em; line-height: 1.25; }
.work-body blockquote { margin: .5em 0; padding: 2px 18px; border-inline-start: 3px solid var(--navy-2); color: var(--ink-soft); }
mark.hl {
  background: var(--mark); color: inherit; border-bottom: 1.5px solid var(--navy-2); cursor: pointer; padding: 0 1px;
  transition: background .2s;
}
mark.hl:hover, mark.hl.flash { background: var(--mark-active); }
.sel-btn {
  position: fixed; z-index: 40; display: none; background: var(--navy); color: #f4f2ec; border: 1px solid #f4f2ec;
  border-radius: 2px; padding: 6px 16px; font-size: .9rem; box-shadow: var(--shadow); font-family: var(--ui-font);
}
.sel-btn.show { display: block; }

/* הערות */
.tray-title { margin: 46px 0 16px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.tray-title h2 { flex: 1; display: flex; align-items: center; gap: 16px; font-size: 1.4rem; }
.tray-title h2::after { content: ''; flex: 1; border-top: 1px solid var(--rule); }
.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 18px; }
.note-card {
  background: var(--sheet); border: 1px solid var(--rule); border-inline-start: 3px solid var(--navy-2); padding: 2px 16px;
  cursor: pointer; height: 240px; overflow-y: auto; overscroll-behavior: contain; transition: border-color .15s, background .15s;
}
.note-card:hover, .note-card:focus-visible { border-color: var(--navy-2); background: #fff; }
.note-card .post { border: 0; background: none; padding: 8px 0; margin: 0; }
.note-card .post + .post, .note-card .replies-count + .post { border-top: 1px solid var(--rule); }
.quote {
  font-family: var(--content-font); font-size: .88rem; line-height: 1.35; color: var(--muted); border-inline-start: 2px solid var(--navy-2);
  padding-inline-start: 9px; margin: 8px 0;
}
.text { font-family: var(--content-font); white-space: pre-wrap; text-align: justify; font-size: .98rem; line-height: 1.4; word-spacing: -.04em; margin-top: 4px; }
.replies-count { font-size: .8rem; color: var(--navy-2); padding: 5px 0; border-top: 1px solid var(--rule); }

/* חלון מרחף */
.pop {
  position: fixed; z-index: 50; width: min(340px, 90vw); max-height: 260px; overflow-y: auto; background: var(--sheet);
  border: 1px solid var(--navy); border-top: 3px solid var(--navy); box-shadow: var(--shadow); padding: 12px 14px;
  opacity: 0; pointer-events: none; transition: opacity .15s;
}
.pop.show { opacity: 1; pointer-events: auto; }
.pop .item + .item { border-top: 1px solid var(--rule); margin-top: 10px; padding-top: 10px; }
.pop .text { cursor: pointer; }

/* סרגל צד */
.drawer {
  position: fixed; z-index: 60; top: 0; bottom: 0; inset-inline-end: auto; left: 0; width: var(--drawer-w, 420px);
  background: var(--paper); border-right: 1px solid var(--navy); box-shadow: var(--shadow); display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .3s var(--ease); visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-grip { position: absolute; top: 0; bottom: 0; right: -5px; width: 10px; cursor: ew-resize; z-index: 2; }
.drawer-grip:hover { background: rgba(46, 67, 115, .3); }
.drawer-head { display: flex; justify-content: flex-start; padding: 8px 10px; border-bottom: 1px solid var(--rule); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
.post { background: var(--sheet); border: 1px solid var(--rule); padding: 9px 12px; margin-top: 9px; }
.thread-note.post { margin-top: 0; }
.row-actions { display: flex; gap: 14px; margin-top: 6px; align-items: center; }
.inline-edit { margin: 8px 0 2px; min-height: 90px; font-family: var(--content-font); font-size: .98rem; line-height: 1.4; }

/* טפסים */
.form { display: grid; gap: 14px; max-width: 720px; }
label { font-weight: 700; display: grid; gap: 4px; }
input[type=text], input[type=email], textarea {
  font: inherit; padding: 9px 12px; border: 1px solid var(--rule); border-radius: 2px; background: var(--sheet); color: var(--ink); width: 100%;
}
input:focus, textarea:focus, .editor:focus { outline: 2px solid var(--navy-2); outline-offset: 1px; }
textarea { min-height: 110px; resize: vertical; }
.toolbar { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.toolbar button { background: var(--sheet); border: 1px solid var(--rule); border-radius: 2px; padding: 3px 11px; color: var(--navy); }
.toolbar button:hover { background: var(--navy); color: #f4f2ec; border-color: var(--navy); }
.editor {
  min-height: 320px; padding: 16px 18px; border: 1px solid var(--rule); background: var(--sheet);
  font-family: var(--content-font); font-size: 1.06rem; line-height: 1.4; word-spacing: -.04em; text-align: justify; text-justify: inter-word;
}
.editor p, .editor div { margin: 0 0 .3em; }
.editor mark.hl { cursor: text; }
.error { color: var(--rubric); font-size: .9rem; min-height: 1.2em; }

/* רשימות */
.list { display: grid; border-top: 1px solid var(--rule); }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--rule); padding: 12px 6px; }
.list-item.unread { background: rgba(46, 67, 115, .08); box-shadow: inset 3px 0 0 var(--navy-2); }
.tabs { display: flex; gap: 22px; margin-bottom: 18px; border-bottom: 1px solid var(--rule); }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 6px 2px; margin-bottom: -1px; color: var(--ink-soft); }
.tabs button.active { color: var(--navy); border-bottom-color: var(--navy); font-weight: 700; }

/* חלון קופץ והודעות */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(18, 27, 48, .6); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal .box { background: var(--paper); border: 1px solid var(--navy); outline: 1px solid var(--rule); outline-offset: -7px; padding: 28px; width: min(460px, 100%); max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
.toast {
  position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translate(50%, 12px); background: var(--navy); color: #f4f2ec;
  padding: 10px 22px; border-radius: 2px; opacity: 0; pointer-events: none; transition: .2s var(--ease); z-index: 90;
}
.toast.show { opacity: 1; transform: translate(50%, 0); }

/* התראות */
.notif-pop {
  position: fixed; z-index: 70; top: 62px; left: clamp(8px, 4vw, 40px); width: min(390px, calc(100vw - 16px)); max-height: min(70vh, 520px);
  display: flex; flex-direction: column; background: var(--sheet); border: 1px solid var(--navy); border-top: 3px solid var(--navy); box-shadow: var(--shadow);
}
.np-head, .np-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; background: var(--wash); }
.np-head b { font-family: var(--ui-font); font-size: 1.1rem; color: var(--navy); }
.np-foot { justify-content: center; border-top: 1px solid var(--rule); font-size: .9rem; }
.np-list { overflow-y: auto; flex: 1; }
.np-item { display: grid; gap: 2px; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--rule); font-size: .92rem; }
.np-item:hover { background: var(--wash); text-decoration: none; }
.np-item.unread { background: rgba(46, 67, 115, .08); box-shadow: inset 3px 0 0 var(--navy-2); }
.notif-row { display: flex; gap: 10px; align-items: flex-start; }
.notif-main { min-width: 0; overflow-wrap: anywhere; }
.notif-user { font-weight: 700; color: var(--ink); }
.qt { font-weight: 700; color: var(--navy-2); }

.site-credit { text-align: center; font-size: .78rem; color: var(--muted); padding: 0 14px 28px; }
.site-credit a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 700px) {
  .topbar nav { display: none; }
  .notif-pop { top: 58px; left: 8px; }
  .drawer { width: 100% !important; top: auto; height: 82vh; border-right: 0; border-top: 1px solid var(--navy); transform: translateY(102%); }
  .drawer.open { transform: none; }
  .drawer-grip { display: none; }
  .work-body { font-size: 1.1rem; }
  .toc-title { font-size: 1.3rem; }
  .hero { padding: 64px 14px 58px; }
}
@media (prefers-reduced-motion: reduce) {
  .book-sheet { animation: none !important; transform: none !important; }
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* חיווי צפייה בזמן אמת (וובסוקט): מי צופה כעת במערכה ובדיון הפתוח */
.presence { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .88rem; line-height: 1.4; }
.presence[hidden] { display: none; }
.work-head .presence { justify-content: center; margin: -12px 0 22px; }
#note-presence { margin: 0 0 12px; padding: 6px 10px; background: var(--wash); border-inline-start: 3px solid #2f7d4f; }
.pdot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: #2f7d4f; animation: pdotPulse 2.2s ease-in-out infinite; }
@keyframes pdotPulse { 50% { opacity: .35; } }


/* חיווי כתיבה חי בדיון + מונה מחוברים במסך הבית */
.typing-indicator { display: flex; align-items: center; gap: 9px; min-height: 26px; margin-top: 12px; color: var(--ink-soft); font-size: .84rem; }
.typing-indicator[hidden] { display: none; }
.typing-dots { display: inline-flex; align-items: center; gap: 3px; direction: ltr; }
.typing-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--navy-2); animation: typingBounce .9s ease-in-out infinite; }
.typing-dots i:nth-child(2) { animation-delay: .14s; }
.typing-dots i:nth-child(3) { animation-delay: .28s; }
@keyframes typingBounce { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }
.site-presence { display: flex; justify-content: center; align-items: center; gap: 8px; margin: 0 0 28px; color: var(--muted); font-size: .82rem; }
.site-presence .pdot { width: 7px; height: 7px; }
@media (prefers-reduced-motion: reduce) { .typing-dots i { animation: none; opacity: .8; } }


/* היררכיה טיפוגרפית: התוכן מוביל, פרטי המערכת משניים */
.who { gap: 7px; }
.who .avatar { width: 23px; height: 23px; font-size: .72rem; }
.who .name { font-size: .79rem; line-height: 1.25; font-weight: 650; color: var(--ink-soft); }
.who .meta { font-size: .68rem; line-height: 1.25; color: var(--muted); letter-spacing: .01em; }
.edited { font-size: .66rem; line-height: 1.25; color: var(--muted); opacity: .82; margin-top: 3px; }
.row-actions { gap: 11px; margin-top: 8px; }
.row-actions .linkish { font-size: .7rem; line-height: 1.3; color: var(--muted); text-decoration: none; opacity: .82; }
.row-actions .linkish:hover, .row-actions .linkish:focus-visible { color: var(--navy-2); text-decoration: underline; opacity: 1; }
.row-actions .linkish.danger { color: #947c7c; }
.thread-note.post .text, .reply.post .text { font-size: 1rem; line-height: 1.65; margin-top: 9px; }
.reply.post { padding: 11px 0; border: 0; border-bottom: 1px solid var(--rule); background: transparent; }
#thread .thread-note.post { padding: 12px 0 14px; border: 0; border-bottom: 1px solid var(--rule); background: transparent; }
#replies h3 { font-size: .88rem; font-weight: 650; color: var(--ink-soft); margin: 18px 0 4px !important; }
.typing-indicator { font-size: .76rem; color: var(--muted); margin-top: 10px; }
@media (prefers-reduced-motion: reduce) {
  .typing-dots i { animation: typingReducedPulse 1.25s ease-in-out infinite !important; }
  .typing-dots i:nth-child(2) { animation-delay: .2s; }
  .typing-dots i:nth-child(3) { animation-delay: .4s; }
}
@keyframes typingReducedPulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }


/* מערכת טיפוגרפית אחידה — התוכן ראשון, הממשק מלווה */
:root {
  --type-content: 1.06rem;
  --type-meta: .72rem;
  --type-action: .76rem;
  --type-label: .82rem;
}
body { font-size: 15px; line-height: 1.68; }
p { line-height: 1.72; }
.page { line-height: 1.68; }

/* כותרות ותוכן מרכזי: מעט יותר נוכחות, בלי להכביד */
h1, h2, h3 { letter-spacing: -.012em; }
.work-head h1 { font-size: clamp(1.72rem, 3.8vw, 2.48rem); line-height: 1.18; }
.work-head .desc { font-size: 1.08rem; line-height: 1.62; }
.work-body { font-size: 1.16rem; line-height: 1.82; }
.work-body p, .editor p { line-height: 1.82; }
.work-body :is(h2, h3) { margin-block: 1.5em .55em; }
.toc-title { font-size: 1.38rem; line-height: 1.3; }
.toc-desc { font-size: 1.04rem; line-height: 1.58; }
.text { font-size: 1.04rem; line-height: 1.72; }

/* פרטי זיהוי, תאריכים ונתוני מערכת */
.who { gap: 8px; }
.who .avatar { width: 21px; height: 21px; font-size: .68rem; }
.who .name { font-size: .74rem; line-height: 1.28; font-weight: 600; color: var(--ink-soft); }
.who .meta { font-size: .64rem; line-height: 1.25; color: #858894; font-weight: 400; }
.edited, .toc-date, .toc-author { font-size: .68rem; line-height: 1.3; color: var(--muted); font-weight: 400; }
.toc-author { white-space: nowrap; }
.quote { font-size: .82rem; line-height: 1.48; color: #777b87; }
.replies-count { font-size: .7rem; color: var(--muted); font-weight: 500; }
.presence, .site-presence { font-size: .74rem; line-height: 1.35; color: var(--muted); }
.site-credit { font-size: .68rem; }

/* פעולות: ברורות ונגישות, אך לא מתחרות בתוכן */
.btn { font-size: .84rem; padding: 7px 16px; }
.btn.small { font-size: .74rem; padding: 5px 11px; }
.icon-btn { opacity: .78; }
.linkish, .row-actions .linkish { font-size: .68rem; line-height: 1.35; font-weight: 500; color: #858894; }
.row-actions { gap: 12px; margin-top: 7px; }
.row-actions .linkish.danger { color: #9b8585; }
.work-actions { gap: 8px; }
.tabs { gap: 18px; }
.tabs button { font-size: .82rem; color: var(--muted); }
.tabs button.active { color: var(--navy); }
.toolbar button { font-size: .74rem; }
label { font-size: .84rem; font-weight: 600; }
input[type=text], input[type=email], textarea { font-size: .96rem; line-height: 1.55; }
.form .muted, .muted { color: var(--muted); font-size: .82rem; }

/* כרטיסי תוכן ודיון */
.note-card { padding: 5px 17px; }
.note-card .post { padding: 10px 0; }
.note-card .text, .thread-note.post .text, .reply.post .text { font-size: 1.04rem; line-height: 1.72; }
.thread-note.post, .reply.post { padding: 14px 0 16px; }
.drawer-body { padding: 18px 20px 42px; }
.drawer-head { padding: 7px 10px; }
#replies h3, .tray-title h2 { font-size: 1.02rem; font-weight: 650; }
.tray-title { margin: 42px 0 18px; }
.toc-row { padding-block: 22px 20px; }
.toc-line { gap: 13px; }
.toc-leader { border-bottom-width: 1px; }

/* הודעות, רשימות ומסכי מערכת */
.np-head, .np-foot { font-size: .76rem; color: var(--muted); }
.np-item, .list-item { font-size: .88rem; line-height: 1.5; }
.notif-user { font-size: .78rem; font-weight: 600; }
.notif-main { font-size: .84rem; line-height: 1.55; }
.notif-row { gap: 9px; }
.pop .item, .pop .text { font-size: .82rem; line-height: 1.5; }
.modal h2 { font-size: 1.2rem; }
.error { font-size: .78rem; }

/* שלוש נקודות — תנועה ברורה ומדורגת */
.typing-indicator { font-size: .76rem; color: var(--muted); gap: 10px; }
.typing-dots { min-width: 27px; justify-content: space-between; }
.typing-dots i {
  display: block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--navy-2); opacity: .35;
  animation: typingBounce 850ms ease-in-out infinite !important;
  will-change: transform, opacity;
}
.typing-dots i:nth-child(2) { animation-delay: 150ms !important; }
.typing-dots i:nth-child(3) { animation-delay: 300ms !important; }
@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0) scale(.88); opacity: .32; }
  30% { transform: translateY(-5px) scale(1.12); opacity: 1; }
}
@media (max-width: 700px) {
  .work-body { font-size: 1.12rem; line-height: 1.78; }
  .toc-title { font-size: 1.28rem; }
  .toc-desc { font-size: 1rem; }
  .who .name { font-size: .72rem; }
  .who .meta, .edited, .toc-date { font-size: .63rem; }
  .drawer-body { padding: 15px 16px 36px; }
}


/* תצוגת מערכה: כותרת ותיאור בכרטיס פתיחה אחד */
.work-summary-card { background: var(--sheet); border: 1px solid var(--rule); outline: 1px solid var(--rule); outline-offset: 4px; padding: clamp(18px, 3vw, 30px); margin: 0 5px 30px; }
.work-summary-card .work-head { text-align: start; }
.work-summary-card .work-head h1 { margin: 0 0 10px; text-align: center; }
.work-summary-card .work-head .desc { max-width: 48rem; font-size: 1.12rem; line-height: 1.62; margin: 0 auto 16px; text-align: center; text-align-last: center; }
.work-meta { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .72rem; }
.work-meta .who { gap: 6px; }
.work-meta .who .avatar { width: 19px; height: 19px; font-size: .64rem; }
.work-meta .who .name { font-size: .72rem; font-weight: 500; color: var(--muted); }
.work-meta .who .meta { font-size: .66rem; color: #858894; }
.work-meta .muted { font-size: .67rem; }
.work-summary-card .orn { margin: 14px auto; }
.work-summary-card .work-actions { margin: 8px 0 0; justify-content: center; }
.work-summary-card .work-actions .btn { font-size: .72rem; padding: 4px 10px; opacity: .82; }
.work-summary-card .presence { margin-top: 10px; }

/* עריכת מערכה: עמודת שדות בצד ימין, אזור כתיבה רחב ומשטח גלילה נפרד */
.edit-page { max-width: 1440px; }
.edit-layout { display: grid; grid-template-columns: minmax(250px, 310px) minmax(0, 1fr); gap: 24px; align-items: start; max-width: 1360px; }
.edit-sidebar { position: sticky; top: 82px; max-height: calc(100vh - 106px); overflow-y: auto; overscroll-behavior: contain; display: grid; gap: 15px; padding: 18px; background: var(--sheet); border: 1px solid var(--rule); scrollbar-width: thin; scrollbar-color: #a7acbd transparent; }
.edit-sidebar label { font-size: .82rem; gap: 6px; }
.edit-sidebar input, .edit-sidebar textarea { font-size: .92rem; }
.edit-help { color: var(--muted); font-size: .73rem; line-height: 1.5; }
.edit-main { min-width: 0; }
.edit-section-label { color: var(--muted); font-size: .78rem; margin: 0 0 8px; }
.edit-main .toolbar { position: sticky; top: 70px; z-index: 5; padding: 6px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.edit-main .editor { min-height: 68vh; font-size: 1.12rem; line-height: 1.7; padding: 22px 26px; }
.edit-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--rule); }
.edit-actions .btn { font-size: .78rem; padding: 6px 12px; }
.edit-sidebar #links .list-item { align-items: start; font-size: .76rem; }
.edit-sidebar #links .quote { font-size: .72rem; }
.site-credit { max-width: 900px; margin: 32px auto 12px; padding: 6px 14px; text-align: center; font-size: .58rem !important; line-height: 1.35; color: #92939a !important; opacity: .52; }
.site-credit a { color: inherit; text-decoration: underline; text-decoration-color: rgba(115,118,132,.3); }
@media (max-width: 850px) {
  .edit-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .edit-sidebar { position: static; max-height: 34vh; order: 0; }
  .edit-main { order: 1; }
  .edit-main .toolbar { top: 60px; }
  .work-summary-card { padding: 16px; }
  .work-summary-card .work-head .desc { font-size: 1.02rem; }
}


/* שלושת סיווגי התוכן */
.category-dashboard { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; align-items:stretch; margin-top:20px; }
.category-panel { min-width:0; display:flex; flex-direction:column; background:var(--sheet); border:1px solid var(--rule); }
.category-panel>header,.category-panel>footer { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:12px 15px; }
.category-panel>header { border-bottom:1px solid var(--rule); font-family:var(--ui-font); font-weight:700; color:var(--navy); font-size:1.1rem; }
.category-panel>header a { color:inherit; }
.category-panel>header span { font-size:.7rem; color:var(--muted); font-weight:400; }
.category-scroll { height:390px; overflow-y:auto; overscroll-behavior:contain; padding:0 13px; scrollbar-width:thin; }
.category-scroll .toc { border-top:0; }
.category-scroll .toc-row { padding:14px 2px 12px; }
.category-scroll .toc-title { font-size:1.02rem; }
.category-scroll .toc-author { font-size:.72rem; }
.category-scroll .toc-desc { font-size:.82rem; }
.category-scroll .empty { padding:48px 6px; font-size:.82rem; }
.category-panel>footer { border-top:1px solid var(--rule); font-size:.76rem; }
.category-panel>footer a { color:var(--muted); }
.category-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:22px; }
.category-heading h1 { margin:0; }
.category-page .toc { max-width:none; }
.category-page .toc-row { padding-inline:10px; }

/* דיונים: שיחה רציפה ותגובות מקוננות */
.discussion-page { max-width:900px; }
.discussion-head { padding:10px 0 22px; border-bottom:1px solid var(--rule); }
.discussion-head h1 { font-family:var(--content-font); font-size:clamp(1.65rem,4vw,2.35rem); line-height:1.25; margin:6px 0 12px; }
.discussion-head .eyebrow { color:var(--muted); font-size:.72rem; letter-spacing:.06em; }
.discussion-root { padding:22px 0 26px; border-bottom:1px solid var(--rule); }
.discussion-root .text { font-size:1.12rem; line-height:1.75; }
.discussion-root-meta { margin-top:12px; color:var(--muted); font-size:.7rem; }
.discussion-stream { padding-top:20px; }
.discussion-stream-head { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:12px; }
.discussion-stream-head h2 { margin:0; font-size:1.1rem; }
.discussion-reply { position:relative; margin:0; padding:15px 0 15px calc(min(var(--reply-depth),5) * 17px); border-bottom:1px solid var(--rule); min-width:0; }
.discussion-reply::before { content:""; position:absolute; inset-inline-start:calc(min(var(--reply-depth),5) * 17px - 8px); top:0; bottom:0; width:1px; background:var(--rule); }
.discussion-reply .text { margin-top:7px; line-height:1.7; overflow-wrap:anywhere; }
.discussion-reply .who .name { font-size:.76rem; }
.reply-quote { margin:0 0 8px; padding:5px 10px; border-inline-start:2px solid var(--rule); color:var(--muted); background:var(--wash); font-size:.75rem; line-height:1.45; }
.reply-quote span { opacity:.75; margin-inline-end:4px; }
.discussion-reply .row-actions { margin-top:5px; }
.discussion-reply .reply-compose-slot:empty { display:none; }
.nested-reply-form,.discussion-reply-form { display:grid; gap:8px; margin-top:12px; max-width:720px; }
.nested-reply-form textarea,.discussion-reply-form textarea { min-height:72px; }
.discussion-reply-form { padding-top:20px; }
.discussion-live-status { display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; min-height:0; }
.discussion-live-status .presence,.discussion-live-status .typing-indicator { margin:0; padding:3px 8px; min-height:0; font-size:.78rem; }
.discussion-live-status .typing-indicator { display:flex; }
.discussion-live-status [hidden] { display:none !important; }
@media(max-width:900px) { .category-dashboard { grid-template-columns:1fr; } .category-scroll { height:280px; } }
@media(max-width:700px) {
 .topbar nav { display:flex; flex:1; min-width:0; gap:12px; overflow-x:auto; white-space:nowrap; margin-inline-start:4px; scrollbar-width:none; }
 .topbar nav::-webkit-scrollbar { display:none; }
 .topbar nav a { font-size:.76rem; flex:none; }
 .topbar { gap:8px; padding-inline:10px; }
 .logo-sm { height:36px; }
 .category-heading { align-items:flex-start; flex-direction:column; }
 .discussion-reply { padding-inline-start:calc(min(var(--reply-depth),5) * 12px); }
 .discussion-reply::before { inset-inline-start:calc(min(var(--reply-depth),5) * 12px - 5px); }
}


/* שורת מחבר וזמן אחידה בכל האתר */
.who { align-items:center; }
.who-details { display:flex; align-items:baseline; flex-wrap:wrap; gap:7px; min-width:0; }
.who .meta { white-space:nowrap; }

/* דיונים: בועות תגובה והיררכיה שקטה */
.discussion-reply {
  margin:10px 0 10px calc(min(var(--reply-depth),5) * 18px);
  padding:13px 15px;
  border:1px solid var(--rule);
  border-radius:12px;
  background:var(--sheet);
  box-shadow:0 1px 2px rgba(20,30,50,.035);
}
.discussion-reply::before { display:none; }
.discussion-reply .reply-author .who { gap:7px; }
.discussion-reply .reply-quote {
  margin:7px 0 9px;
  padding:6px 10px;
  border-inline-start:2px solid var(--navy-2);
  border-radius:4px;
  background:var(--wash);
  color:var(--muted);
}
.discussion-reply .text { margin-top:0; }
.reply-quote-action {
  color:var(--navy-2) !important;
  border-color:var(--rule) !important;
  font-weight:600 !important;
  opacity:1 !important;
}
.reply-quote-action:hover { background:var(--wash); }
@media(max-width:700px) {
  .discussion-reply { margin-inline-start:calc(min(var(--reply-depth),5) * 9px); padding:11px 12px; }
  .who-details { gap:5px; }
}

/* משך קריאה בכרטיסי מערכות והארות */
.toc-meta-line { display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-top:4px; }
.toc-meta-line .toc-date { margin:0; }
.reading-time { color:var(--muted); font-size:.68rem; white-space:nowrap; }
.work-meta .reading-time { font-size:.7rem; color:var(--muted); }
