/* סדר אזכרה — one column for reading, phone first; a table of contents beside it on wide screens.
   Ink-blue on cool paper, amber only for what the congregation answers. Fonts are local (fonts/). */

@font-face { font-family: 'Frank Ruehl CLM'; src: url('fonts/FrankRuehlCLM-Medium.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Frank Ruehl CLM'; src: url('fonts/FrankRuehlCLM-Bold.woff2') format('woff2'); font-weight: 700 900; font-display: swap; }
@font-face { font-family: 'Keter YG'; src: url('fonts/KeterYG-Medium.woff2') format('woff2'); font-weight: 400 600; font-display: swap; }
@font-face { font-family: 'Keter YG'; src: url('fonts/KeterYG-Bold.woff2') format('woff2'); font-weight: 700 900; font-display: swap; }
@font-face { font-family: 'Nachlieli CLM'; src: url('fonts/NachlieliCLM-Light.woff2') format('woff2'); font-weight: 300 600; font-display: swap; }
@font-face { font-family: 'Nachlieli CLM'; src: url('fonts/NachlieliCLM-Bold.woff2') format('woff2'); font-weight: 700 900; font-display: swap; }
@font-face { font-family: 'Assistant'; src: url('fonts/Assistant-Variable.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }

:root {
  --scale: 1;
  --font-text: 'Frank Ruehl CLM', 'Times New Roman', serif;
  --font-ui: 'Assistant', 'Segoe UI', Arial, system-ui, sans-serif;

  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #1b2130;
  --text: #1f2533;
  --muted: #5d6676;
  --line: #dde1e8;
  --accent: #2e4a6b;
  --accent-ink: #ffffff;
  --accent-soft: #e7edf5;
  --response: #8a4b10;
  --warn-bg: #fbf2de;
  --warn-ink: #573f0c;
  --focus: #2f6fd6;
  --shadow: 0 1px 2px rgb(20 30 50 / 6%), 0 8px 24px rgb(20 30 50 / 6%);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1217; --surface: #161b22; --ink: #eceef2; --text: #dfe3ea; --muted: #9aa3b1; --line: #29303b;
    --accent: #9dbbe0; --accent-ink: #0e1217; --accent-soft: #1c2736; --response: #e8b46e;
    --warn-bg: #2b2416; --warn-ink: #f1dcae; --focus: #7fb0ff; --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1217; --surface: #161b22; --ink: #eceef2; --text: #dfe3ea; --muted: #9aa3b1; --line: #29303b;
  --accent: #9dbbe0; --accent-ink: #0e1217; --accent-soft: #1c2736; --response: #e8b46e;
  --warn-bg: #2b2416; --warn-ink: #f1dcae; --focus: #7fb0ff; --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  color-scheme: dark;
}
:root[data-font="keter"] { --font-text: 'Keter YG', 'Frank Ruehl CLM', serif; }
:root[data-font="nachlieli"] { --font-text: 'Nachlieli CLM', 'Frank Ruehl CLM', sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-ui);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
/* Line icons only; QR codes are svg too and must keep their own fill. */
.tool svg, .action svg { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { top: 8px; }

/* ---- top bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner, .footer-inner, .start, .order {
  max-width: 72rem; margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.brand-mark { width: 10px; height: 18px; border-radius: 50% 50% 45% 45% / 65% 65% 35% 35%; background: linear-gradient(var(--response), color-mix(in srgb, var(--response) 40%, transparent)); box-shadow: 0 0 10px color-mix(in srgb, var(--response) 45%, transparent); }
.topbar-tools { display: flex; gap: 6px; }
.tool {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid transparent; border-radius: 999px; background: transparent; cursor: pointer; color: var(--ink);
}
.tool:hover { background: var(--accent-soft); }

/* ---- start ---- */
.start { padding-block: clamp(24px, 6vw, 64px) 48px; display: grid; gap: 28px; max-width: 40rem; }
.eyebrow { margin: 0; color: var(--muted); font-size: .95rem; letter-spacing: .04em; }
.start h1 { font: 700 clamp(2.1rem, 7vw, 3rem)/1.1 var(--font-text); margin: 4px 0 12px; color: var(--ink); text-wrap: balance; }
.lede { margin: 0; color: var(--muted); font-size: 1.08rem; max-width: 34em; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.create { padding: clamp(16px, 4vw, 28px); display: grid; gap: 22px; }
.step { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: 12px; align-items: start; }
.step-num { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-top: 2px; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; padding: 0; }
.field.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.field.inline > legend { width: 100%; margin-bottom: 4px; }
input[type="text"], input:not([type]), select {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 1.1rem;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink);
}
input:not([type]):focus, select:focus { border-color: var(--accent); }
#name { font-family: var(--font-text); font-size: 1.4rem; }
.hint { margin: 0; color: var(--muted); font-size: .92rem; }
.hint-inline { color: var(--muted); font-size: .92rem; }
.optional { color: var(--muted); font-weight: 400; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); gap: 8px; }
.choice { position: relative; display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; background: var(--bg); }
.choice input { position: absolute; opacity: 0; }
.choice strong { font-size: 1.05rem; }
.choice span { color: var(--muted); font-size: .9rem; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.details { display: grid; gap: 16px; border-top: 1px solid var(--line); padding-top: 14px; margin-inline-start: 44px; }
.nusach-hint { margin: 0 0 8px; }
.pill-option { position: relative; display: inline-flex; }
.pill-option input { position: absolute; opacity: 0; }
.pill-option span { padding: 8px 16px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; min-height: 40px; display: inline-flex; align-items: center; }
.pill-option input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pill-option input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.check { display: flex; gap: 10px; align-items: center; min-height: 44px; cursor: pointer; }
.check input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.primary, .secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 12px; cursor: pointer; font-weight: 700; text-decoration: none;
}
.primary { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); }
.primary:hover { filter: brightness(1.08); }
.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.secondary:hover { border-color: var(--accent); }
.submit-row .primary { width: 100%; font-size: 1.15rem; }
.form-error { margin: 0; color: #b42318; font-weight: 600; }
:root[data-theme="dark"] .form-error { color: #ff9b8f; }

/* ---- the order ---- */
.order { padding-bottom: 48px; }
.order-head { text-align: center; padding-block: clamp(28px, 6vw, 56px) 20px; display: grid; justify-items: center; gap: 6px; }
.leilui { margin: 0; color: var(--muted); letter-spacing: .12em; font-size: 1rem; }
.order-head h1 { margin: 0; font: 700 clamp(2.2rem, 8vw, 3.4rem)/1.15 var(--font-text); color: var(--ink); text-wrap: balance; }
.order-head h1::after { content: ''; display: block; width: 72px; height: 2px; margin: 14px auto 0; background: linear-gradient(90deg, transparent, var(--response), transparent); }
.meta { margin: 0; color: var(--muted); font-size: .95rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.action {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 600;
}
.action:hover { border-color: var(--accent); color: var(--accent); }
.warn { max-width: 42rem; margin: 12px auto; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg); color: var(--warn-ink); font-size: .95rem; }

.layout { display: grid; gap: 8px; justify-content: center; grid-template-columns: minmax(0, 42rem); margin-top: 8px; }
.toc details { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.toc summary { cursor: pointer; padding: 12px 16px; font-weight: 700; min-height: 44px; }
.toc ol { list-style: none; margin: 0; padding: 0 8px 10px; display: grid; gap: 2px; }
.toc a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; font-size: .98rem; }
.toc a:hover { background: var(--accent-soft); }
.toc a.current { color: var(--accent); font-weight: 700; }

/* Wide screens: the text stays centred under the name; the contents sit in the margin beside it. */
@media (min-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) minmax(0, 42rem) minmax(0, 1fr); gap: 40px; }
  .toc { grid-column: 1; grid-row: 1; justify-self: end; width: min(15rem, 100%); position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 90px); overflow: auto; }
  .reading { grid-column: 2; grid-row: 1; }
  .toc details { border: 0; background: transparent; }
  .toc summary { padding-inline: 10px; list-style: none; color: var(--muted); font-size: .9rem; letter-spacing: .04em; pointer-events: none; }
  .toc summary::-webkit-details-marker { display: none; }
}

.reading { min-width: 0; }
.block { padding-block: 22px 8px; scroll-margin-top: 72px; }
.block + .block { border-top: 1px solid var(--line); }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.block h2 { margin: 0; font: 700 calc(1.35rem * min(var(--scale), 1.4))/1.3 var(--font-text); color: var(--accent); }
/* A button that reads as a quiet link (feedback entry points). */
.linklike { background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.report { font-size: .82rem; color: var(--muted); white-space: nowrap; min-height: 32px; }
/* A small quiet line above the text, e.g. "נאמר במניין" over each Kaddish. */
.note { margin: -4px 0 8px; color: var(--muted); font-size: .9rem; }
.legend { margin: 0 0 10px; color: var(--muted); font-size: .92rem; }
.legend b { color: var(--response); }
.scripture {
  margin: 0;
  font-family: var(--font-text);
  font-size: calc(1.5rem * var(--scale));
  line-height: 1.95;
  color: var(--text);
  hyphens: none;
}
/* Justified like a printed siddur once the line is long enough; on a phone it would open wide gaps. */
@media (min-width: 600px) { .scripture { text-align: justify; text-justify: inter-word; } }
.verse { }
.vn { font-family: var(--font-ui); font-size: .5em; color: var(--muted); font-weight: 600; vertical-align: .55em; margin-inline-end: .25em; }
.letter-group + .letter-group { margin-top: 18px; }
.letter-head { display: flex; align-items: center; gap: 12px; margin: 6px 0 4px; }
.letter-big { font: 700 calc(2rem * var(--scale))/1 var(--font-text); color: var(--accent); width: 1.6em; height: 1.6em; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); }
.letter-sub { color: var(--muted); font-size: .9rem; }
.mishnah { margin-bottom: 14px; }
.num { color: var(--accent); font-weight: 700; margin-inline-end: .2em; }
.prayer .congregation { color: var(--response); font-weight: 700; }
.prayer .together, .legend .together { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .35em; }
.prayer .slot { font-weight: 700; color: var(--ink); background: var(--accent-soft); padding: 0 .25em; border-radius: 6px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.missing { color: var(--muted); font-style: italic; }

/* ---- footer: one quiet line ---- */
.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; padding-block: 14px calc(14px + env(safe-area-inset-bottom, 0px)); }
.footer-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 16px; margin-block: 0; }
.footer-row a, .footer-row .linklike { color: inherit; }
.build { font-variant-numeric: tabular-nums; }

