/* תמלול שיעורים: נייר, דיו ותכלת. האות של ספרי הקודש, וכתב רש"י להערות בשוליים. */

:root {
  --paper: #ffffff;
  --ink: #1b2430;
  --muted: #566170;
  --tekhelet: #24508f;
  --tekhelet-deep: #1a3c6c;
  --wash: #edf2f9;
  --rule: #cdd4dd;
  --error: #a3262a;
  --ok: #2f6b3f;
  --serif: "Frank Ruhl Libre", "David", "Times New Roman", serif;
  --rashi: "Noto Rashi Hebrew", "Frank Ruhl Libre", serif;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.6;
}

a { color: var(--tekhelet); }
a:hover { color: var(--tekhelet-deep); }

:focus-visible { outline: 2px solid var(--tekhelet); outline-offset: 2px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* --- ראש הדף: פסי טלית --- */
.masthead {
  border-top: 14px solid var(--tekhelet);
  position: relative;
  padding: 40px 0 8px;
}
.masthead::before {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--tekhelet);
}

.brand {
  margin: 0 0 28px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--tekhelet);
}
.brand a { color: inherit; text-decoration: none; }

h1 {
  margin: 0;
  font-weight: 900;
  font-size: clamp(2.3rem, 6.2vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.01em;
  max-width: 14ch;
}
.masthead.small h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: 18ch; }

.gloss {
  font-family: var(--rashi);
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.75;
  max-width: 52ch;
  margin: 18px 0 0;
}

/* --- המחירון, כמו מפתח של ספר --- */
.tariff {
  margin: 40px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--ink);
  max-width: 620px;
}
.tariff h2 { margin: 0 0 6px; font-size: 1.15rem; font-weight: 700; }
.tariff dl { margin: 0; }
.tariff .row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 0;
}
.tariff dt { display: flex; flex: 1; align-items: baseline; gap: 10px; margin: 0; }
.tariff dt::after {
  content: "";
  flex: 1;
  border-bottom: 2px dotted var(--rule);
  transform: translateY(-5px);
}
.tariff dd { margin: 0; font-weight: 700; white-space: nowrap; }
.tariff .free dd { color: var(--ok); }
.tariff .note { font-family: var(--rashi); color: var(--muted); font-size: 0.9rem; margin: 10px 0 0; }

@media (min-width: 900px) {
  .masthead-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 64px;
    align-items: end;
  }
  .masthead-grid .tariff { margin: 0; }
}

/* --- פריסה: הטופס ולצידו החשבון --- */
.layout { padding: 48px 0 64px; }
@media (min-width: 900px) {
  .layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 64px;
    align-items: start;
  }
  .bill { position: sticky; top: 24px; }
}

/* --- שלבים, ממוספרים באותיות --- */
.step {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 0 14px;
  padding: 26px 0;
  border-top: 1px solid var(--rule);
}
.step:first-child { border-top: 0; padding-top: 0; }
.letter {
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--tekhelet);
}
.step h2 { margin: 4px 0 14px; font-size: 1.35rem; font-weight: 700; line-height: 1.3; }
/* בטלפון: האות קטנה יותר, כדי שהתוכן יקבל את רוב הרוחב */
@media (max-width: 600px) {
  .step { grid-template-columns: 30px minmax(0, 1fr); gap: 0 10px; }
  .letter { font-size: 1.9rem; }
}

.hint { color: var(--muted); font-size: 0.92rem; }
.rashi { font-family: var(--rashi); }

/* --- קובץ --- */
.file-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 28px 14px;
  border: 2px dashed var(--rule);
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.file-drop:hover, .file-drop:focus-within { border-color: var(--tekhelet); background: var(--wash); }
.file-drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
#file-label { font-weight: 700; font-size: 1.1rem; color: var(--tekhelet); overflow-wrap: anywhere; }

