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

/* Torah quotations (vowelled Hebrew): serif scroll-style quote with an accent rule */
.torah-quote {
  font-family: "Frank Ruhl Libre", "David", "Times New Roman", serif;
  font-size: 1.12em;
  line-height: 2;
  color: var(--accent);
  background: var(--accent-soft);
  border-inline-start: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0 .4em;
  font-feature-settings: "kern" 1;
}
/* Shared article styles for the posts archive. */
:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1f26;
  --muted: #6b7280;
  --line: #e7e5e0;
  --accent: #1f3a5f;
  --accent-soft: #e6edf6;
  --btn-bg: #1f3a5f; --btn-text: #ffffff;
  --link: #2f5d8a;
  --hl: #c0392b;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 8px 30px rgba(20, 20, 30, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101216;
    --surface: #171a21;
    --text: #e8e9ec;
    --muted: #9aa1ad;
    --line: #272b35;
    --accent: #8fb8e3;
    --accent-soft: #1b2636;
    --btn-bg: #8fb8e3; --btn-text: #0e1116;
    --link: #8fb8e3;
    --hl: #ff7a6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 30px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101216;
  --surface: #171a21;
  --text: #e8e9ec;
  --muted: #9aa1ad;
  --line: #272b35;
  --accent: #8fb8e3;
  --accent-soft: #1b2636;
  --btn-bg: #8fb8e3; --btn-text: #0e1116;
  --link: #8fb8e3;
  --hl: #ff7a6b;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Heebo", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.85;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
img, iframe, video { max-width: 100%; height: auto; }

.wrap { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 20px; }

/* Top bar */
.site-bar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 56px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px;
}
.home {
  font-weight: 800; font-size: 1rem; color: var(--text); text-decoration: none;
}
.crumb { display: flex; gap: 8px; align-items: center; font-size: .88rem; color: var(--muted); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--text); }

/* Article */
.article { padding-top: 40px; padding-bottom: 24px; }
.article h1 {
  font-size: clamp(1.7rem, 4.2vw, 2.3rem);
  font-weight: 800;
  line-height: 1.3;
  margin: 0 0 8px;
  letter-spacing: -.01em;
}
.article h1::after {
  content: ""; display: block; width: 44px; height: 4px; border-radius: 4px;
  background: var(--accent); margin-top: 18px;
}
.post-body { margin-top: 32px; overflow-wrap: anywhere; }
/* Article text sits in a rounded box (collector pages already use their own cards) */
article > .post-body:not(:has(.collection)) {
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  border-radius: 28px; padding: 36px 36px 28px;
}
@media (max-width: 560px) {
  article > .post-body:not(:has(.collection)) { padding: 24px 20px 20px; border-radius: 22px; }
}
.post-body p { margin: 0 0 1.05em; }
.post-body p:empty, .post-body p:has(> br:only-child) { display: none; }
.post-body h2 {
  font-size: 1.35rem; font-weight: 700; line-height: 1.4;
  margin: 1.8em 0 .6em;
}
.post-body h3, .post-body h4 { font-size: 1.1rem; font-weight: 700; margin: 1.6em 0 .5em; }
.post-body b, .post-body strong { font-weight: 700; }
.post-body u { text-decoration-thickness: 1px; text-underline-offset: 4px; }
.post-body q { quotes: "“" "”"; font-style: normal; color: var(--text); }
.post-body blockquote {
  margin: 1.4em 0; padding: 14px 20px;
  background: var(--surface); border-inline-start: 4px solid var(--accent);
  border-radius: 12px; color: var(--text);
}
.post-body ul, .post-body ol { padding-inline-start: 1.4em; margin: 0 0 1.1em; }
.post-body li { margin-bottom: .3em; }
.post-body hr { border: 0; height: 1px; background: var(--line); margin: 2em 0; }
.post-body .hl { color: var(--hl); font-weight: 700; }
.post-body .center { text-align: center; }
.post-body img {
  display: block; margin: 1.6em auto; border-radius: 14px;
}
.post-body .video {
  position: relative; aspect-ratio: 16 / 9; margin: 1.6em 0;
  border-radius: 14px; overflow: hidden; background: #000;
}
.post-body .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.table-wrap { overflow-x: auto; margin: 1.4em 0; border-radius: 12px; border: 1px solid var(--line); }
.post-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.post-table td, .post-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.post-table tr:last-child td { border-bottom: 0; }

