/* ==========================================================================
   book.css — עמוד הספר ועמוד הגרסה המוקדמת (נבנים ע"י tools/build-book.py)
   נטען אחרי styles.css. מובייל קודם (רוב הכניסות מאינסטגרם, ~375px).
   מאפיינים לוגיים בלבד: העמוד בעברית RTL ובאנגלית LTR.
   ========================================================================== */

:root {
  --glow: #F5CB5C;                         /* צהוב-זהב בוהק לכריכה */
  --glow-a55: rgba(245, 203, 92, 0.55);
  --glow-a25: rgba(245, 203, 92, 0.25);
  --err: #ff9b8a;
}

/* hidden חייב לגבור על display שאנחנו מגדירים כאן */
.ee-pop[hidden], .ee-form[hidden], .ee-ok[hidden], .book-wait__buy[hidden] { display: none !important; }

/* ---------- כריכה: זוהר צהוב מסביב בלי מסגרת חדה (בקשת הבעלים 12.10) ---------- */
.book__cover:has(img) {
  box-shadow:
    0 0 50px -4px var(--glow-a55),
    0 0 120px 10px var(--glow-a25),
    0 2.5rem 4rem -1.5rem rgba(0, 0, 0, 0.7);
}
.book__media::after {                      /* הילה רכה מאחורי כל הכריכה, לא רק מתחת */
  inset-block: -6% -10%;
  inset-inline: 0;
  margin-inline: auto;
  width: min(340px, 100%);
  height: auto;
  background: radial-gradient(ellipse at center, rgba(245, 203, 92, 0.45), rgba(201, 162, 107, 0.18) 45%, transparent 70%);
  filter: blur(28px);
}
@media (min-width: 900px) { .book__media::after { width: min(460px, 100%); } }

/* ---------- תיאור הספר ליד הכריכה ---------- */
.book-desc { margin-top: 2rem; color: var(--text-2); line-height: 1.75; }
.book-desc p { margin: 0 0 1.1rem; }
.book-desc__lead {
  font-family: var(--font-heading);
  font-size: clamp(1.35rem, 5vw, 1.6rem);
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}
.book-desc__turn { font-weight: 700; color: var(--text); }
.book-desc__steps { list-style: none; margin: 0 0 1.25rem; padding: 0; display: grid; gap: 0.6rem; }
.book-desc__steps li { position: relative; padding-inline-start: 1.4rem; font-weight: 600; color: var(--text); }
.book-desc__steps li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.68em;
  width: 0.5rem; height: 0.5rem;
  background: var(--accent);
  transform: rotate(45deg);
}
.book-desc__close { color: var(--accent); font-weight: 700; font-size: 1.1rem; }

/* ---------- עמודת קריאה ---------- */
.reader {
  max-width: 38rem;
  margin: 4rem auto 0;
  font-size: 1.125rem;
  line-height: 1.85;
  color: var(--text-2);
}
@media (min-width: 900px) { .reader { font-size: 1.2rem; margin-top: 6rem; } }
.reader p { margin: 0 0 1em; }
.reader strong { color: var(--text); font-weight: 700; }
.reader em { font-style: italic; }
.reader h3 { font-family: var(--font-heading); font-weight: 700; font-size: 1.3rem; line-height: 1.3; color: var(--text); margin: 1.8em 0 0.6em; }
.reader .rule, .reader .ch-rule { width: 3.2em; border-top: 2px solid var(--accent); margin: 0.9em 0 1.2em; }

/* תוכן העניינים */
.toc { text-align: center; margin-bottom: 4rem; }
.toc h2 { font-weight: 800; font-size: 1.6rem; line-height: 1.2; color: var(--text); margin-bottom: 0.4em; }
.toc .rule { margin-inline: auto; }
.toc table { border-collapse: collapse; margin: 0 auto; max-width: 100%; font-size: 15px; line-height: 1.6; color: var(--text); }
.toc td { padding: 0.28em 0; vertical-align: baseline; }
.toc td.opening { font-weight: 700; font-size: 1.2em; padding-bottom: 0.6em; text-align: center; }
.toc td.name { padding-inline: 0.5em; text-align: left; }   /* האותיות הגדולות בטור ישר: INTENTIONAL */
.toc td.bar { width: 1px; padding: 0; background: var(--accent-50); }
.toc td.ctx { font-weight: 600; white-space: nowrap; padding-inline: 0.5em; }
.toc td.tm { white-space: nowrap; padding-inline: 0.5em; font-variant-numeric: tabular-nums; }
.toc .cap { font-weight: 800; color: var(--accent); font-size: 1.15em; }
.toc .bet { font-weight: 800; color: var(--accent); }      /* ה-ב בתחילת כל מקום, כמו האות הגדולה באנגלית */
.book-toc { margin-top: 5rem; }
.book-toc .toc { margin-bottom: 0; }
.toc .h, .toc .ap { color: var(--text-3); }
.toc .ap { font-size: 0.78em; }
.toc .m { font-weight: 600; }
.toc a.in { border-bottom: 2px solid var(--accent); font-weight: 700; }
.toc a:hover { color: var(--accent-hover); }
.toc .note { font-size: 0.85rem; color: var(--text-3); margin: 1em 0 0; }
.toc .note b { color: var(--text); border-bottom: 2px solid var(--accent); }
@media (min-width: 480px) {
  .toc table { font-size: 17px; }
  .toc td.name, .toc td.ctx, .toc td.tm { padding-inline: 0.85em; }
}

