/* Layout concept: a publisher's catalogue page. One idea per screen, set on the book's own paper,
   right-aligned editorial type, hairline rules instead of boxes. The brick red appears once per screen. */
:root {
  /* Color: from the book's brand kit. Single light "paper" world by design (the book itself is paper). */
  --paper: #F2EFE8;
  --cover-paper: #F4F1EA;
  --sand: #E6DFD0;
  --ink: #14161A;
  --graphite: #5E584C;      /* meta text; 6:1 on paper */
  --brick: #B53F17;         /* cover accent, deepened slightly for text contrast */
  --rule: #CFC8B8;
  --rule-strong: #A39B8B;
  --white: #FBFAF6;
  --error: #9E2A0B;

  /* Type */
  --display: "Frank Ruhl Libre", "David Libre", "Times New Roman", serif;
  --body: "IBM Plex Sans Hebrew", "Arial Hebrew", "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-meta: 0.8125rem;
  --fs-body: 1.0625rem;
  --fs-lede: clamp(1.1875rem, 1.05rem + 0.6vw, 1.4375rem);
  --fs-h3: clamp(1.375rem, 1.2rem + 0.7vw, 1.75rem);
  --fs-h2: clamp(2rem, 1.5rem + 2.2vw, 3.25rem);
  --fs-h2-lg: clamp(2.375rem, 1.6rem + 3.2vw, 4.25rem);
  --fs-hero: clamp(2.75rem, 1.6rem + 5.4vw, 6rem);

  --gutter: clamp(20px, 5vw, 64px);
  --section: clamp(96px, 12vw, 176px);
  --maxw: 1240px;

  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: var(--fs-body);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.site { background: var(--paper); color: var(--ink); overflow-x: clip; }
img { max-width: 100%; height: auto; display: block; }
p { margin: 0; }
h1, h2, h3 { margin: 0; font-weight: 500; text-wrap: balance; }
s { text-decoration: none; }
[hidden] { display: none !important; }
.ruled { position: relative; }
.ruled::before { content: ""; position: absolute; top: 0; inset-inline: var(--gutter); border-top: 1px solid var(--rule); }

.wrap {
  width: 100%;
  max-width: calc(var(--maxw) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }

.skip {
  position: absolute; inset-inline-start: 12px; top: -60px; z-index: 50;
  background: var(--ink); color: var(--paper); padding: 10px 16px; text-decoration: none;
}
.skip:focus { top: calc(12px + env(safe-area-inset-top, 0px)); }

/* ---------- Shared type ---------- */
.eyebrow, .meta {
  font-family: var(--mono);
  font-size: var(--fs-meta);
  letter-spacing: 0.02em;
  color: var(--graphite);
  line-height: 1.5;
}
.h2 { font-family: var(--display); font-size: var(--fs-h2); line-height: 1.12; letter-spacing: -0.005em; }
.h2--lg { font-size: var(--fs-h2-lg); line-height: 1.05; }
.h3 { font-family: var(--display); font-size: var(--fs-h3); line-height: 1.25; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: 8px 32px;
  padding-bottom: clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--ink);
}

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 56px; padding: 0 30px;
  font-family: var(--body); font-size: 1.0625rem; font-weight: 500; line-height: 1.2;
  text-decoration: none; text-align: center;
  border: 1px solid transparent; border-radius: 0; cursor: pointer;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn--primary { background: var(--ink); color: var(--paper); }
.btn--primary:hover { background: #2B2E34; }
.btn--primary[disabled] { background: var(--graphite); cursor: progress; }
.btn--quiet {
  min-height: 44px; padding: 0 2px;
  color: var(--ink); background: transparent;
  border-bottom: 1px solid var(--rule-strong);
}
.btn--quiet:hover { border-bottom-color: var(--ink); }
.btn--block { width: 100%; }
.link { color: var(--ink); text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* ---------- Masthead ---------- */
.masthead {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 22px;
}
.masthead__title {
  font-family: var(--display); font-size: 1.0625rem; line-height: 1.3;
  color: var(--ink); text-decoration: none; min-width: 0;
}
.masthead__nav { display: flex; gap: 28px; flex-shrink: 0; }
.masthead__nav a {
  font-size: 0.9375rem; color: var(--ink); text-decoration: none;
  padding-block: 10px; border-bottom: 1px solid transparent;
}
.masthead__nav a:hover { border-bottom-color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  grid-template-areas: "text book" "actions book";
  column-gap: clamp(32px, 7vw, 120px);
  row-gap: 48px;
  align-items: end;
  padding-block: clamp(40px, 7vw, 104px) var(--section);
}
.hero__text { grid-area: text; align-self: end; }
.hero__book { grid-area: book; margin: 0; align-self: center; justify-self: center; width: 100%; max-width: 420px; }
.hero__actions { grid-area: actions; align-self: start; display: grid; gap: 22px; }

.hero .eyebrow { margin-bottom: 28px; }
.hero__title {
  font-family: var(--display); font-weight: 500;
  font-size: var(--fs-hero); line-height: 1.02; letter-spacing: -0.012em;
}
.hero__line { display: block; }
.hero__days { margin-top: 0.12em; }
.hero__days em { font-style: normal; color: var(--brick); }
.strike {
  position: relative; color: var(--rule-strong); margin-inline: 0.06em 0.18em;
}
.strike::after {
  content: ""; position: absolute; inset-inline: -4%; top: 54%; height: 0.09em;
  background: var(--brick); border-radius: 1em; transform: rotate(-3deg);
}
.hero__lede { margin-top: 32px; font-size: var(--fs-lede); line-height: 1.5; max-width: 22em; }
.hero__status { display: flex; align-items: center; gap: 12px; font-size: 1rem; color: var(--graphite); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brick); flex-shrink: 0; }

.book { position: relative; }
.book img { position: relative; z-index: 1; width: 100%; outline: 1px solid rgba(20, 22, 26, 0.12); outline-offset: -1px; }
/* spine shading on the binding edge (right, for a Hebrew book) */
.book::before {
  content: ""; position: absolute; z-index: 2; inset-block: 0; inset-inline-start: 0; width: 5%;
  background: linear-gradient(to left, rgba(20,22,26,0.10), rgba(20,22,26,0) 70%);
  pointer-events: none;
}
/* the block of pages behind the cover */
.book::after {
  content: ""; position: absolute; z-index: 0;
  inset-block: 10px -10px; inset-inline: 10px -10px;
  background: repeating-linear-gradient(to bottom, var(--white) 0 2px, var(--rule) 2px 3px);
  outline: 1px solid var(--rule);
}

/* ---------- Intro ---------- */
.intro {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 40px clamp(32px, 7vw, 120px);
  padding-block: 0 var(--section);
}
.intro__body { display: grid; gap: 18px; font-size: var(--fs-lede); line-height: 1.65; max-width: 34em; align-self: end; }
.intro__body p + p { color: var(--graphite); }

/* ---------- Index ---------- */
.index { padding-block: 0 var(--section); }
.index__list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(32px, 7vw, 120px);
}
.index__list li {
  display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-block: clamp(14px, 1.6vw, 20px);
  border-bottom: 1px solid var(--rule);
}
.term { font-family: var(--display); font-size: clamp(1.5rem, 1.15rem + 1.3vw, 2.25rem); line-height: 1.2; min-width: 0; }
.loc { font-family: var(--mono); font-size: var(--fs-meta); color: var(--graphite); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Days ---------- */
.days { padding-block: 0 var(--section); }
.days__title { font-size: var(--fs-h2-lg); }
.days__list {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.days__list li {
  display: grid; align-content: start; gap: 14px;
  padding-block: clamp(28px, 3.5vw, 44px);
  padding-inline: 0 clamp(20px, 3vw, 40px);
}
.days__list li + li { border-inline-start: 1px solid var(--rule); padding-inline-start: clamp(20px, 3vw, 40px); }
.days__num { font-family: var(--mono); font-size: var(--fs-meta); color: var(--brick); font-variant-numeric: tabular-nums; }
.days__list p { color: var(--graphite); max-width: 28ch; }

/* ---------- Preview ---------- */
.preview { padding-block: 0 var(--section); }
.preview__rail {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(20px, 2.6vw, 36px);
  margin-top: clamp(36px, 5vw, 64px);
}
.page { margin: 0; display: grid; gap: 14px; min-width: 0; }
.page__btn {
  display: block; padding: 0; border: 0; background: var(--white); cursor: zoom-in;
  outline: 1px solid var(--rule); outline-offset: -1px;
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.page__btn:hover { transform: translateY(-4px); }
.page__btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.page__btn img { width: 100%; aspect-ratio: 1166 / 1654; object-fit: cover; }
.page figcaption { font-family: var(--mono); font-size: var(--fs-meta); color: var(--graphite); }

/* ---------- Author ---------- */
.author {
  display: grid; grid-template-columns: minmax(0, 0.6fr) minmax(0, 1.4fr);
  gap: 24px clamp(32px, 7vw, 120px);
  padding-block: clamp(36px, 5vw, 56px) var(--section);
}
.author.ruled::before { border-top-color: var(--ink); }
.author__label { font-weight: 400; padding-top: 0.6em; }
.author__body { display: grid; gap: 28px; max-width: 40em; }
.author__quote { font-family: var(--display); font-size: clamp(1.4375rem, 1.1rem + 1.2vw, 2.125rem); line-height: 1.45; }
.author__sig { font-size: 0.9375rem; color: var(--graphite); line-height: 1.7; max-width: 46em; }
.author__sig strong { color: var(--ink); font-weight: 500; margin-inline-end: 6px; }

/* ---------- Conversion sections ---------- */
.convert { padding-block: var(--section); scroll-margin-top: 0; }
.convert:focus { outline: none; }
.convert--waitlist { background: var(--sand); }
.convert--event { background: var(--paper); }
.convert__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px clamp(32px, 7vw, 120px); align-items: start;
}
.convert__head { display: grid; gap: 20px; align-content: start; }
.convert__head .eyebrow { margin-bottom: 4px; }
.convert__lede { font-size: var(--fs-lede); line-height: 1.5; max-width: 26ch; }
.convert__form { min-width: 0; }

.event-facts { margin: 20px 0 0; border-top: 1px solid var(--rule-strong); }
.event-facts > div {
  display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 16px; align-items: baseline;
  padding-block: 16px; border-bottom: 1px solid var(--rule);
}
.event-facts dt { font-family: var(--mono); font-size: var(--fs-meta); color: var(--graphite); }
.event-facts dd { margin: 0; font-family: var(--display); font-size: 1.375rem; line-height: 1.35; }
.event-facts dd.is-pending { color: var(--graphite); font-family: var(--body); font-size: 1.0625rem; }
.event-note { color: var(--graphite); font-size: 0.9375rem; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 26px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) 9.5rem; gap: 20px; }
.field label { font-size: 0.9375rem; font-weight: 500; }
.opt { font-weight: 400; color: var(--graphite); }
.field input, .field select {
  width: 100%; min-height: 54px; padding: 12px 14px;
  font: inherit; font-size: 1.0625rem; color: var(--ink);
  background-color: var(--white); border: 1px solid var(--rule-strong); border-radius: 0;
  transition: border-color .15s ease;
  -webkit-appearance: none; appearance: none;
}
.field input[dir="ltr"] { text-align: right; }
.field input[dir="ltr"]:not(:placeholder-shown) { text-align: left; }
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2314161A' stroke-width='1.5'/%3E%3C/svg%3E");
  background-position: left 16px center; background-size: 12px 8px; background-repeat: no-repeat;
  padding-inline-end: 40px;
}
.field input:hover, .field select:hover { border-color: var(--ink); }
.field input:focus-visible, .field select:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
.field input[aria-invalid="true"] { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.field__error { font-size: 0.875rem; color: var(--error); line-height: 1.4; }
.field__error:empty { display: none; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 0.9875rem; cursor: pointer; line-height: 1.5; }
.check input {
  flex-shrink: 0; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ink); cursor: pointer;
}

.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.form__note { font-size: 0.875rem; color: var(--graphite); margin-top: -10px; }
.form__status { font-size: 0.9375rem; color: var(--error); line-height: 1.5; }
.form__status:empty { display: none; }
.form__status:not(:empty) { padding: 14px 16px; border: 1px solid var(--error); background: var(--white); }

.done { display: grid; gap: 12px; padding-block: 8px; border-top: 1px solid var(--ink); padding-top: 28px; }
.done:focus { outline: none; }
.done__title { font-family: var(--display); font-size: var(--fs-h2); line-height: 1.1; }
.done__demo { font-family: var(--mono); font-size: var(--fs-meta); color: var(--brick); }
.done .link { justify-self: start; margin-top: 8px; }
.event-closed { font-size: var(--fs-lede); line-height: 1.6; }

/* ---------- Final ---------- */
.final {
  padding-block: var(--section) clamp(96px, 12vw, 160px);
  display: grid; justify-items: start; gap: 20px;
}
.final__title { font-family: var(--display); font-size: clamp(3rem, 1.6rem + 6.6vw, 7.5rem); line-height: 1; letter-spacing: -0.015em; }
.final__sub { font-size: var(--fs-lede); color: var(--graphite); margin-bottom: 28px; }

/* ---------- Footer ---------- */
.footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 28px 40px;
  font-family: var(--mono); font-size: 0.75rem; color: var(--graphite);
}