/* Previous / next */
.pager {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 48px; padding-top: 0; padding-bottom: 8px;
}
.pager:empty { display: none; }
.pg {
  display: flex; flex-direction: column; gap: 4px;
  padding: 16px 18px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  text-decoration: none; color: var(--text); min-width: 0;
  transition: transform .15s ease, border-color .15s ease;
}
.pg:hover { transform: translateY(-2px); border-color: var(--accent); }
.pg span { font-size: .8rem; color: var(--muted); }
.pg strong {
  font-size: .98rem; font-weight: 700; line-height: 1.4;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pg-newer { grid-column: 1; }
.pg-older { grid-column: 2; }
.pager:has(.pg-older:only-child) .pg-older { grid-column: 1 / -1; }
.pager:has(.pg-newer:only-child) .pg-newer { grid-column: 1 / -1; }

.foot { padding-top: 24px; padding-bottom: 56px; text-align: center; font-size: .9rem; }
.foot a { color: var(--muted); text-decoration: none; }
.foot a:hover { color: var(--text); }

@media (max-width: 560px) {
  body { font-size: 16px; line-height: 1.8; }
  .wrap { padding: 0 16px; }
  .article { padding-top: 28px; }
  .pager { grid-template-columns: 1fr; }
  .pg-newer, .pg-older { grid-column: 1 !important; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Collector pages: grouped link lists */
.collection { margin: 0 0 2.2em; }
.collection h2 {
  font-size: 1.2rem; font-weight: 800; margin: 0 0 12px;
  padding-inline-start: 14px; border-inline-start: 4px solid var(--accent); line-height: 1.3;
}
.links { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.links li { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.links li:last-child { border-bottom: 0; }
.links a { font-weight: 700; text-decoration: none; }
.links a:hover { text-decoration: underline; }
.links a[target="_blank"]::after { content: " ↗"; font-weight: 400; color: var(--muted); font-size: .85em; }
.links .desc { display: block; margin-top: 2px; font-size: .9rem; color: var(--muted); line-height: 1.6; }

/* Back link at the end of each post: a clear, filled call to action */
.foot { padding-top: 40px; padding-bottom: 64px; }
.back-link {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: min(100%, 280px); padding: 16px 32px; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-text); border: 0;
  box-shadow: 0 6px 20px rgba(31, 58, 95, .28);
  text-decoration: none; font-weight: 700; font-size: 1.1rem; line-height: 1.2;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.foot .back-link, .foot .back-link:hover { color: var(--btn-text); }
.back-link:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 10px 26px rgba(31, 58, 95, .38); }
/* Back button shown at the top of each post (same button as the footer one) */
.back-top { display: flex; justify-content: center; margin: 8px 0 28px; }
.back-link:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }

/* In-post chapter navigation ("לראש", "פרק קודם", "פרק הבא") as buttons */
.post-body a.chapter-btn {
  display: inline-flex; align-items: center; justify-content: center;
  margin: 6px 4px; padding: 9px 20px; border-radius: 999px;
  background: var(--btn-bg); color: var(--btn-text);
  font-style: normal; font-weight: 700; font-size: .95rem; line-height: 1.2;
  text-decoration: none; box-shadow: 0 4px 14px rgba(31, 58, 95, .22);
  transition: transform .15s ease, filter .15s ease;
}
.post-body a.chapter-btn:hover { transform: translateY(-1px); filter: brightness(1.08); text-decoration: none; }

/* Quoted source text */
.post-body .refer-quote { display: inline; background: var(--accent-soft); border-radius: 6px; padding: 0 4px; }
.doc-meta { margin: -4px 0 0; font-size: .9rem; color: var(--muted); }
.doc-meta a { color: var(--link); }
.chapter-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.chapter-nav .chapter-btn { margin: 0; }

/* ==========================================================================
   Paper theme — used by the heror pages. Imported from the
   emunazeloesek site stylesheet and scoped to body.paper-theme so the
   other posts keep their look.
   ========================================================================== */
:root body.paper-theme {
  /* Same palette as the main page; gold kept only for the marks */
  --bg: #f5f6f8; --bg-deep: #ebedf1; --surface-solid: #ffffff;
  --ink: #171b24; --ink-soft: #3a4252; --muted: #6a7280;
  --line: #e6e8ed;
  --gold: #a08452; --gold-soft: #e7d9b8; --gold-tint: rgba(160, 132, 82, 0.10);
  --quote-bg: rgba(31, 58, 95, 0.06);
  --radius: 20px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 30px rgba(16, 24, 40, 0.07);
  --font-body: 'Heebo', 'Alef', system-ui, sans-serif;
  --font-serif: 'Frank Ruhl Libre', 'David Libre', 'Times New Roman', serif;
  --text: var(--ink); --surface: var(--surface-solid); --link: #1f3a5f;
  --accent: var(--gold); --accent-soft: var(--gold-tint);
  --btn-bg: #1f3a5f; --btn-text: #ffffff;
  color-scheme: light;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.15rem;
  line-height: 1.8;
  padding: 2rem 1rem 4rem;
}

.paper-theme .paper {
  background: var(--surface-solid);
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(1.5rem, 5vw, 4rem) clamp(1.25rem, 6vw, 4.5rem);
  line-height: 1.95;
}

.paper-theme h1, .paper-theme h2, .paper-theme h3, .paper-theme h4 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.3;
  color: var(--ink);
}
.paper-theme .paper h1 { margin-top: 0.5rem; text-align: center; }
.paper-theme .paper h1::after {
  content: ""; display: block; width: 3rem; height: 0.2rem;
  margin: 0.8rem auto 0; border-radius: 999px; background: var(--gold);
}
.paper-theme .paper h2 { margin-top: 2.5rem; scroll-margin-top: 1rem; }

.paper-theme a:link, .paper-theme a:visited {
  color: var(--link);
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.22em;
}
.paper-theme a:hover { color: var(--gold); text-decoration-color: transparent; }
.paper-theme li::marker { font-weight: 700; color: var(--gold); }
.paper-theme .paper .post-body { margin-top: 0; }

.paper-theme .document-info {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem;
  font-size: 0.95rem; color: var(--muted);
  margin-bottom: 2rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line);
}
.paper-theme .document-info strong { color: var(--ink-soft); }
.paper-theme .doc-meta { margin: 0; font-size: 0.95rem; color: var(--muted); }

.paper-theme .simple-quote {
  display: block; color: var(--ink-soft);
  font-family: var(--font-serif); font-style: italic; font-size: 1.12em;
  margin: 1rem 0; padding: 0.25rem 1.1rem;
  border-inline-start: 0.2rem solid var(--gold-soft);
}

.paper-theme .criticize {
  display: inline; background: #f9ecc8; color: #5a3e1b;
  padding: 0.1rem 0.35rem; margin: 0 0.1rem; border-radius: 0.3rem;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.paper-theme .criticize::before {
  content: "◈"; font-size: 0.7em; margin-inline-end: 0.3rem;
  color: var(--gold); vertical-align: middle;
}

.paper-theme .refer, .paper-theme a.refer:link, .paper-theme a.refer:visited {
  color: var(--gold); font-size: 0.8em; font-weight: 700; text-decoration: none;
}
.paper-theme span.refer {
  display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em;
  padding: 0 0.3em; border-radius: 999px; background: var(--gold-tint);
  line-height: 1; vertical-align: 0.15em;
}

.paper-theme .refer-quote {
  font-family: var(--font-serif); font-style: normal; font-size: 1.04em;
  color: var(--ink-soft); background: var(--quote-bg);
  padding: 0.15rem 0.5rem; margin: 0.3rem 0; border-radius: 0.35rem;
  line-height: 2; box-decoration-break: clone; -webkit-box-decoration-break: clone;
}

.paper-theme .article-toc {
  margin: 2.5rem 0 1rem; padding: 1.25rem 1.5rem;
  background: var(--gold-tint); border: 1px solid var(--line); border-radius: 0.9rem;
}
.paper-theme .article-toc h2 { margin: 0 0 0.6rem; font-size: 1.25rem; }
.paper-theme .article-toc ol {
  list-style: none; margin: 0; padding: 0; columns: 2 16rem; column-gap: 2rem;
}
.paper-theme .article-toc li { margin: 0 0 0.35rem; break-inside: avoid; font-size: 0.98rem; line-height: 1.5; }
.paper-theme .article-toc a:link, .paper-theme .article-toc a:visited { text-decoration: none; }
.paper-theme .article-toc a:hover { color: var(--gold); }

.paper-theme .paper .foot { padding: 2rem 0 0; }

/* Quotations from Tanakh / Gemara, with their source in brackets */
.post-body q.src-quote {
  quotes: none;
  font-style: normal;
  color: var(--ink);
  background: #dde6f2;
  border-inline-start: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0.05em 0.45em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.post-body q.src-quote { font-weight: 500; }
.post-body .src-ref {
  color: var(--muted);
  font-size: 0.9em;
  white-space: nowrap;
}

/* Publication date shown under the article title (CMS-generated pages). */
.article-meta { color: var(--muted); font-size: .92rem; margin: -.6em 0 0; }
