/* Fonts: the same set as the Shnayim Mikra, Zohar and Mishnayot apps (licenses in fonts/). */
@font-face { font-family: 'Taamey Frank'; src: url('fonts/TaameyFrankCLM-Medium.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Noto Serif Hebrew'; src: url('fonts/NotoSerifHebrew.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Keter YG'; src: url('fonts/KeterYG-Medium.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Shofar'; src: url('fonts/ShofarRegular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Cardo'; src: url('fonts/Cardo-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Frank Ruhl Libre'; src: url('fonts/FrankRuhlLibre.ttf') format('truetype'); font-weight: 300 900; font-display: swap; }
@font-face { font-family: 'David Libre'; src: url('fonts/DavidLibre-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'SBL Hebrew'; src: url('fonts/SBL_Hbrw.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Ezra SIL'; src: url('fonts/EzraSIL.ttf') format('truetype'); font-display: swap; size-adjust: 86%; }

:root {
  --bg: #f3efe4; --paper: #fbf9f3; --ink: #1c1a16; --mute: #7d7668; --line: #e2dccc;
  --gold: #8a6a1f; --blue: #2f5f8f; --targ: #2f6b4f; --accent: #6b2d4e; --mark: #e8d9a866; --chipbg: #ece7d8;
  --tabbg: #f3efe4ee; --tldr: #5a4a1e;
  --hfont: 'SBL Hebrew', 'Taamey Frank', 'Noto Serif Hebrew', 'Times New Roman', serif;
  --fs: 22px;
  color-scheme: light;
}
:root[data-font="noto"] { --hfont: 'Noto Serif Hebrew', 'SBL Hebrew', serif; }
:root[data-font="keter"] { --hfont: 'Keter YG', 'SBL Hebrew', serif; }
:root[data-font="shofar"] { --hfont: 'Shofar', 'SBL Hebrew', serif; }
:root[data-font="cardo"] { --hfont: 'Cardo', 'SBL Hebrew', serif; }
:root[data-font="frankruhl"] { --hfont: 'Frank Ruhl Libre', 'SBL Hebrew', serif; }
:root[data-font="frank"] { --hfont: 'Taamey Frank', 'SBL Hebrew', serif; }
:root[data-font="ezra"] { --hfont: 'Ezra SIL', 'SBL Hebrew', serif; }
:root[data-font="david"] { --hfont: 'David Libre', 'SBL Hebrew', serif; }
:root[data-theme="dark"] {
  --bg: #161a22; --paper: #1d2129; --ink: #e9e3d3; --mute: #978f7e; --line: #2e3340;
  --gold: #d6b25a; --blue: #8fb6dc; --targ: #8cc9a8; --accent: #d9a0bf; --mark: #5a4e2a66; --chipbg: #272c36; --tabbg: #161a22ee; --tldr: #e0c98a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161a22; --paper: #1d2129; --ink: #e9e3d3; --mute: #978f7e; --line: #2e3340;
    --gold: #d6b25a; --blue: #8fb6dc; --targ: #8cc9a8; --accent: #d9a0bf; --mark: #5a4e2a66; --chipbg: #272c36; --tabbg: #161a22ee; --tldr: #e0c98a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 15px/1.45 -apple-system, 'Segoe UI', Roboto, 'Noto Sans Hebrew', sans-serif; padding: env(safe-area-inset-top, 0px) 0 calc(70px + env(safe-area-inset-bottom, 0px)); min-height: 100vh; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--blue); }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }
main, #top { max-width: 780px; margin: 0 auto; padding-inline: 16px; }
#top { display: flex; align-items: baseline; justify-content: space-between; padding-block: 12px 4px; }
#top h1 { margin: 0; font-family: var(--hfont); color: var(--accent); font-size: 28px; font-weight: normal; }
#top .sub { color: var(--mute); font-size: 13px; }
.view { display: none; } .view.on { display: block; }

.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin: 12px 0; display: block; color: inherit; text-decoration: none; }
.card h3 { margin: 0 0 10px; font-size: 16px; color: var(--accent); display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card h3 small { color: var(--mute); font-weight: 400; font-size: 12px; }
.fine { color: var(--mute); font-size: 12px; line-height: 1.6; }
.btn { border: 1px solid var(--line); background: var(--chipbg); border-radius: 10px; padding: 9px 14px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input, select { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; min-width: 0; }
.row-label { display: block; color: var(--mute); font-size: 12.5px; margin: 14px 0 6px; }
.seg { display: flex; background: var(--chipbg); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 8px 4px; border-radius: 8px; font-size: 13.5px; background: none; border: 0; }
.seg button.on { background: var(--paper); box-shadow: 0 1px 3px #0002; font-weight: 600; }
.fonts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.fonts button { background: var(--chipbg); border: 0; border-radius: 10px; padding: 6px 8px 7px; text-align: center; }
.fonts button.on { background: var(--ink); color: var(--bg); }
.fonts button b { display: block; font-weight: normal; font-size: 22px; line-height: 1.6; }
.fonts button small { display: block; font-size: 11px; opacity: .7; }
.size { display: flex; align-items: center; gap: 10px; }
.size button { background: var(--chipbg); border: 0; border-radius: 10px; padding: 7px 16px; font-family: var(--hfont); font-size: 18px; }
.size span { min-width: 3em; text-align: center; color: var(--mute); }

/* the day */
.kicker { color: var(--gold); font-size: 13px; margin-bottom: 4px; }
h2.sec { font-family: var(--hfont); font-size: 26px; margin: 0; font-weight: normal; line-height: 1.3; }
.meta { color: var(--mute); font-size: 13px; margin-top: 4px; }
.links { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0 6px; }
.links a, .links button { font-size: 13px; text-decoration: none; padding: 5px 10px; border-radius: 8px; background: var(--chipbg); border: 1px solid var(--line); color: var(--blue); }
.status { font-size: 13px; padding: 7px 10px; border-radius: 10px; background: var(--chipbg); margin-top: 10px; }
.status.ok { color: var(--targ); }

.text { margin-top: 10px; }
.unit { margin: 0 0 1.4em; }
.unit + .unit { border-top: 1px solid var(--line); padding-top: 1em; }
.unit .uh { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.unit .uh .nm { font-family: var(--hfont); font-size: calc(var(--fs) * .95); color: var(--accent); line-height: 1.35; }
.unit .uh .tag { font-size: 12px; color: var(--blue); text-decoration: none; background: var(--chipbg); border-radius: 8px; padding: 2px 8px; }
.tldr { font-size: 14.5px; color: var(--tldr); line-height: 1.55; margin: .35em 0 .7em; padding-inline-start: .7em; border-inline-start: 3px solid var(--gold); }
.tldr::before { content: 'תמצית · '; color: var(--gold); font-size: 12px; }
:root[lang="en"] .tldr::before { content: 'In short · '; }
.ar { font-family: var(--hfont); font-size: var(--fs); line-height: 1.85; text-align: justify; margin: 0 0 .55em; word-spacing: .04em; }
.ar b { font-weight: bold; }
.ar big { font-size: 1.3em; line-height: 1; }
.ar small { font-size: .86em; }
.ar.en { font-family: Georgia, 'Times New Roman', serif; font-size: calc(var(--fs) * .78); line-height: 1.6; text-align: start; color: var(--ink); opacity: .88; margin: -.2em 0 .9em; }
.pz { position: relative; }
/* Mekor Mayim Chayim notes under a paragraph */
.nt { display: inline-block; font-size: 12px; color: var(--mute); background: var(--chipbg); border: 1px solid var(--line); border-radius: 8px; padding: 2px 9px; margin: -.2em 0 .8em; cursor: pointer; }
.nt.on { color: var(--blue); }
.sulam { margin: .3em 0 .9em; padding: .4em .9em .5em; border-inline-start: 3px solid var(--line); background: var(--chipbg); border-radius: 8px 0 0 8px; }
.sulam p { font-family: var(--hfont); font-size: calc(var(--fs) * .74); line-height: 1.75; margin: .25em 0 .6em; text-align: justify; }
.sulam .sh { font-size: 12px; color: var(--mute); margin-bottom: .2em; }
.btn.mark { width: 100%; margin-top: 14px; padding: 12px; font-size: 16px; }
.day.done { border-color: color-mix(in srgb, var(--targ) 50%, var(--line)); }
.day.done .btn.mark { color: var(--targ); }
.loading { text-align: center; color: var(--mute); padding: 40px 0; }
.qbar { height: 9px; border-radius: 6px; background: var(--chipbg); overflow: hidden; border: 1px solid var(--line); }
.qbar > div { height: 100%; background: var(--targ); }

.row-day { display: flex; gap: 10px; align-items: center; padding: 8px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; font-size: 14px; }
.row-day .dt { flex: 0 0 7.5em; color: var(--mute); }
.row-day .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-day .ck { flex: 0 0 1.2em; color: var(--targ); }
.row-day.done .nm { color: var(--mute); }
.row-day.now { background: var(--mark); border-radius: 8px; }
.row-day .go { color: var(--mute); }
.owed { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--accent); background: var(--chipbg); border: 1px solid var(--line); border-radius: 12px; padding: 9px 14px; margin-top: 12px; font-size: 14px; }

/* the parts of the cycle, the sections of the siddur */
.partcard { display: flex; align-items: center; gap: 14px; }
.partcard .nm { font-family: var(--hfont); font-size: 24px; flex: 1; min-width: 0; line-height: 1.2; }
.partcard .nm small { display: block; font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 12.5px; color: var(--mute); margin-top: 3px; line-height: 1.4; }
.partcard .pct { color: var(--mute); font-size: 13px; white-space: nowrap; text-align: end; }
.partcard .qbar { width: 64px; margin-top: 4px; }
.partcard .go { color: var(--mute); font-size: 20px; }
.secrow { display: flex; gap: 10px; align-items: center; padding: 9px 2px; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.secrow .num { flex: 0 0 3.6em; font-family: var(--hfont); font-size: 18px; color: var(--gold); }
.secrow .nm { font-family: var(--hfont); font-size: 19px; flex: 1; min-width: 0; line-height: 1.3; }
.secrow .nm small { display: block; font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 13px; color: var(--mute); line-height: 1.45; margin-top: 2px; }
.secrow .info { display: flex; flex-direction: column; align-items: flex-end; text-align: end; flex: 0 0 auto; }
.secrow .pg { color: var(--mute); font-size: 12.5px; white-space: nowrap; }
.secrow .when { color: var(--gold); font-size: 12.5px; white-space: nowrap; }
.secrow.now { background: var(--mark); border-radius: 8px; }
.secrow .ck { flex: 0 0 1.2em; color: var(--targ); text-align: center; }
.secrow.done .nm { color: var(--mute); }
.secrow.head { border-top: 0; padding-top: 14px; }
.secrow.head .nm { color: var(--accent); font-size: 17px; }
.secrow.sub .nm { font-size: 17px; }
.back { margin-top: 8px; }
.gap { height: 6px; }

/* compendium entries: tl;dr as the title, the excerpt opens beneath */
.work-h { font-family: var(--hfont); font-size: 20px; color: var(--accent); margin: 18px 0 2px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.work-h small { font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 12px; color: var(--mute); }
.entry { border-top: 1px solid var(--line); padding: 9px 2px; }
.entry .eh { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.entry .eh .tl { flex: 1; min-width: 0; font-size: 15px; line-height: 1.5; }
.entry .eh .tl small { display: block; color: var(--mute); font-size: 12.5px; margin-top: 2px; }
.entry .eh .go { color: var(--mute); flex: 0 0 auto; transition: transform .2s; }
.entry.open .eh .go { transform: rotate(90deg); }
.entry .ex { display: none; margin-top: 8px; }
.entry.open .ex { display: block; }
.entry .ex .ar { font-size: calc(var(--fs) * .88); line-height: 1.8; }
.entry .ex .links { margin: 6px 0 0; }
.search { width: 100%; margin: 4px 0 2px; }
.hint { color: var(--mute); font-size: 13px; margin: 4px 2px 10px; }

#tabs { position: fixed; bottom: 0; inset-inline: 0; display: flex; background: var(--tabbg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 10; }
#tabs button { flex: 1; background: none; border: 0; padding: 8px 0 9px; color: var(--mute); font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 1px; }
#tabs button .i { font-size: 19px; }
#tabs button.on { color: var(--accent); }
#toast { position: fixed; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .2s; background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 12px; display: flex; gap: 12px; align-items: center; z-index: 20; }
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { background: none; border: 0; color: var(--bg); font-weight: 700; text-decoration: underline; }

/* English UI: Latin headings in a Latin serif; the Hebrew text keeps its font. */
:root[lang="en"] #top h1, :root[lang="en"] h2.sec, :root[lang="en"] .partcard .nm, :root[lang="en"] .secrow .nm, :root[lang="en"] .work-h, :root[lang="en"] .unit .uh .nm { font-family: Georgia, 'Times New Roman', var(--hfont), serif; }
:root[lang="en"] .secrow .num { font-family: Georgia, serif; font-size: 15px; }
:root[lang="en"] .row-day .dt { flex-basis: 8.6em; white-space: nowrap; }
:root[lang="en"] .secrow .nm { font-size: 17px; }
:root[lang="en"] .partcard .nm { font-size: 20px; }
:root[lang="en"] .work-h { font-size: 17px; }