/* פתיח ופרקים */
.preface, .reader > section[data-chapter] { padding-top: 1rem; }
.reader > section[data-chapter] { margin-top: 5rem; padding-top: 5rem; border-top: 1px solid var(--line); }
.opener { margin: 0 0 1.5rem; }
.ch-kicker { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin: 0 0 0.5em !important; }
.reader .ch-title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: clamp(2.2rem, 9vw, 3rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow-wrap: anywhere;
}
[dir="rtl"] .reader .ch-title { text-align: right; }   /* כותרת אנגלית בתוך עמוד עברי */
.reader p.who { margin-bottom: 0.35em; }
.reader p.who-end { margin-top: 1em; }

.epigraph { margin: 1.5rem 0 0; padding: 0; }
.epigraph .ep-he { color: var(--text); font-weight: 600; font-size: 1.05em; line-height: 1.6; margin-bottom: 0.4em; }
.epigraph .ep-en { font-style: italic; color: var(--text-3); font-size: 0.92em; line-height: 1.55; }
.reader p.stamp {
  display: inline-block;
  margin: 1rem 0 1.25rem;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.challenge {
  margin: 2.5rem 0;
  padding: 1.25rem 1.25rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--accent);
  border-radius: 6px;
}
.challenge .c-head { font-weight: 800; color: var(--text); margin-bottom: 0.5em; }
.reader bdi, .reader .atom { font: inherit; color: inherit; }

/* ---------- באנר הגרסה המוקדמת: הרגע החשוב במשפך ---------- */
.ee-banner, .book-wait {
  position: relative;
  overflow: hidden;
  max-width: 44rem;
  margin: 5rem auto;
  padding: 2.25rem 1.25rem 2rem;
  text-align: center;
  background: var(--surface);
  border-radius: 12px;
}
.ee-banner {
  border: 1px solid var(--accent-50);
  box-shadow: 0 0 0 1px rgba(245, 203, 92, 0.15), 0 1.5rem 4rem -1rem rgba(0, 0, 0, 0.55), 0 0 60px -10px rgba(245, 203, 92, 0.35);
}
.ee-banner::before {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 80% at 50% -20%, rgba(245, 203, 92, 0.32), transparent 60%);
  pointer-events: none;
}
.ee-banner > *, .book-wait > * { position: relative; }
@media (min-width: 640px) { .ee-banner, .book-wait { padding: 3rem 2.5rem 2.5rem; } }