/* --- כמה שיעורים: רשימה ממוספרת, כמו תוכן עניינים --- */
.folder-pick { margin: 8px 0 0; }
.folder-pick .link-button { display: inline-block; padding: 4px 0; font-size: 0.98rem; }
.file-list { list-style: none; counter-reset: lesson; margin: 14px 0 0; padding: 0; border-top: 1px solid var(--rule); }
.file-list li {
  counter-increment: lesson;
  display: grid;
  grid-template-columns: 1.8em minmax(0, 1fr) auto;
  grid-template-areas: "num name remove" "num info remove";
  align-items: center;
  column-gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.file-list li::before { content: counter(lesson) "."; grid-area: num; color: var(--tekhelet); font-weight: 700; text-align: center; align-self: start; }
.file-list .name { grid-area: name; font-weight: 500; overflow-wrap: anywhere; line-height: 1.35; }
.file-list .info { grid-area: info; font-family: var(--rashi); font-size: 0.88rem; color: var(--muted); }
.file-list li.bad .info { color: var(--error); }
.file-list li.bad .name { color: var(--muted); text-decoration: line-through; }
.file-list .remove { grid-area: remove; background: none; border: 0; padding: 6px 4px; font: inherit; font-size: 0.9rem; color: var(--muted); text-decoration: underline; cursor: pointer; }
.file-list .remove:hover:not(:disabled) { color: var(--error); }
.file-list .remove:disabled { cursor: default; opacity: 0.5; }
ul.titles { margin: 4px 0 6px; padding-inline-start: 20px; }

/* --- בחירת שפה --- */
.segmented { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.segmented label { display: block; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; }
.segmented .choice {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 100%;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s;
}
.segmented .choice strong { font-size: 1.08rem; }
.segmented .choice .price { color: var(--muted); font-size: 0.95rem; }
.segmented input:checked + .choice { border: 2px solid var(--tekhelet); padding: 11px 13px; background: var(--wash); }
.segmented input:checked + .choice .price { color: var(--tekhelet-deep); }
.segmented input:focus-visible + .choice { outline: 2px solid var(--tekhelet); outline-offset: 2px; }

/* --- תוספות --- */
.option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px dotted var(--rule);
  cursor: pointer;
}
.option input { margin-top: 6px; width: 19px; height: 19px; accent-color: var(--tekhelet); }
.option-text { display: flex; flex-direction: column; }
.option-text strong { font-weight: 700; }
.option-price { white-space: nowrap; font-weight: 700; color: var(--tekhelet-deep); unicode-bidi: isolate; }
.option-price.free { color: var(--ok); }

/* --- שדות --- */
label.field { display: block; font-weight: 700; margin: 16px 0 6px; }
label.field:first-child { margin-top: 0; }

textarea, input[type=email], input[type=text], input[type=tel], input[type=number], select {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
input[dir=ltr] { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
textarea:focus, input:focus, select:focus { outline: 2px solid var(--tekhelet); outline-offset: 0; border-color: var(--tekhelet); }
textarea:disabled { background: #f4f6f9; color: var(--muted); }
.counter { text-align: left; margin: 4px 0 0; }

.field-error, .form-error { color: var(--error); margin: 8px 0 0; font-weight: 500; }
.field-error:empty, .form-error:empty { display: none; }

/* --- החשבון --- */
.bill {
  border-top: 4px solid var(--ink);
  padding-top: 14px;
}
.bill h2 { margin: 0 0 10px; font-size: 1.35rem; font-weight: 700; }
.bill .empty { font-family: var(--rashi); color: var(--muted); font-size: 0.98rem; margin: 0 0 18px; }
.bill table { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
.bill tr { display: flex; align-items: baseline; gap: 8px; padding: 5px 0; }
.bill td:first-child { display: flex; flex: 1; align-items: baseline; gap: 8px; }
.bill td:first-child::after { content: ""; flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-5px); }
.bill td:last-child { white-space: nowrap; font-weight: 500; unicode-bidi: isolate; }
.bill tfoot tr { border-top: 1px solid var(--ink); margin-top: 6px; padding-top: 10px; font-size: 1.3rem; font-weight: 700; }
.bill tfoot th { font-weight: 700; text-align: right; display: flex; flex: 1; }

.button, button[type=submit] {
  display: block;
  width: 100%;
  padding: 13px 16px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: var(--tekhelet);
  border: 0;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
}
button[type=submit]:hover:not(:disabled) { background: var(--tekhelet-deep); }
button[type=submit]:disabled { background: #a7b3c2; cursor: not-allowed; }

.bar { height: 6px; background: var(--wash); margin-top: 14px; overflow: hidden; }
.fill { height: 100%; width: 0; background: var(--tekhelet); transition: width 0.2s; }

/* --- הבטחת החזר: פס תכלת בשוליים, כמו הערה בצד הדף --- */
.guarantee {
  max-width: 52ch;
  margin: 22px 0 0;
  padding: 12px 16px;
  border-inline-start: 4px solid var(--tekhelet);
  background: var(--wash);
  font-size: 1rem;
  line-height: 1.65;
}
.guarantee strong { color: var(--tekhelet-deep); display: block; font-size: 1.12rem; }
.assure { margin: 12px 0 0; font-size: 0.95rem; color: var(--tekhelet-deep); font-weight: 500; }

/* --- שאלות נפוצות --- */
.faq { margin: 56px 0 0; padding-top: 28px; border-top: 1px solid var(--rule); max-width: 720px; }
.faq h2 { margin: 0 0 12px; font-size: 1.5rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { cursor: pointer; padding: 14px 0; font-weight: 700; font-size: 1.08rem; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--tekhelet); font-weight: 700; font-size: 1.3rem; line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 16px; color: var(--ink); max-width: 62ch; line-height: 1.75; }

/* --- חזרו אליי --- */
.callback { margin: 40px 0 72px; padding-top: 28px; border-top: 1px solid var(--rule); max-width: 640px; }
.callback h2 { margin: 0; font-size: 1.5rem; }
.callback .gloss { margin-top: 4px; }
.callback form { margin-top: 18px; }
.callback-fields { display: grid; gap: 0 20px; }
@media (min-width: 600px) { .callback-fields { grid-template-columns: 1fr 1fr; } }
button.secondary { width: auto; display: inline-block; padding: 10px 22px; background: #fff; color: var(--tekhelet); border: 2px solid var(--tekhelet); }
button.secondary:hover:not(:disabled) { background: var(--wash); color: var(--tekhelet-deep); }
button.secondary:disabled { background: #fff; color: #a7b3c2; border-color: #a7b3c2; cursor: wait; }
.callback-done { color: var(--ok); font-weight: 700; font-size: 1.1rem; margin: 18px 0 0; }

.quote-count { margin: 0 0 10px; font-weight: 700; color: var(--tekhelet-deep); }

.bulk { margin: 18px 0 0; font-size: 0.95rem; color: var(--muted); }
.bulk a { font-weight: 700; }

.done { padding: 48px 0 80px; max-width: 620px; }
.done h2 { color: var(--ok); font-size: 1.8rem; margin: 0 0 8px; }

/* --- טפסים פשוטים: צור קשר ובקשת החזר --- */
.plain { max-width: 640px; padding: 40px 0 64px; }
.plain .group { padding: 22px 0; border-top: 1px solid var(--rule); }
.plain .group:first-child { border-top: 0; padding-top: 0; }
.plain button[type=submit] { margin-top: 22px; }
.plain .segmented { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.radio-line { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.radio-line input { margin-top: 7px; accent-color: var(--tekhelet); }
.spot { display: grid; grid-template-columns: 90px minmax(0, 1fr) auto; gap: 8px; margin: 8px 0; }
.link-button { background: none; border: 0; padding: 6px 0; font: inherit; color: var(--tekhelet); font-weight: 700; cursor: pointer; text-decoration: underline; }
.trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; opacity: 0; pointer-events: none; }

p.field { display: block; font-weight: 700; margin: 16px 0 6px; }
#status { margin: 0 0 48px; max-width: 640px; padding: 14px 16px; border-inline-start: 4px solid var(--ok); background: #eef5f0; display: none; }
#status.ok { display: block; }
#status.error { display: block; border-color: var(--error); background: #f8eded; }

footer.site { border-top: 1px solid var(--rule); padding: 22px 0 40px; color: var(--muted); font-size: 0.95rem; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* --- לוח בקרה --- */
.admin main { padding: 32px 16px 56px; }
.admin-grid { display: grid; gap: 40px; }
@media (min-width: 900px) { .admin-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; } }
.ledger h2, .admin-section h2 { margin: 0 0 8px; font-size: 1.3rem; font-weight: 700; }
.ledger { border-top: 4px solid var(--ink); padding-top: 12px; margin: 0; }
.ledger dl { margin: 0; }
.ledger .row { display: flex; align-items: baseline; gap: 10px; padding: 6px 0; }
.ledger dt { display: flex; flex: 1; align-items: baseline; gap: 10px; margin: 0; }
.ledger dt::after { content: ""; flex: 1; border-bottom: 2px dotted var(--rule); transform: translateY(-5px); }
.ledger dd { margin: 0; font-weight: 700; white-space: nowrap; unicode-bidi: isolate; }
.ledger .row.strong { border-top: 1px solid var(--ink); margin-top: 4px; padding-top: 10px; font-size: 1.2rem; }
.ledger .row.muted { color: var(--muted); }
.ledger .row.muted dd { font-weight: 500; }
.ledger .item { padding: 12px 0; border-bottom: 1px dotted var(--rule); }
.ledger .item p { margin: 0 0 4px; }
.ledger .actions { display: flex; flex-wrap: wrap; gap: 16px; }
.quote { font-family: var(--rashi); border-inline-start: 3px solid var(--rule); padding-inline-start: 10px; margin: 6px 0; }
.empty { font-family: var(--rashi); color: var(--muted); }
.admin-section { margin-top: 48px; }
.admin-section > .ledger { max-width: 560px; }
.table-scroll { overflow-x: auto; border-top: 4px solid var(--ink); }
table.data { width: 100%; border-collapse: collapse; font-size: 0.98rem; }
table.data th { text-align: right; font-weight: 700; padding: 10px 8px; border-bottom: 1px solid var(--ink); white-space: nowrap; }
table.data td { padding: 9px 8px; border-bottom: 1px dotted var(--rule); white-space: nowrap; unicode-bidi: isolate; }
table.data td:nth-child(2) { white-space: normal; min-width: 160px; }
table.data caption { caption-side: bottom; text-align: right; padding: 12px 0; }
footer.site .link-button { margin-inline-end: 20px; }

.ledger .item.pending { border-inline-start: 4px solid var(--tekhelet); padding-inline-start: 12px; background: var(--wash); margin-bottom: 8px; }
button.approve { width: auto; display: inline-block; padding: 8px 16px; font: inherit; font-weight: 700; color: #fff; background: var(--tekhelet); border: 0; border-radius: 3px; cursor: pointer; }
button.approve:hover:not(:disabled) { background: var(--tekhelet-deep); }
button.approve:disabled { background: #a7b3c2; cursor: wait; }
