@font-face { font-family: Vilna; src: url(/vendor/fonts/Mekorot-Vilna.ttf); }
@font-face { font-family: Vilna; font-weight: bold; src: url(/vendor/fonts/Mekorot-Vilna-Bold.ttf); }
@font-face { font-family: Rashi; src: url(/vendor/fonts/Mekorot-Rashi.ttf); }

/* Clean & Bright: white space, one strong blue, rounded cards. Sans-serif for the interface and
   headings; the Gemara itself keeps its traditional fonts (--serif, Vilna, Rashi). */
:root {
  --bg: #f5f7fb; --panel: #fff; --card: #fff; --ink: #172033; --muted: #6b7590; --line: #e5e9f2;
  --accent: #1f4e8c; --accent-2: #2f6fc0; --accent-ink: #fff; --accent-soft: #e8f0fb; --hl: #fde7b0; --done: #9aa3b8;
  --good: #1f9d55; --good-soft: #dcf3e5; --partial: #f6d58e; --track: #e5e9f2;
  --serif: "Frank Ruhl Libre", "David", serif;
  --sans: Inter, "Noto Sans Hebrew", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: Inter, "Noto Sans Hebrew", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 16px; --shadow: 0 1px 2px rgba(23,32,51,.05), 0 4px 16px rgba(23,32,51,.05);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
a { color: var(--accent); }
button { font: inherit; }
.he { font-family: var(--display); direction: rtl; }
.muted { color: var(--muted); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }

/* ---------- site chrome: a slim top bar; ☰ opens the menu, which slides in from the side ---------- */
.site-head { position: sticky; top: 0; z-index: 40; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; min-height: 58px; }
.menu-btn { width: 42px; height: 42px; flex: none; border: 1px solid var(--line); background: #fff; border-radius: 12px;
  color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.menu-btn:hover { background: var(--bg); }
.menu-btn .icon { width: 22px; height: 22px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; min-width: 0; }
.logo { width: 38px; height: 38px; flex: none; border-radius: 11px; background: var(--accent); color: #fff; display: grid; place-items: center;
  font: 800 18px "Noto Sans Hebrew", sans-serif; }
.brand .bt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand b { font: 800 20px "Noto Sans Hebrew", var(--display); direction: rtl; text-align: left; }
.brand small { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-tools { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.app-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--accent); color: #fff; border-radius: 99px; padding: 7px 14px 7px 11px;
  font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.app-pill .icon { width: 17px; height: 17px; }
.app-pill:hover { background: var(--accent-2); }
/* the menu panel */
.drawer { border: 0; padding: 16px 14px calc(16px + env(safe-area-inset-bottom)); margin: 0; height: 100%; max-height: 100%; width: min(320px, 86vw);
  inset-inline-start: 0; inset-inline-end: auto; background: #fff; box-shadow: 8px 0 30px rgba(23,32,51,.18); overflow-y: auto; }
.drawer[open] { display: flex; flex-direction: column; animation: slide-in .22s ease-out; }
.drawer::backdrop { background: rgba(23,32,51,.35); }
@keyframes slide-in { from { transform: translateX(-100%); } to { transform: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 18px; }
.menu-close { width: 38px; height: 38px; flex: none; border: 0; background: var(--bg); border-radius: 50%; cursor: pointer; color: var(--muted);
  display: grid; place-items: center; }
.menu-close .icon { width: 18px; height: 18px; }
.nav { display: grid; gap: 2px; }
.nav a, .who { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: #3c4660; text-decoration: none; font-weight: 500; font-size: 16px; }
.icon { width: 20px; height: 20px; flex: none; }
.nav a .icon, .who .icon { color: var(--muted); }
.nav a.on .icon { color: var(--accent); }
.nav a:hover, .who:hover { background: var(--bg); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav2 { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.nav2 a { padding: 9px 12px; font-size: 15px; }
.app-box { display: block; margin-top: 16px; background: var(--accent); color: #fff; border-radius: 14px; padding: 14px; font-size: 14px; text-decoration: none; }
.app-box b { display: flex; align-items: center; gap: 7px; font-size: 15px; margin-bottom: 4px; }
.app-box b .icon { width: 18px; height: 18px; }
.app-box em { display: inline-block; margin-top: 10px; background: #fff; color: var(--accent); border-radius: 8px; padding: 6px 12px; font-weight: 600; font-style: normal; }
.app-box:hover { background: var(--accent-2); }
.who { margin-top: auto; color: var(--muted); }
/* no email account set up yet: hide what would need one (see server.js MAIL_READY) */
html[data-nomail] .needs-mail { display: none !important; }
html:not(.app-live) .app-only { display: none !important; } /* the app isn't in the stores yet (see APP_LIVE in env.js) */
/* the app's daily reminder (home page, Daf Yomi box) */
.reminder { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line); }
.reminder .switch { display: flex; gap: 8px; align-items: center; position: relative; cursor: pointer; user-select: none; font-weight: 600; }
.reminder .switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.reminder .switch .track { width: 36px; height: 20px; border-radius: 99px; background: #cfd6e4; position: relative; transition: background .2s; flex: none; }
.reminder .switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s; }
.reminder .switch input:checked + .track { background: var(--accent); }
.reminder .switch input:checked + .track::after { transform: translateX(16px); }
.reminder .rem-time { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.reminder .rem-time input { font: inherit; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.reminder .rem-note { flex-basis: 100%; margin: 0; font-size: 13px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 8px; }
.foot-links a, .foot-contact a { color: var(--muted); }
.foot-contact { margin-bottom: 8px; }
@media (max-width: 720px) {
  .site-head { gap: 10px; padding: 8px 12px; min-height: 54px; }
  .site-head .brand small { display: none; }
  .site-head .logo { width: 34px; height: 34px; border-radius: 10px; font-size: 16px; }
  .site-head .brand b { font-size: 18px; }
  .app-pill { padding: 6px 12px; font-size: 13px; }
}
@media (max-width: 340px) { .app-pill { display: none; } }

/* shown only where scripts don't run (simple phone browsers) */
.noscript-nav { padding: 10px 16px; background: var(--accent-soft); font-size: 15px; }

/* full screen (daf page): only the player and the page */
body.focus .site-head, body.focus footer, body.focus .daf-head .nav-daf { display: none !important; }
body.focus main.wrap { padding-top: 8px; }
body.focus { --head-h: 0px; }

main.wrap { padding-top: 28px; padding-bottom: 48px; }
h1 { font: 800 30px/1.2 var(--display); margin: 0 0 6px; letter-spacing: -.01em; }
h2 { font: 700 21px/1.3 var(--display); margin: 30px 0 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: 10px; padding: 10px 18px; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.ghost { background: #fff; color: var(--accent); border-color: #c9d8ee; }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.small { padding: 6px 12px; font-size: 14px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: default; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 3px 10px; background: var(--accent-soft); color: var(--accent); }
.pill.good { background: var(--good-soft); color: var(--good); }
.grid { display: grid; gap: 14px; }
.notice { background: var(--accent-soft); border: 1px solid #c9d8ee; border-radius: 12px; padding: 10px 14px; margin-bottom: 16px; }
.bar-track { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--good); border-radius: 99px; }

/* ---------- home ---------- */
/* Siyum HaShas countdown */
.siyum { background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #fff; border-radius: 20px; padding: 22px 24px 20px; margin: 4px 0 18px;
  box-shadow: 0 8px 26px rgba(31,78,140,.25); text-align: center; }
.siyum-head { width: fit-content; margin: 0 auto; text-align: center; font-size: 13px; font-weight: 600; color: #dbe8fa;
  background: rgba(255,255,255,.16); border-radius: 16px; padding: 3px 12px; }
.siyum-title { font: 800 42px/1.15 "Noto Sans Hebrew", var(--display); margin: 10px 0 14px; }
.countdown { display: flex; justify-content: center; gap: 12px; } /* days first in reading order: on the right in Yiddish */
.countdown div { min-width: 84px; background: rgba(255,255,255,.12); border-radius: 14px; padding: 10px 8px 8px; }
.countdown b { display: block; font: 800 38px/1 var(--display); font-variant-numeric: tabular-nums; }
.countdown span { font-size: 12px; color: #dbe8fa; }
.siyum-date { margin-top: 14px; font-size: 16px; }
.siyum-bar { height: 8px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; margin: 12px auto 6px; max-width: 520px; direction: ltr; }
.siyum-bar div { height: 100%; background: #fff; border-radius: 99px; }
.siyum-left { font-size: 14px; color: #dbe8fa; }
/* invitations: the app, and My learning */
.ctas { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; margin-top: 26px; }
.cta { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.cta h2 { margin: 0 0 6px; font-size: 19px; }
.cta p { margin: 0 0 14px; color: var(--muted); }
.cta-wa { grid-column: 1 / -1; }
.cta-app { background: var(--accent-soft); border-color: #c9d8ee; box-shadow: none; }
/* the heading and the line under it are in Hebrew: right-to-left, lined up with the page */
/* the top of the home page: centered, in Hebrew */
.home-top { text-align: center; direction: rtl; margin: 4px 0 22px; }
.home-h1 { font: 800 36px/1.2 "Noto Sans Hebrew", var(--display); margin: 0 0 8px; }
/* the Yiddish search phrases, shown as a quiet tagline and label */
.home-tags { margin: 0 0 16px; font: 600 15px "Noto Sans Hebrew", var(--sans); color: var(--accent); direction: rtl; text-align: right; }
.yi-label { font: 600 15px "Noto Sans Hebrew", var(--sans); color: var(--muted); margin-inline-start: 6px; }
.home-intro { margin: 0 auto; max-width: 760px; color: var(--muted); font: 600 18px/1.7 "Noto Sans Hebrew", var(--sans); }
/* choose a daf: the first thing on the home page, one tap to the Shas page */
.pick { display: flex; align-items: center; gap: 18px; margin: 6px 0 26px; padding: 22px 24px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pick:hover { border-color: var(--accent); }
/* Reb Avrohom's own worn Shas across the top of the card, edge to edge */
.pick { flex-wrap: wrap; overflow: hidden; }
.pick-photo { flex: 0 0 calc(100% + 48px); width: calc(100% + 48px); height: 150px; margin: -22px -24px 0; position: relative; display: block; }
.pick-photo img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; display: block;
  filter: brightness(1.12) contrast(.94) saturate(.92); } /* a little lighter, to sit in the bright page; the colors stay his */
.pick-text { flex: 1; display: grid; gap: 2px; }
.pick-text b { font: 800 24px "Noto Sans Hebrew", var(--display); direction: rtl; } /* the title is Yiddish */
/* Hebrew reads from the right: the Hebrew names (and the English line under them) sit on the right of these
   cards, the buttons on the left */
.pick-text { text-align: right; order: 2; } .pick .btn { order: 1; }
.pick-text span { color: var(--muted); }
.siyum { margin-top: 30px; }
/* today's Daf Yomi: one card (date, the daf with its buttons, yesterday and tomorrow) */
.dy { padding: 0; overflow: hidden; margin-top: 28px; }
.dy-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 18px 22px 0; }
.dy-head h2 { margin: 0; font-size: 18px; }
.dy-head .muted { font-size: 14px; }
.dy-main { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; padding: 8px 22px 20px; }
.dy .daf-name { font: 800 40px/1.15 "Noto Sans Hebrew", var(--display); direction: rtl; }
.dy-main { flex-direction: row-reverse; } .dy-name { text-align: right; }
.dy #todayProg:not(:empty) { margin-top: 8px; }
.dy .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dy-days { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.dy-days a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 22px; color: inherit; text-decoration: none; }
.dy-days a + a { border-inline-start: 1px solid var(--line); }
.dy-days a:hover { background: var(--bg); }
.dy-days .muted { font-size: 14px; }
.dy-days .he { font-weight: 700; }
.continue-list { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.continue { text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.continue:hover { border-color: var(--accent); }
.continue .he { font-size: 18px; font-weight: 700; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; box-shadow: var(--shadow); }
.stat b { display: block; font: 800 28px var(--display); }
.stat span { font-size: 13px; color: var(--muted); }

/* ---------- shas / masechta ---------- */
.seder h2 { display: flex; gap: 10px; align-items: baseline; }
/* masechtos run right to left, like the order of a sefer (each card keeps its own layout) */
.mas-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); direction: rtl; }
.mas-grid > * { direction: ltr; }
.mas { text-decoration: none; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; display: grid; gap: 6px; box-shadow: var(--shadow); }
.mas:hover { border-color: var(--accent); }
.mas .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.mas .he { font-size: 20px; font-weight: 700; }
.mas .meta { font-size: 13px; color: var(--muted); display: flex; justify-content: space-between; }
.daf-grid { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); direction: rtl; }
.d { position: relative; text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  text-align: center; padding: 8px 0 6px; font: 700 17px "Noto Sans Hebrew", var(--display); }
.d:hover { border-color: var(--accent); }
.d small { display: block; font: 400 11px var(--sans); color: var(--muted); direction: ltr; }
.d.learned { background: var(--good-soft); border-color: #b7e4c7; }
.d.started { background: linear-gradient(to top, var(--partial) var(--p, 0%), var(--card) var(--p, 0%)); }
.d.today { outline: 2px solid var(--accent); outline-offset: 1px; }
.d .sync { position: absolute; top: 3px; inset-inline-end: 4px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin: 10px 0 16px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-inline-end: 5px; border: 1px solid var(--line); }

/* ---------- forms ---------- */
input[type=email], input[type=text] { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; }
input[type=email]:focus, input[type=text]:focus { outline: 2px solid #c9d8ee; border-color: var(--accent); }
label.field { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }

footer { border-top: 1px solid var(--line); padding: 18px 0 30px; color: var(--muted); font-size: 13px; }

@media (max-width: 720px) {
  main.wrap { padding-top: 18px; }
  .dy-main { flex-direction: column; align-items: stretch; }
  .dy .actions .btn { flex: 1; justify-content: center; white-space: nowrap; padding: 10px 12px; }
  .dy-days a { padding: 12px 16px; flex-direction: column; align-items: stretch; gap: 2px; }
  .dy-days .he { text-align: right; }
  .pick { flex-wrap: wrap; padding: 18px; }
  .pick-text, .pick .btn { order: 0; } /* phones: the text, then the button under it */
  .pick-photo { flex-basis: calc(100% + 36px); width: calc(100% + 36px); height: 110px; margin: -18px -18px 0; }
  .pick .btn { width: 100%; justify-content: center; }
  .siyum { padding: 18px 12px 16px; }
  .siyum-title { font-size: 32px; }
  .countdown { gap: 6px; }
  .countdown div { min-width: 0; flex: 1; padding: 8px 4px 6px; }
  .countdown b { font-size: 28px; }
  .countdown span { font-size: 11px; }
  .ctas { grid-template-columns: 1fr; }
  .dy .daf-name { font-size: 34px; }
  h1 { font-size: 25px; }
}
