/*
 * VIP landing — static replacement for the Flutter /vip funnel.
 *
 * Visual targets pulled from lib/screens/landing/landing_page.dart so the
 * static page is indistinguishable from the previous Flutter version:
 *   - Cream scaffold background (#faf8f5 == NoveloColors.light.background)
 *   - 680px max content column, centered
 *   - Cover 340 px on mobile, 420 px on desktop
 *   - Chapter labels: 22 px, weight 600, letter-spacing 1.5
 *   - Body text: Lora serif, 17–18 px, line-height 1.75
 *   - VIP gate: red Oswald-ish headline + black filled button
 *   - Email gate: same Lora italic hooks as Flutter
 *
 * Block text selection / copy on the chapter body to match the Flutter app
 * (which uses css user-select:none + JS event blockers in index.html).
 */

:root {
  --bg: #ffffff;
  --text: #25222b;
  --text-secondary: #706c84;
  --text-tertiary: #b9aab3;
  --divider: #f0cdd2;
  --accent: #d66a75;
  --accent-soft: #f9d9dd;
  --red: #d01508;
  --error: #d94f4f;
  --cta-bg: #111111;
  --cta-fg: #ffffff;
  --max-col: 680px;
  --h-pad: 22px;
  --vip-funnel-bg: #faf8f5;
}

@media (min-width: 760px) {
  :root {
    --h-pad: 40px;
  }
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
  display: block;
}

/* The chapter body is the only content the user is actively reading; everything
 * else (UI chrome) should not be selectable so the funnel feels app-like. */
body, .hero, .vip-gate, .email-gate, .footer, button, .chapter-label {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}
.chapter-body {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */

.page {
  width: 100%;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  justify-content: center;
}

.column {
  width: 100%;
  max-width: var(--max-col);
  padding: 24px var(--h-pad) 156px var(--h-pad);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

/* When the page is in the "email" step there's no sticky CTA, so kill the
 * extra bottom padding the sticky CTA would have needed. */
.page[data-step="email"] .column {
  padding-bottom: 48px;
  padding-top: 54px;
}
.page[data-step="post"] .column {
  padding-bottom: 48px;
}

/* ── Hero ────────────────────────────────────────────────────────────────── */

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0 0 32px;
}

.hero-cover {
  width: 340px;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.12);
}

@media (min-width: 760px) {
  .hero-cover {
    width: 420px;
  }
}

.hero-title {
  margin: 22px 0 0;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--text);
}

@media (min-width: 760px) {
  .hero-title {
    font-size: 40px;
  }
}

/* ── Boot spinner (shown until JS resolves the language + renders) ───────── */

.boot-spinner {
  margin: 32px auto 0;
  width: 160px;
  height: 2px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.boot-spinner .spinner-bar {
  position: absolute;
  left: -40%;
  top: 0;
  bottom: 0;
  width: 40%;
  background: linear-gradient(90deg, transparent 0%, var(--accent) 50%, transparent 100%);
  animation: novelo-bar-slide 1.1s ease-in-out infinite;
}
@keyframes novelo-bar-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

/* ── Chapters ────────────────────────────────────────────────────────────── */

.chapter {
  display: flex;
  flex-direction: column;
}

.chapter + .chapter::before {
  content: '❦';
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  margin: 40px 0;
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
  background:
    linear-gradient(var(--divider), var(--divider)) left center / calc(50% - 32px) 1px no-repeat,
    linear-gradient(var(--divider), var(--divider)) right center / calc(50% - 32px) 1px no-repeat;
}

.chapter-label {
  font-family: 'Roboto', sans-serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 1.5px;
  line-height: 1.3;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
  margin: 0 0 18px;
}

.chapter-body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.78;
  letter-spacing: 0.1px;
  color: var(--text);
  -webkit-hyphens: auto;
  hyphens: auto;
}

.chapter-body p {
  margin: 0 0 16px;
  text-indent: 0;
  white-space: pre-wrap;
}

.chapter-body p:last-child {
  margin-bottom: 0;
}