/* ---------- Sticky mobile CTA ---------- */
.sticky-cta { display: none; }

/* ---------- Lightbox ---------- */
.lightbox {
  width: 100%; max-width: 100%; height: 100%; max-height: 100%;
  margin: 0; padding: 0; border: 0;
  background: rgba(242, 239, 232, 0.97); color: var(--ink);
}
.lightbox::backdrop { background: rgba(20, 22, 26, 0.35); }
.lightbox__inner {
  height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px;
  padding: calc(20px + env(safe-area-inset-top, 0px)) var(--gutter) calc(16px + env(safe-area-inset-bottom, 0px));
}
.lightbox__img {
  justify-self: center; align-self: center;
  max-height: 100%; max-width: min(100%, 760px); width: auto; height: auto; object-fit: contain;
  background: var(--white); outline: 1px solid var(--rule);
}
.lightbox__bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px;
  max-width: 760px; width: 100%; justify-self: center;
}
.lightbox__cap, .lightbox__count { font-family: var(--mono); font-size: var(--fs-meta); color: var(--graphite); }
.lightbox__count { font-variant-numeric: tabular-nums; min-width: 3.5em; text-align: center; }
.lightbox__nav { display: flex; align-items: center; gap: 6px; }
.lb-btn {
  min-width: 44px; min-height: 44px; padding: 0 12px;
  font: inherit; font-size: 1.125rem; color: var(--ink); background: transparent;
  border: 1px solid var(--rule-strong); cursor: pointer;
}
.lb-btn:hover { border-color: var(--ink); }
.lb-btn--close { font-size: 0.9375rem; margin-inline-start: 10px; background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* ---------- Motion: one quiet entrance for the hero, nothing else ---------- */
.hero__text, .hero__book, .hero__actions { animation: rise .9s cubic-bezier(.2,.7,.2,1) both; }
.hero__book { animation-delay: .08s; }
.hero__actions { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .hero__text, .hero__book, .hero__actions { animation: none; }
  .page__btn { transition: none; }
}

/* ---------- Tablet ---------- */
@media (max-width: 960px) {
  .preview__rail {
    grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: min(62vw, 300px);
    overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
    padding-bottom: 12px; scrollbar-width: thin;
  }
  .page { scroll-snap-align: start; }
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  :root { --section: 88px; }
  .hide-sm { display: none; }
  .masthead { padding-block: 16px; }
  .masthead__title { font-size: 0.9375rem; }

  .hero {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "text" "book" "actions";
    row-gap: 40px; padding-top: 28px;
  }
  .hero .eyebrow { margin-bottom: 18px; }
  .hero__lede { margin-top: 20px; }
  .hero__book { max-width: min(78vw, 340px); justify-self: center; }
  .hero__actions .actions { flex-direction: column; align-items: stretch; gap: 14px; }
  .hero__actions .btn--quiet, .final .btn--quiet { align-self: center; }

  .intro, .author, .convert__grid { grid-template-columns: minmax(0, 1fr); }
  .intro { gap: 28px; }

  .index__list { grid-template-columns: minmax(0, 1fr); }

  .days__list { grid-template-columns: minmax(0, 1fr); }
  .days__list li, .days__list li + li { padding-inline: 0; border-inline-start: 0; }
  .days__list li + li { border-top: 1px solid var(--rule); }

  .field-row { grid-template-columns: minmax(0, 1fr) 7.5rem; gap: 14px; }

  .final .actions { flex-direction: column; align-items: stretch; width: 100%; gap: 14px; }

  .sticky-cta {
    display: block; position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: rgba(242, 239, 232, 0.94);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    border-top: 1px solid var(--rule);
    transform: translateY(110%); transition: transform .3s ease;
  }
  .sticky-cta .btn { min-height: 50px; }
  .sticky-cta.is-visible { transform: none; }
  .footer { padding-bottom: 96px; }
}
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .sticky-cta { transition: none; } }
