/* ספר תורה לבת עין – תכלת צפת, קלף, זהב לאותיות שהוקדשו */
@font-face { font-family: 'Heebo'; src: url('../fonts/heebo/heebo-hebrew-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('../fonts/heebo/heebo-hebrew-500-normal.woff2') format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Heebo'; src: url('../fonts/heebo/heebo-hebrew-700-normal.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Stam'; src: url('../fonts/StamAshkenazCLM.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Frank'; src: url('../fonts/FrankRuehlCLM-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Frank'; src: url('../fonts/FrankRuehlCLM-Medium.ttf') format('truetype'); font-weight: 400; font-display: swap; }

:root {
  --tchelet: #1b3f73;        /* כחול דלתות צפת */
  --tchelet-2: #2c5a98;
  --wash: #e3ecf6;
  --page: #f6f8fb;
  --klaf: #f2e7cf;
  --ink: #1d1a15;
  --muted: #5d6676;
  --gold: #b8861b;
  --gold-soft: #f1dfae;
  --line: #d3dce8;
  --held: #b9c2cf;
  --ok: #1f7a46;
  --danger: #a3332b;
  --r-sm: 6px;
  --r-lg: 14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font-family: 'Heebo', system-ui, sans-serif; font-size: 17px; line-height: 1.55;
}
a { color: var(--tchelet-2); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.wrap { max-width: 760px; margin: 0 auto; padding: 0 18px; }
.hidden { display: none !important; }

/* כותרת */
.top { background: var(--tchelet); color: #fff; }
.top .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-family: 'Frank', serif; font-weight: 700; font-size: 22px; color: #fff; text-decoration: none; white-space: nowrap; }
.top nav { white-space: nowrap; }
@media (max-width: 520px) { .top nav .ext { display: none; } .top nav a { margin-inline-start: 12px; } .brand { font-size: 20px; } }
.top nav a { color: #dbe6f5; text-decoration: none; margin-inline-start: 16px; font-size: 15px; }
.top nav a:hover { color: #fff; }

/* מד התקדמות קבוע */
.meter { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.meter .wrap { display: flex; align-items: center; gap: 12px; height: 44px; font-size: 14px; color: var(--muted); }
.meter .bar { flex: 1; height: 8px; background: var(--wash); border-radius: 4px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--gold); width: 0; transition: width .6s ease; }
.meter b { color: var(--ink); font-weight: 700; }

.banner { background: var(--gold-soft); color: #5b420c; text-align: center; padding: 8px 12px; font-weight: 500; font-size: 15px; }

/* פתיח */
.hero { padding: 28px 0 8px; }
.hero h1 { font-family: 'Frank', serif; font-weight: 700; font-size: clamp(32px, 7vw, 48px); line-height: 1.1; margin: 0 0 10px; color: var(--tchelet); }
.hero p.lead { margin: 0 0 6px; font-size: 18px; max-width: 34em; }
.hero p.raffle { margin: 0; color: var(--muted); }

/* רצועת הקלף החיה – הדבר שזוכרים */
.scroll {
  margin: 22px 0 6px; background: var(--klaf); border-radius: var(--r-sm);
  border-inline: 10px solid #d9c9a3; padding: 18px 20px 14px; position: relative;
  box-shadow: inset 0 0 40px rgba(120, 90, 30, .12);
}
.scroll .text { font-family: 'Stam', serif; font-size: 27px; line-height: 1.75; text-align: justify; color: #2a241b; }
.scroll .cap { font-size: 13px; color: #7a6a4a; margin-top: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.scroll .cap a { white-space: nowrap; }
.l.s2 { color: var(--gold); text-shadow: 0 0 1px rgba(184, 134, 27, .4); }
.l.s1, .l.s3 { color: var(--held); }
.l.flash { animation: flash 1.6s ease; }
@keyframes flash { 0% { color: #fff; text-shadow: 0 0 12px var(--gold); } 100% { } }

/* פעולות ראשיות */
.actions { margin: 26px 0 8px; display: grid; gap: 10px; }
.action {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 16px 18px; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
}
.action strong { font-size: 19px; }
.action span { color: var(--muted); font-size: 15px; grid-column: 1; }
.action em { font-style: normal; grid-row: 1 / span 2; grid-column: 2; color: var(--tchelet); font-weight: 700; }
.action.primary { background: var(--tchelet); border-color: var(--tchelet); color: #fff; }
.action.primary span { color: #c9d8ee; }
.action.primary em { color: var(--gold-soft); }
.action:hover { border-color: var(--tchelet-2); }

h2 { font-family: 'Frank', serif; font-size: 26px; margin: 34px 0 8px; color: var(--tchelet); font-weight: 700; }
.note { color: var(--muted); font-size: 15px; }

/* מפת פרשיות */
.map { display: flex; gap: 2px; height: 70px; align-items: stretch; direction: rtl; }
.map a { position: relative; background: var(--wash); border-radius: 2px; display: block; min-width: 3px; }
.map a i { position: absolute; bottom: 0; inset-inline: 0; background: var(--gold); border-radius: 2px; }
.map a:hover { outline: 2px solid var(--tchelet-2); }
.books { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); margin-top: 4px; }

/* פיד */
.feed { list-style: none; padding: 0; margin: 8px 0 0; }
.feed li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.feed time { color: var(--muted); font-size: 13px; margin-inline-start: 6px; }

/* טפסים וכפתורים */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  background: var(--tchelet); color: #fff; padding: 12px 20px; border-radius: 10px; font-weight: 700; font-size: 17px;
  text-decoration: none; min-height: 48px;
}
.btn.gold { background: var(--gold); }
.btn.ghost { background: transparent; color: var(--tchelet); border: 1.5px solid var(--tchelet); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 15px; }
.btn[disabled] { opacity: .55; cursor: default; }
.btn.block { width: 100%; }
label { display: block; font-weight: 500; margin: 14px 0 4px; }
label small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=tel], input[type=email], input[type=number], select, textarea {
  width: 100%; padding: 11px 12px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; min-height: 48px;
}
input:focus, select:focus, textarea:focus { border-color: var(--tchelet-2); outline: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; margin-top: 2px; flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.err { color: var(--danger); font-weight: 500; margin-top: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; cursor: pointer; font-size: 15px; }
.chip.on { background: var(--tchelet); color: #fff; border-color: var(--tchelet); }

/* תוצאות שם */
.result { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; margin-top: 14px; }
.result .ref { color: var(--muted); font-size: 14px; }
.result .verse { font-family: 'Stam', serif; font-size: 28px; line-height: 1.7; margin: 8px 0 12px; }
.l.name { color: var(--tchelet-2); border-bottom: 3px solid var(--tchelet-2); }
.result .buy { display: flex; flex-wrap: wrap; gap: 8px; }

/* עיון בתורה */
.picker { position: sticky; top: 44px; z-index: 15; background: var(--page); padding: 10px 0 8px; border-bottom: 1px solid var(--line); }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 6px 10px; border-radius: 8px; cursor: pointer; white-space: nowrap; color: var(--muted); font-weight: 500; }
.tabs button.on { background: var(--wash); color: var(--tchelet); }
.parashot { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: thin; }
.parashot button { flex: none; border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; font-size: 15px; }
.parashot button.on { border-color: var(--tchelet); background: var(--tchelet); color: #fff; }
.modes { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14px; color: var(--muted); }
.seg { display: inline-flex; border: 1.5px solid var(--tchelet); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 5px 14px; cursor: pointer; color: var(--tchelet); font-weight: 500; }
.seg button.on { background: var(--tchelet); color: #fff; }
.torah { font-family: 'Stam', serif; font-size: 29px; line-height: 1.9; text-align: justify; background: var(--klaf); padding: 18px; border-radius: var(--r-sm); margin: 12px 0 120px; border-inline: 10px solid #d9c9a3; }
.torah .vn { font-family: 'Heebo', sans-serif; font-size: 12px; color: #8a7a5a; vertical-align: super; margin-inline: 3px; user-select: none; }
.torah .pt { display: block; height: 10px; }
.torah .st { display: inline-block; width: 2.2em; }
.torah .ph { display: block; font-family: 'Frank', serif; font-weight: 700; font-size: 20px; color: var(--tchelet); text-align: center; margin: 4px 0 8px; }
.l { cursor: pointer; border-radius: 3px; }
.l.big { font-size: 1.35em; }
.l.small { font-size: .7em; }
.l.sel { background: var(--tchelet); color: #fff; }
.l.s0:hover { background: var(--gold-soft); }
.vs.focus { background: rgba(44, 90, 152, .12); border-radius: 4px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-inline-end: 4px; vertical-align: middle; }
.legend .f::before { background: #2a241b; } .legend .g::before { background: var(--gold); } .legend .h::before { background: var(--held); } .legend .m::before { background: var(--tchelet); }

/* סל תחתון */
.cart { position: fixed; bottom: 0; inset-inline: 0; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(27, 63, 115, .12); z-index: 30; }
.cart .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.cart .sum { font-size: 15px; }
.cart .sum b { font-size: 19px; }

/* קופה */
.summary { background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; margin-top: 16px; }
.summary .big { font-size: 26px; font-weight: 700; color: var(--tchelet); }
.timer { font-size: 14px; color: var(--muted); }
.timer.low { color: var(--danger); font-weight: 700; }
fieldset { border: 0; padding: 0; margin: 0; }
.radios label { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 6px 0; }
.radios input { width: 20px; height: 20px; }

/* תודה */
.done { text-align: center; padding-top: 24px; }
.done h1 { font-family: 'Frank', serif; color: var(--tchelet); font-size: 38px; margin: 0 0 6px; }
.ticket { display: inline-block; border: 2px dashed var(--gold); color: #6b4d0d; border-radius: 12px; padding: 10px 18px; margin: 14px 0; font-size: 18px; }
.ticket b { font-size: 26px; }
.share { display: grid; gap: 10px; max-width: 420px; margin: 18px auto; }
.wa { background: #1f8f4c; }

/* קיר שותפים */
.wall { columns: 2 240px; column-gap: 24px; }
.wall div { break-inside: avoid; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.wall b { display: block; }

/* הודעות קופצות */
.toast {
  position: fixed; bottom: 18px; inset-inline-start: 18px; max-width: 340px; background: #fff; border: 1px solid var(--line);
  border-inline-start: 4px solid var(--gold); border-radius: 10px; padding: 12px 14px; box-shadow: 0 8px 24px rgba(27, 63, 115, .18);
  z-index: 40; font-size: 15px; animation: rise .35s ease;
}
body.has-cart .toast { bottom: 92px; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.modal { position: fixed; inset: 0; background: rgba(15, 30, 55, .55); display: grid; place-items: center; z-index: 50; padding: 18px; }
.modal .box { background: #fff; border-radius: 16px; padding: 24px; max-width: 420px; width: 100%; text-align: center; }
.modal h3 { font-family: 'Frank', serif; font-size: 26px; color: var(--tchelet); margin: 0 0 8px; }
.modal .x { background: none; border: 0; color: var(--muted); margin-top: 10px; cursor: pointer; text-decoration: underline; }

footer { color: var(--muted); font-size: 13px; padding: 40px 0 30px; text-align: center; }
.spinner { display: inline-block; width: 18px; height: 18px; border: 3px solid var(--wash); border-top-color: var(--tchelet); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

input[dir=ltr] { text-align: right; }