/* Skeleton lines while the chapter text is in flight. */
.chapter--loading .chapter-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chapter--loading .chapter-body::before,
.chapter--loading .chapter-body::after,
.chapter--loading .chapter-body span {
  content: '';
  display: block;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(90deg, #ece8df 0%, #f5f1e8 50%, #ece8df 100%);
  background-size: 200% 100%;
  animation: novelo-skeleton-shimmer 1.4s ease-in-out infinite;
}
.chapter--loading .chapter-body::before { width: 92%; }
.chapter--loading .chapter-body::after { width: 78%; }
.chapter--loading .chapter-body span { width: 88%; }
@keyframes novelo-skeleton-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* ── VIP "Continue Reading" gate (red Facebook-limit + black CTA) ────────── */

.vip-gate {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 40px 0 0;
}

.vip-gate-prompt {
  text-align: left;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.2px;
  color: var(--text);
  margin: 0 0 104px;
}

.vip-gate-fb {
  text-align: center;
  font-family: 'Oswald', 'Impact', sans-serif;
  font-weight: 900;
  font-size: 24px;
  line-height: 1.12;
  letter-spacing: -0.4px;
  color: var(--red);
  margin: 0 0 12px;
}
.vip-gate-fb-underline {
  display: block;
  width: 100%;
  max-width: 380px;
  margin: 0 auto;
  height: 12px;
}

.button-hint-wrap {
  position: relative;
  width: 100%;
}

.button-hint-wrap--vip {
  margin: 46px auto 0;
}

.button-hint-wrap--email {
  width: 360px;
  max-width: 100%;
  margin: 34px auto 0;
}

.sticky-hint-wrap {
  width: 100%;
  max-width: var(--max-col);
}

.finger-hint {
  position: absolute;
  right: -4px;
  top: -29px;
  width: 66px;
  height: 66px;
  object-fit: contain;
  transform: scaleX(-1) scaleY(-1);
  animation: finger-nudge 850ms ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 2;
}

.sticky-hint-wrap .finger-hint {
  width: 48px;
  height: 48px;
  right: -3px;
  top: -21px;
}

@keyframes finger-nudge {
  from { transform: translate(8px, -16px) scaleX(-1) scaleY(-1); }
  to { transform: translate(-2px, -4px) scaleX(-1) scaleY(-1); }
}

.vip-gate-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cta-bg);
  color: var(--cta-fg);
  border: 0;
  border-radius: 14px;
  height: 92px;
  min-width: 100%;
  padding: 0 32px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease;
  -webkit-user-select: none;
  user-select: none;
}

.button-heart {
  font-size: 28px;
  line-height: 1.05;
  margin-right: 10px;
}

html[dir="rtl"] .button-heart {
  margin-right: 0;
  margin-left: 10px;
}
.vip-gate-button:active {
  transform: translateY(1px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}
.vip-gate-button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ── Email gate ──────────────────────────────────────────────────────────── */

.email-gate {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 32px 0 0;
}

.teaser {
  margin-top: 0;
}

.teaser::before {
  content: '❦';
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 0 40px;
  color: var(--text-tertiary);
  font-size: 18px;
  line-height: 1;
  background:
    linear-gradient(var(--divider), var(--divider)) left center / calc(50% - 32px) 1px no-repeat,
    linear-gradient(var(--divider), var(--divider)) right center / calc(50% - 32px) 1px no-repeat;
}

.page[data-step="email"] .teaser::before {
  display: none;
}

.teaser-card {
  position: relative;
  overflow: hidden;
  padding: 0 0 6px;
}

.teaser-card .chapter-label {
  padding-top: 8px;
}

.teaser-card .chapter-body {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 38%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 38%, rgba(0,0,0,0) 100%);
}

.teaser-lock {
  position: absolute;
  left: 50%;
  bottom: 6px;
  transform: translateX(-50%);
  width: 99px;
  height: 99px;
  object-fit: contain;
}

.email-hook {
  font-family: 'Lora', 'Times New Roman', serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.1px;
  color: var(--text);
  text-align: center;
  margin: 0 0 14px;
}
.email-hook + .email-hook {
  margin-top: 0;
}

/* Envelope badge — inline SVG instead of the 1.3 MB
 * novelo_onboarding_envelope_circle.png the Flutter version uses, because
 * fetching that PNG would undo most of the cold-start win on a fresh visit. */
.email-envelope {
  width: 136px;
  height: 136px;
  margin: 18px auto 14px;
  display: block;
  object-fit: contain;
}

.email-signup {
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 500;
  color: var(--text);
  margin: 0 0 22px;
}
.email-signup .book-name {
  font-style: italic;
  font-weight: 700;
}

.email-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.email-input {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.4;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--divider);
  border-radius: 14px;
  padding: 16px;
  outline: none;
  transition: border-color 140ms ease;
  -webkit-appearance: none;
  appearance: none;
}
.email-input::placeholder {
  color: var(--text-tertiary);
}
.email-input:focus {
  border-color: var(--accent);
  border-width: 1.5px;
  padding: 15.5px;
}
.email-input.--invalid {
  border-color: var(--error);
}

.email-note {
  text-align: center;
  font-size: 12px;
  line-height: 1.3;
  color: var(--text-secondary);
  margin: 10px 0 0;
}