/* Feedback dialog. */
textarea { width: 100%; min-height: 7.5rem; padding: 10px 14px; font: inherit; font-size: 1.05rem; line-height: 1.5; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--ink); resize: vertical; }
textarea:focus { border-color: var(--accent); }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.status.error { color: #b42318; }
:root[data-theme="dark"] .status.error { color: #ff9b8f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.error { color: #ff9b8f; } }

/* ---- about page ---- */
.about { max-width: 42rem; margin-inline: auto; padding-block: clamp(24px, 6vw, 56px) 48px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 22px; }
.about h1 { margin: 0; font: 700 clamp(1.9rem, 6vw, 2.6rem)/1.15 var(--font-text); color: var(--ink); }
.about h2 { margin: 0 0 8px; font: 700 1.25rem/1.3 var(--font-text); color: var(--accent); }
.about p { margin: 0 0 8px; }
.about .sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.about .sources li { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.about .sources strong { display: block; }
.about .sources span { color: var(--muted); font-size: .95rem; }
.about .fine { color: var(--muted); font-size: .92rem; }

/* ---- dialogs (bottom sheet on phones, centered card on wide screens) ---- */
dialog.sheet {
  border: 0; padding: 0; background: var(--surface); color: var(--ink);
  width: min(34rem, 100vw); max-width: 100vw; max-height: 92vh;
  border-radius: 18px 18px 0 0; margin: auto auto 0; box-shadow: 0 -8px 40px rgb(0 0 0 / 25%);
}
dialog.wide-sheet { width: min(40rem, 100vw); }
dialog::backdrop { background: rgb(10 14 20 / 45%); }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: 18px; } }
.sheet-body { display: grid; gap: 16px; padding: 18px max(18px, env(safe-area-inset-left, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-right, 0px)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 1.3rem; }
.close { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--accent-soft); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.sheet-note { margin: 0; color: var(--muted); font-size: .95rem; }
.segmented { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented label { position: relative; flex: 1 1 auto; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; text-align: center; }
.segmented input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.segmented input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.font-options { display: grid; gap: 6px; }
.font-options label { position: relative; }
.font-options input { position: absolute; opacity: 0; }
.font-options label > span { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 14px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; min-height: 52px; }
.font-options em { font-style: normal; font-size: 1.45rem; color: var(--text); }
.font-options small { color: var(--muted); font-size: .9rem; }
.font-options input:checked + span { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.font-options input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.size-row { display: flex; align-items: center; gap: 16px; }
.round { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-weight: 700; font-size: 1.05rem; }
#size-out { min-width: 4ch; text-align: center; font-variant-numeric: tabular-nums; font-weight: 700; }
.sample { margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--bg); font-family: var(--font-text); font-size: calc(1.5rem * var(--scale)); line-height: 1.9; color: var(--text); }

.link-row { display: flex; gap: 8px; }
.link-row input { flex: 1; min-width: 0; font-size: .95rem; font-family: ui-monospace, Consolas, monospace; }
.status { margin: 0; min-height: 1.2em; color: var(--accent); font-size: .92rem; font-weight: 600; }
.share-buttons { display: grid; gap: 8px; }
.wide { width: 100%; }
.qr-card { display: grid; justify-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; }
.qr { background: #fff; padding: 10px; border-radius: 10px; line-height: 0; }
.qr svg, .qr img { width: min(220px, 60vw); height: auto; display: block; }

.print-choice { display: grid; gap: 14px; }
@media (min-width: 640px) { .print-choice { grid-template-columns: 1fr 1fr; } }
.print-option { display: grid; gap: 8px; align-content: start; padding: 14px; border: 1px solid var(--line); border-radius: 14px; }
.print-option h3 { margin: 0; font-size: 1.1rem; }
.print-option p { margin: 0; color: var(--muted); font-size: .95rem; }
.print-option .primary { margin-top: 6px; }
.steps-list { margin: 0; padding-inline-start: 1.2em; display: grid; gap: 4px; font-size: .95rem; }

.edit-details { display: grid; gap: 14px; }
@media (min-width: 640px) { .edit-details { grid-template-columns: 1fr 1fr; } }
.list-title { margin: 6px 0 0; font-size: 1.1rem; }
.edit-sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.edit-sections li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 6px; align-items: center; padding: 4px 6px 4px 4px; border: 1px solid var(--line); border-radius: 10px; }
.edit-sections li.off { border-style: dashed; color: var(--muted); }
.edit-sections label { display: flex; gap: 10px; align-items: center; min-height: 44px; padding-inline: 8px; cursor: pointer; }
.edit-sections input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); flex: none; }
.move { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; }
.move:disabled { opacity: .35; cursor: default; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; position: sticky; bottom: 0; background: var(--surface); padding-top: 8px; }

/* Recent orders on the start page. */
.recent { padding: clamp(16px, 4vw, 24px); display: grid; gap: 12px; }
.recent h2 { margin: 0; font-size: 1.1rem; color: var(--ink); }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recent-list li { display: flex; align-items: center; gap: 4px; border: 1px solid var(--line); border-radius: 10px; }
.recent-list a { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 10px 14px; min-height: 44px; color: var(--ink); text-decoration: none; }
.recent-list a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.recent-list a span { color: var(--muted); font-size: .9rem; }
.recent-list .remove { flex: none; width: 44px; height: 44px; margin-inline-end: 2px; border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.recent-list .remove:hover { color: var(--ink); background: var(--accent-soft); }
.recent-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* Print-only pieces stay out of the screen view. */
.print-end, .booklet { display: none; }

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .action, .tool, .primary, .secondary, .choice { transition: background-color .15s, border-color .15s, color .15s, filter .15s; }
}

/* Windows high-contrast mode replaces backgrounds, so a selected option is marked by a thick border. */
@media (forced-colors: active) {
  .choice:has(input:checked), .pill-option input:checked + span, .segmented input:checked + span, .font-options input:checked + span { border: 3px solid Highlight; }
}

/* ======================================================================================
   Print. A4 sheet by default; booklet mode (html.print-booklet) prints only #booklet.
   The page size rule itself is set by app.js (one @page rule per mode).
   ====================================================================================== */
@media print {
  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --ink: #000; --text: #000; --muted: #444; --line: #bbb;
    --accent: #1f3550; --accent-soft: #eef1f5; --response: #6b3a0c; --warn-bg: #fff; --warn-ink: #333;
    color-scheme: light;
  }
  body { background: #fff; display: block; font-size: 11pt; }
  .topbar, .site-footer, .actions, .warn, .toc, .report, .skip, dialog, #start { display: none !important; }
  .order { max-width: none; padding: 0; }
  .layout { display: block; margin: 0; }
  .order-head { padding: 0 0 6mm; }
  .order-head h1 { font-size: 26pt; }
  .meta { display: none; }
  .block { padding: 4mm 0 2mm; border: 0 !important; }
  .reading .block.group-start { break-before: page; }
  .block-head { margin-bottom: 2mm; }
  .block h2 { font-size: 14pt; break-after: avoid; }
  .letter-head { break-after: avoid; }
  .scripture { font-size: calc(14pt * min(var(--scale), 1.3)); line-height: 1.75; color: #000; }
  .note { color: #444; }
  .print-end { display: flex; gap: 6mm; align-items: center; margin-top: 10mm; padding-top: 5mm; border-top: 1px solid #999; break-inside: avoid; font-size: 9.5pt; color: #222; }
  .print-end p { margin: 0 0 2mm; }
  .print-qr svg { width: 30mm; height: 30mm; display: block; }
  .print-url { direction: ltr; text-align: right; font-family: ui-monospace, Consolas, monospace; font-size: 8pt; word-break: break-all; }
  .print-src { color: #555; font-size: 7.5pt; word-break: break-all; }
  a { color: inherit; text-decoration: none; }

  html.print-booklet body > *:not(#booklet) { display: none !important; }
  html.print-booklet .booklet { display: block !important; }
}

/* ---- booklet: A4 landscape sheets holding two A5 pages; also laid out offscreen for measuring ---- */
.booklet { direction: ltr; }
.bk-sheet { width: 297mm; height: 210mm; display: grid; grid-template-columns: 148.5mm 148.5mm; break-after: page; overflow: hidden; }
.bk-sheet:last-child { break-after: auto; }
.bk-page {
  direction: rtl; width: 148.5mm; height: 210mm; padding: 13mm 12mm 11mm; overflow: hidden;
  display: flex; flex-direction: column; background: #fff; color: #000; font-family: var(--font-ui);
}
.bk-body { flex: 1; overflow: hidden; min-height: 0; }
.bk-flow { display: flow-root; }
/* Fixed height, so an empty folio (cover, blank page) takes the same room as a numbered one. */
.bk-folio { flex: none; height: 8mm; padding-top: 3mm; text-align: center; font-size: 8pt; line-height: 1; color: #666; font-variant-numeric: tabular-nums; }
.bk-cover .bk-folio, .bk-back .bk-folio { display: none; }
.bk-body .block { padding: 0 0 3mm; border: 0; }
.bk-body .block-head { margin-bottom: 1.5mm; }
.bk-body .block h2 { font-size: 12pt; color: #1f3550; margin: 2mm 0 0; }
.bk-body .report { display: none; }
.bk-body .scripture { font-size: calc(12.5pt * min(var(--scale), 1.25)); line-height: 1.7; color: #000; text-align: justify; }
.bk-body .vn { color: #666; }
.bk-body .letter-head { margin: 2mm 0 1mm; }
.bk-body .letter-big { font-size: 15pt; background: #eef1f5; color: #1f3550; }
.bk-body .letter-sub { font-size: 8pt; color: #555; }
.bk-body .note { font-size: 8.5pt; margin: 0 0 1.5mm; color: #444; }
.bk-body .legend { font-size: 8.5pt; color: #444; }
.bk-body .prayer .congregation { color: #6b3a0c; }
.bk-body .prayer .slot { background: #eef1f5; color: #000; }
.bk-body .mishnah { margin-bottom: 2.5mm; }
.bk-cover { justify-content: center; text-align: center; gap: 6mm; }
.bk-cover .bk-leilui { font-size: 13pt; letter-spacing: .14em; color: #333; margin: 0; }
.bk-cover .bk-name { font: 700 30pt/1.15 var(--font-text); margin: 0; color: #000; }
.bk-cover .bk-rule { width: 30mm; height: 1px; background: #8a4b10; margin: 2mm auto; }
.bk-cover .bk-sub { font-size: 10.5pt; color: #444; margin: 0; }
.bk-back { justify-content: flex-end; text-align: center; gap: 4mm; font-size: 8.5pt; color: #333; }
.bk-back .bk-qr svg { width: 36mm; height: 36mm; margin: 0 auto; display: block; }
.bk-back p { margin: 0; }
.bk-back .bk-url { direction: ltr; font-family: ui-monospace, Consolas, monospace; font-size: 7pt; word-break: break-all; }
.bk-back .bk-fine { font-size: 6.5pt; color: #666; word-break: break-all; }
.bk-measure { position: fixed; top: 0; left: -10000px; visibility: hidden; pointer-events: none; }