.ee-kick {
  margin: 0 0 0.6em;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.ee-banner h2, .book-wait h2, .ee-pop h2 {
  font-weight: 800;
  font-size: clamp(1.75rem, 7vw, 2.4rem);
  line-height: 1.15;
  color: var(--text);
  margin-bottom: 0.5em;
  overflow-wrap: anywhere;
}
.ee-lead { max-width: 30em; margin: 0 auto 1.5rem; font-size: 1.05rem; line-height: 1.65; color: var(--text-2); }
.ee-ok { margin: 0.5rem 0 0; font-size: 1.15rem; font-weight: 700; color: var(--accent); }

/* ---------- טופס מייל ---------- */
.ee-form { display: flex; flex-direction: column; gap: 0.65rem; max-width: 420px; margin: 0 auto; }
.ee-form input {
  width: 100%;
  min-height: 52px;
  padding: 0 1rem;
  font: inherit;
  font-size: 17px;                         /* 16px+ — בלי זום אוטומטי באייפון */
  color: #1d1d1b;
  background: #fff;
  border: 2px solid transparent;
  border-radius: 6px;
}
.ee-form input::placeholder { color: #6b7577; }
.ee-form input[aria-invalid="true"] { border-color: var(--err); outline: 2px solid var(--err); outline-offset: 1px; }
.ee-form__btn {
  width: 100%;
  min-height: 54px;
  padding: 0.9rem 1rem;
  border-radius: 6px;
  font-size: 1.1rem;
  font-weight: 800;
  white-space: normal;
  line-height: 1.25;
  background: linear-gradient(180deg, #E2BE80, var(--accent));
  color: var(--bg);
  box-shadow: 0 0.5rem 1.5rem -0.5rem rgba(245, 203, 92, 0.5);
  transition: filter 150ms, transform 150ms;
}
.ee-form__btn:hover { filter: brightness(1.07); transform: translateY(-1px); }
.ee-form input:focus-visible, .ee-form__btn:focus-visible, .ee-pop__x:focus-visible, .ee-pop__later:focus-visible,
.ee-choice:focus-visible, .ee-end__card:focus-visible { outline: 3px solid var(--glow); outline-offset: 2px; }
.ee-form__consent { margin: 0.2rem 0 0; font-size: 0.8rem; line-height: 1.5; color: var(--text-3); }
.ee-form__status { margin: 0; min-height: 1.2em; font-size: 0.95rem; color: var(--text-2); }
.ee-form__status.is-error { color: var(--err); font-weight: 600; }

/* ---------- חלון קופץ: גיליון תחתון במובייל, כרטיס במחשב ---------- */
html.ee-pop-lock { overflow: hidden; }
.ee-pop {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(8, 20, 23, 0.6);
  opacity: 0;
  transition: opacity 250ms;
}
.ee-pop.is-open { opacity: 1; }
.ee-pop__card {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 92svh;
  overflow-y: auto;
  padding: 2.5rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  text-align: center;
  background: var(--surface);
  border-top: 2px solid var(--accent);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -1rem 3rem rgba(0, 0, 0, 0.5);
  transform: translateY(40px);
  transition: transform 300ms var(--ease-out);
}
.ee-pop.is-open .ee-pop__card { transform: none; }
@media (min-width: 640px) {
  .ee-pop { align-items: center; padding: 1.5rem; }
  .ee-pop__card { padding: 3rem 2.25rem 2rem; border: 1px solid var(--accent-50); border-radius: 12px; }
}
.ee-pop__x {
  position: absolute;
  inset-block-start: 0.4rem;
  inset-inline-end: 0.4rem;
  min-width: 44px; min-height: 44px;
  font-size: 1.8rem; line-height: 1;
  color: var(--text-3);
}
.ee-pop__later {
  margin-top: 0.75rem;
  min-height: 44px;
  font-size: 0.95rem;
  color: var(--text-3);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.ee-pop__x:hover, .ee-pop__later:hover { color: var(--accent); }

/* ---------- הכותבים ---------- */
.book-authors { max-width: 56rem; margin: 6rem auto 0; text-align: center; }
.book-authors h2 { font-weight: 800; font-size: clamp(1.9rem, 6vw, 2.4rem); line-height: 1.15; margin-bottom: 2.5rem; }
.book-authors__grid { display: grid; gap: 3rem; }
@media (min-width: 700px) { .book-authors__grid { grid-template-columns: 1fr 1fr; } }
.author { margin: 0; display: flex; flex-direction: column; align-items: center; }
.author__photo {
  width: 140px; height: 140px;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 25%;
  box-shadow: 0 0 0 4px var(--bg), 0 0 0 6px var(--accent), 0 1rem 2.5rem -0.5rem rgba(0, 0, 0, 0.6);
  margin-bottom: 1.5rem;
}
@media (min-width: 700px) { .author__photo { width: 160px; height: 160px; } }
.author__name { font-family: var(--font-heading); font-weight: 700; font-size: 1.3rem; color: var(--text); margin: 0 0 0.5rem; }
.author__bio { max-width: 26rem; margin: 0 auto; color: var(--text-2); line-height: 1.7; text-wrap: balance; }

/* ---------- רשימת המתנה (2027): כמו הבאנר, שקט יותר ---------- */
.book-wait { border: 1px solid var(--line-strong); margin-top: 6rem; }
.book-wait__buy { justify-content: center; margin: 0 0 1.5rem; }

/* ---------- עמוד הגרסה המוקדמת ---------- */
.ee-hero { position: relative; isolation: isolate; text-align: center; padding: 0 0 1rem; }
.ee-hero::before {                         /* הילה מאחורי הכריכה הקטנה */
  content: "";
  position: absolute; z-index: -1;
  inset-block-start: -1rem;
  inset-inline: 0;
  margin-inline: auto;
  width: min(320px, 100%);
  height: 380px;
  background: radial-gradient(ellipse at center, rgba(245, 203, 92, 0.35), transparent 70%);
  filter: blur(24px);
}
.ee-hero .ee-hero__cover { max-width: min(220px, 60vw); margin: 0 auto 2.5rem; }
.ee-hero h1 { font-weight: 800; font-size: clamp(2.2rem, 9vw, 3.5rem); line-height: 1.05; overflow-wrap: anywhere; }
.ee-hero .book__authors { margin-top: 0.75rem; color: var(--text-2); }
.ee-hero__ask { margin: 2.5rem 0 1.25rem; font-weight: 700; font-size: clamp(1.4rem, 5.5vw, 1.9rem); line-height: 1.25; color: var(--text); }

.ee-choices { display: grid; gap: 0.85rem; max-width: 46rem; margin: 0 auto; }
@media (min-width: 700px) { .ee-choices { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.ee-choice {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  min-height: 64px;
  padding: 0.85rem 1rem;
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-align: center;
  transition: transform 150ms, box-shadow 200ms, background-color 200ms;
}
.ee-choice:hover { transform: translateY(-2px); box-shadow: 0 0 30px -6px var(--glow-a55); }
.ee-choice__t { font-size: 1.15rem; line-height: 1.25; }
.ee-choice__n { font-size: 0.8rem; font-weight: 500; color: var(--text-3); }
.ee-choice--main {
  min-height: 72px;
  border-color: var(--glow);
  background: linear-gradient(160deg, #F7D57A 0%, #E2BE80 45%, var(--accent) 100%);
  color: var(--bg);
  box-shadow: 0 0 0 1px rgba(245, 203, 92, 0.4), 0 0.75rem 2rem -0.5rem var(--glow-a55);
}
.ee-choice--main .ee-choice__t { font-size: 1.25rem; font-weight: 800; }
.ee-choice--main::after {                  /* ברק שעובר על הכפתור הראשי */
  content: "";
  position: absolute;
  inset-block: 0;
  inset-inline-start: -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.55), transparent);
  transform: skewX(-20deg);
  animation: ee-shine 3.2s ease-in-out 1s infinite;
  pointer-events: none;
}
@keyframes ee-shine { 0%, 60% { inset-inline-start: -60%; } 100% { inset-inline-start: 130%; } }
.ee-choice--ghost { background: transparent; border-color: var(--line-strong); }
.ee-choice--ghost:hover { border-color: var(--accent); }
.ee-free { margin: 1.25rem 0 0; color: var(--accent); font-weight: 700; text-align: center; }

/* כרטיסי הסיום */
.ee-end { display: grid; gap: 1rem; margin: 5rem 0 0; padding-top: 4rem; border-top: 1px solid var(--line); }
@media (min-width: 700px) { .ee-end { grid-template-columns: 1fr 1fr; } }
.ee-end__card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  transition: border-color 200ms, transform 150ms;
}
.ee-end__card:hover { border-color: var(--accent); transform: translateY(-2px); }
.ee-end__q { font-family: var(--font-heading); font-weight: 700; font-size: 1.35rem; line-height: 1.3; color: var(--text); }
.ee-end__cta { font-size: 0.9rem; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }

/* ---------- שורת האתר בתחתית ---------- */
.book-siteline {
  margin: 0;
  padding: 1.25rem 1rem 1.75rem;
  text-align: center;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.book-siteline a:hover { color: var(--accent); }

/* ---------- בלי תנועה למי שביקש ---------- */
@media (prefers-reduced-motion: reduce) {
  .ee-pop, .ee-pop__card, .ee-form__btn, .ee-choice, .ee-end__card { transition: none; }
  .ee-choice--main::after { animation: none; display: none; }
}

/* ---------- הדפסה ---------- */
@media print {
  .header, .nav, .footer, .skip-link, .ee-banner, .ee-pop, .ee-choices, .book-wait, .book-authors,
  .book__actions, .ee-end { display: none !important; }
  html, body { background: #fff !important; }
  .reader, .reader * { color: #000 !important; }
  .reader { max-width: none; font-size: 12pt; line-height: 1.6; }
  .challenge { background: none; border-color: #999; }
  .book__cover:has(img) { box-shadow: none; }
  .book__media::after, .ee-hero::before { display: none; }
  .book-siteline { position: fixed; bottom: 0; inset-inline: 0; padding: 4pt; color: #555; }
}