.email-error {
  text-align: center;
  font-size: 13px;
  color: var(--error);
  margin: 10px 0 0;
  min-height: 1em;
}

.email-submit {
  margin: 0;
  width: 100%;
  height: 62px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: #ffffff;
  font-family: 'Lora', 'Times New Roman', serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(214, 106, 117, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
  -webkit-user-select: none;
  user-select: none;
}
.email-submit:disabled {
  background: #b8b5af;
  box-shadow: none;
  cursor: not-allowed;
}
.email-submit:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: 0 6px 18px rgba(214, 106, 117, 0.28);
}
.email-submit:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}
.email-submit .submit-spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: novelo-spin 0.7s linear infinite;
}
@keyframes novelo-spin {
  to { transform: rotate(360deg); }
}

.email-legal {
  text-align: center;
  margin: 38px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-secondary);
}
.email-legal a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(90, 90, 88, 0.5);
  text-underline-offset: 2px;
}

/* ── Static checkout gate for /vip982567811 ─────────────────────────────── */

.checkout-gate {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 32px 0 0;
}

.checkout-badge {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 18px 0 18px;
  padding: 7px 14px;
  background: #fff1ea;
  color: #c44d1e;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.checkout-button-wrap {
  margin-top: 0;
}

.checkout-submit {
  text-transform: none;
}

.checkout-terms {
  margin: 14px 0 28px;
  color: var(--text-secondary);
  text-align: center;
  font-size: 11.5px;
  line-height: 1.45;
  font-weight: 500;
}

html[dir="rtl"] .checkout-terms {
  text-align: center;
}

.checkout-panel {
  margin: 0 0 24px;
  padding: 22px 18px 18px;
  background: #fbf1f8;
  border-radius: 24px;
}

.checkout-panel--reviews {
  margin-bottom: 28px;
}

.checkout-section-heading {
  margin: 0 0 18px;
  color: var(--text);
  text-align: center;
  font-size: 21px;
  line-height: 1.25;
  font-weight: 900;
}

.checkout-benefits {
  display: grid;
  gap: 12px;
  margin: 0;
}

.checkout-benefit {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 1px 0 rgba(37, 34, 43, 0.04);
}

.checkout-benefit-icon {
  flex: 0 0 auto;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.checkout-benefit h3 {
  margin: 0 0 4px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.2;
  font-weight: 900;
}

.checkout-benefit p {
  margin: 0;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.35;
  font-weight: 500;
}

.checkout-reviews {
  display: grid;
  gap: 14px;
  margin: 0;
}

.checkout-review {
  margin: 0;
  padding: 18px 22px 20px;
  background: #ffffff;
  border-radius: 20px;
  box-shadow: 0 1px 0 rgba(37, 34, 43, 0.04);
}

.checkout-review-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-bottom: 10px;
}

.checkout-review-top strong {
  color: var(--accent-dark);
  font-size: 14px;
  font-weight: 900;
}

.checkout-review-top span {
  color: #ffbf2e;
  font-size: 14px;
  letter-spacing: 1px;
}

.checkout-review p {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  line-height: 1.36;
  font-weight: 500;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  margin: 28px 0 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ── Sticky CTA (only visible in reading step before inline CTA scrolled into view) */

.sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: center;
  padding: 14px var(--h-pad) calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.92) 30%, rgba(255, 255, 255, 1) 100%);
  pointer-events: none;
  z-index: 50;
  transition: transform 220ms ease, opacity 220ms ease;
}
.sticky-cta button {
  pointer-events: auto;
  width: 100%;
  height: 56px;
  background: var(--accent);
  color: #000000;
  border: 0;
  border-radius: 14px;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.3);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sticky-cta.--hidden {
  transform: translateY(110%);
  opacity: 0;
}

/* ── RTL (Hebrew) ────────────────────────────────────────────────────────── */

html[dir="rtl"] .vip-gate-prompt,
html[dir="rtl"] .chapter-body {
  text-align: right;
}
html[dir="rtl"] .email-form {
  text-align: right;
}

html[dir="rtl"] .finger-hint {
  left: -4px;
  right: auto;
  transform: scaleY(-1);
}

html[dir="rtl"] .sticky-hint-wrap .finger-hint {
  left: -3px;
  right: auto;
}

html[dir="rtl"] .button-hint-wrap .finger-hint {
  animation-name: finger-nudge-rtl;
}

@keyframes finger-nudge-rtl {
  from { transform: translate(-8px, -16px) scaleY(-1); }
  to { transform: translate(2px, -4px) scaleY(-1); }
}
