/* 2.1 Content paywall — guests only (body.ssp-paywall).
   Tokens from the design file: 601-4868 (story fade) and 601-4535 (modal). */

:root {
  --ssp-paywall-preview: 420px;              /* overridden inline from the ACF setting */
  --ssp-ink: #363636;
  --ssp-ink-2: #333333;
  --ssp-on-dark: #faf5f7;
  --ssp-accent: #554bde;
  --ssp-glass: rgba(242, 242, 242, .97);
  --ssp-ultra-glass: rgba(242, 242, 242, .82);
}

:root { --ssp-band-fade: clamp(140px, 22vh, 220px); }   /* the band's own see-through top, laid over the last lines of the story */

body.ssp-paywall .single-article-content,
body.ssp-paywall .text-container { padding-bottom: 0 !important; }   /* the band starts right where the text is cut */

/* ---- Truncation: visual only. The full text stays in the HTML. ---- */
body.ssp-paywall .entry-content {
  max-height: var(--ssp-paywall-preview);   /* paywall.js stretches it so the band sits just below the first screen */
  overflow: hidden;
  position: relative;
  cursor: pointer;
}
/* Everything a finished reader gets after the story — tags, rating, comments,
   prev/next, "Your next read" — is for people who read it. Guests get the wall
   instead. Hidden with CSS only; the HTML stays for search engines. The footer
   is untouched. */
body.ssp-paywall .text-container > .entry-footer,
body.ssp-paywall .text-container > .entry-footer__block,
body.ssp-paywall .single-article-content .text-container ~ *,
body.ssp-paywall .single-article-content ~ *,
body.ssp-paywall .stories-page .offers-text,
body.ssp-paywall .stories-page .outline-wrapper,
body.ssp-paywall .stories-page .proposal-container {
  display: none;
}

/* ---- The band (Figma 1009-2822 + Avishai's comments, 08/10) ----
   Part of the story, not stuck to the screen: printed on get_footer, which for a guest is right after the
   cut text (everything in between is hidden above), and pulled up over the last lines by its fade — the
   text fades into the band's glass, one layer, no separate white fade. */
.ssp-paywall-cut { height: 0; }             /* in-flow marker */
.ssp-paywall-overlay {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  width: 100%;
  margin-top: calc(-1 * var(--ssp-band-fade));
  font-family: "Assistant", sans-serif;
}
body.ssp-paywall { overflow-x: hidden; }
body.ssp-paywall #content.site-content { padding-bottom: 0 !important; }
/* The design's band artwork — pink glass with faded Playfair text — sits under
   the content; the glass colour is the fallback while it loads or if removed. Its top is see-through
   and turns into the glass over --ssp-band-fade: that is the story's fade. */
.ssp-paywall-overlay__bar {
  background: var(--ssp-band-bg, none) center bottom / cover no-repeat, var(--ssp-glass);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #ffffff var(--ssp-band-fade), #ffffff 100%);
  mask-image: linear-gradient(to bottom, transparent 0, #ffffff var(--ssp-band-fade), #ffffff 100%);
  display: flex;
  align-items: center;
  justify-content: center;                   /* design 601-4868: content clustered mid-band, ~800px wide */
  gap: 24px;
  padding: var(--ssp-band-fade) 24px 32px;   /* content where the glass is solid */
}
/* "floating paragraphs" (601-4868): Playfair Display SemiBold Italic 30/33, black at 5%, 336 wide, one block
   half outside each edge; they drift slowly, each side its own direction. Text comes from the Paywall page
   per language; HE uses the site's secondary (Margaliot) face via the theme variable. */
.ssp-paywall-overlay__bar { position: relative; overflow: hidden; }
.ssp-paywall-overlay__bar > :not(.ssp-paywall-overlay__quotes) { position: relative; z-index: 1; }
.ssp-paywall-overlay__quotes { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.ssp-paywall-quote {
  position: absolute;
  top: calc(var(--ssp-band-fade) * .8);         /* design: quotes sit in the lower part of the band, spilling below */
  width: clamp(220px, 23vw, 336px);
  margin: 0;
  font: 600 italic clamp(20px, 2.1vw, 30px) / 1.1 var(--font-family-secondary, "Playfair Display", serif);
  color: #000;
  opacity: .05;
  will-change: transform;
  animation: ssp-quote-drift 26s ease-in-out infinite alternate;
}
.ssp-paywall-quote--start { inset-inline-start: clamp(-60px, -3vw, -20px); animation-delay: -6s; }   /* half outside, as in the design */
.ssp-paywall-quote--end   { inset-inline-end: clamp(-90px, -5vw, -40px); width: clamp(200px, 19vw, 280px); animation-direction: alternate-reverse; }   /* half outside on the other side too — never under the CTA */
@keyframes ssp-quote-drift {
  from { transform: translate(0, 0); }
  to   { transform: translate(clamp(-30px, -2vw, -12px), clamp(-14px, -1vw, -6px)); }
}
@media (prefers-reduced-motion: reduce) { .ssp-paywall-quote { animation: none; } }

.ssp-paywall-overlay__brand {                /* badge.png: S mark, disc and PRO pill baked in */
  flex: 0 0 auto;
  display: block;
  width: 86px;
}
.ssp-paywall-overlay__text {
  flex: 0 1 auto;
  min-width: 0;
  margin-inline-end: 96px;                   /* text → button gap from the design */
}
.ssp-paywall-overlay__title {
  margin: 0 0 6px;
  font: 600 30px/39px Assistant, sans-serif;
  color: var(--ssp-ink-2);
}
.ssp-paywall-overlay__sub {
  margin: 0;
  font: 600 18px/24px Assistant, sans-serif;
  color: var(--ssp-ink-2);
}

.ssp-paywall-overlay__row { display: contents; }   /* only a group on desktop (below); elsewhere its children sit in the bar as before */

/* The band's content eases in once, when the band comes into view (paywall.js: --pending until then, then --in).
   The glass itself never fades: it is the story's fade. No JS or reduced motion = shown as is. */
.ssp-paywall-overlay--pending .ssp-paywall-overlay__brand,
.ssp-paywall-overlay--pending .ssp-paywall-overlay__text,
.ssp-paywall-overlay--pending .ssp-btn-pill,
.ssp-paywall-overlay--pending .ssp-paywall-overlay__quotes { opacity: 0; }
.ssp-paywall-overlay--in .ssp-paywall-overlay__brand,
.ssp-paywall-overlay--in .ssp-paywall-overlay__text { animation: ssp-band-in .7s cubic-bezier(.2, .7, .2, 1) backwards; }
.ssp-paywall-overlay--in .ssp-btn-pill { animation: ssp-band-in .7s cubic-bezier(.2, .7, .2, 1) .15s backwards; }   /* backwards only: after it, the hover shrink works as before */
.ssp-paywall-overlay--in .ssp-paywall-overlay__quotes { animation: ssp-band-quotes-in 1.2s ease-out backwards; }
@keyframes ssp-band-in { from { opacity: 0; transform: translateY(16px); } }
@keyframes ssp-band-quotes-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .ssp-paywall-overlay--pending .ssp-paywall-overlay__brand,
  .ssp-paywall-overlay--pending .ssp-paywall-overlay__text,
  .ssp-paywall-overlay--pending .ssp-btn-pill,
  .ssp-paywall-overlay--pending .ssp-paywall-overlay__quotes { opacity: 1; }
  .ssp-paywall-overlay--in * { animation: none !important; }
}

/* ---- Desktop, Figma 1009-2822 (Avishai 08/10): the band covers the text column only — the story's
   60% at the inline end in both languages (stories-style.css) — badge and text in one row, the button
   under them, the story text fading into the glass above. From 768px (tablets too, Volodymyr 12/10: the one-row band
   left the floating quotes no free edge); the band narrows to the text column from 1025px, where the story is in two columns. ---- */
@media (min-width: 1025px) {
  .ssp-paywall-overlay {
    width: 60%;
    margin-inline-start: auto;
  }
}
@media (min-width: 768px) and (max-width: 1024.98px) {
  .ssp-paywall-quote--start { inset-inline-start: -90px; }   /* full-width band: the quotes stay outside the centred badge + text */
  .ssp-paywall-quote--end { inset-inline-end: -90px; }
}
@media (min-width: 768px) {
  :root { --ssp-band-air: clamp(32px, 6vh, 56px); }
  .ssp-paywall-overlay__bar {
    flex-direction: column;
    gap: 19px;
    padding: calc(var(--ssp-band-fade) + var(--ssp-band-air)) 32px clamp(32px, 6vh, 56px);   /* a clear strip of glass above the title, as in 1009-2822 */
  }
  .ssp-paywall-overlay__row {
    display: flex;
    align-items: center;
    gap: 20px;
  }
  .ssp-paywall-overlay__brand { width: 82px; }
  .ssp-paywall-overlay__text { margin-inline-end: 0; }
  .ssp-paywall-overlay__title { margin: 0; font: 600 30px/1.3 Assistant, sans-serif; }
  .ssp-paywall-overlay__sub { font: 600 18px/1.33 Assistant, sans-serif; }
  .ssp-paywall-overlay__bar .ssp-btn-pill {
    min-height: 48px;
    min-width: 248px;
    padding: 0 24px;
    border: 1px solid #ffffff;
    letter-spacing: -.02em;
  }
  .ssp-paywall-quote,
  .ssp-paywall-quote--end { width: clamp(160px, 14vw, 200px); }   /* 1009-2822: narrow blocks at the column edges, clear of the badge */
  /* heights from the band's title (it starts where the fade ends), set with Volodymyr against 1009-2822:
     the end-side block level with the title, the start-side one well below it */
  .ssp-paywall-quote--start { top: calc(var(--ssp-band-fade) + var(--ssp-band-air) + 72px); }
  .ssp-paywall-quote--end   { top: calc(var(--ssp-band-fade) + var(--ssp-band-air)); }
}

/* ---- CTA pill (shared by the band and the modal) ---- */
.ssp-btn-pill {
  box-sizing: border-box;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 40px;
  border-radius: 300px;
  background: var(--ssp-ink-2);
  color: var(--ssp-on-dark);
  font: 700 18px/1 Assistant, sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.ssp-btn-pill:hover,
.ssp-btn-pill:focus-visible {
  color: var(--ssp-on-dark);
  transform: scale(.9);   /* Styles & Elements: a dark button shrinks by 10% on hover, like the wizard and plans buttons */
}
.ssp-btn-pill:focus-visible {
  outline: 3px solid var(--ssp-accent);
  outline-offset: 3px;
}

@media (max-width: 767.98px) {

  .ssp-paywall-overlay__bar { background-image: var(--ssp-band-bg-mobile, var(--ssp-band-bg, none)); }
  .ssp-paywall-overlay__bar {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 14px;
    padding: var(--ssp-band-fade) 20px 58px;
  }
  .ssp-paywall-overlay__brand { align-self: center; }
  .ssp-paywall-overlay__title { font-size: 26px; line-height: 32px; }   /* QA3 #35: +20% */
  .ssp-paywall-overlay__sub { font-size: 16px; line-height: 22px; }
  .ssp-paywall-overlay__text { margin-inline-end: initial; }
  .ssp-btn-pill { width: 100%; }
  .ssp-paywall-overlay__bar .ssp-btn-pill { margin-top: 14px; }   /* QA3 #35: subtitle → button gap doubled (14 + 14) */
  /* the floating quotes sit low at the screen edges, beside the button: never over the last story lines or the badge (Chen 12/10) */
  .ssp-paywall-quote, .ssp-paywall-quote--end { width: 9.5rem; font-size: 20px; }
  /* measured from the band's bottom, not its top: the text above the button is taller in English (two-line title and
     subtitle), so a top offset ran into it. The end one starts just under the subtitle (140px up), the start one a little
     lower; whatever is longer runs out under the band's bottom edge (Volodymyr 12/10, checked 320–430, EN + HE) */
  .ssp-paywall-quote--start { top: calc(100% - 6.5rem); inset-inline-start: -4.25rem; }
  .ssp-paywall-quote--end { top: calc(100% - 8.25rem); inset-inline-end: -5rem; }
}

/* ---- Join modal over the blurred story (601-4535, mobile 601-4016) ----
   The site ships Bootstrap's JS but not its CSS (main.css is a stub), so the
   modal, dialog and backdrop base styles Bootstrap's JS expects are defined
   here, scoped to this modal. Bootstrap JS: sets display:block inline on
   .modal, toggles .show, appends <div class="modal-backdrop fade show">. */
.ssp-paywall-modal {
  position: fixed;
  inset: 0;
  z-index: 1055;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  outline: 0;
  font-family: "Assistant", sans-serif;
}
.ssp-paywall-modal:focus, .ssp-paywall-modal:focus-visible { outline: 0 !important; }   /* Bootstrap focuses the modal itself on open; no frame around the screen */
.ssp-paywall-modal.fade { transition: opacity .15s linear; }
.ssp-paywall-modal.fade:not(.show) { opacity: 0; }
.ssp-paywall-modal.fade .modal-dialog { transition: transform .3s ease-out; transform: translateY(-40px); }
.ssp-paywall-modal.show .modal-dialog { transform: none; }
.ssp-paywall-modal .modal-dialog {
  position: relative;
  width: auto;
  max-width: 448px;
  margin: 1.75rem auto;
  pointer-events: none;
}
.ssp-paywall-modal .modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 3.5rem);
}
.ssp-paywall-modal .modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
}
.modal-backdrop.ssp-paywall-backdrop {   /* the modal is on every page now (QA 27/09), not only the walled story */
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(255, 255, 255, .4);
  -webkit-backdrop-filter: blur(50px);
  backdrop-filter: blur(50px);
  opacity: 1;
  transition: opacity .15s linear;
}
.modal-backdrop.ssp-paywall-backdrop.fade:not(.show) { opacity: 0; }

.ssp-paywall-card {
  position: relative;
  border: 0;
  padding: 68px 32px 32px;
  /* min-height: 604px; */
  background-color: transparent;
  background-size: 100% 100%;                /* PNG carries the corners and border; stretch, never crop */
  background-repeat: no-repeat;
  background-position: center;
  text-align: center;
  color: var(--ssp-ink);
}
.ssp-paywall-card__badge {
  position: absolute;
  top: -36px;
  left: 50%;
  transform: translateX(-50%);
  width: 86px;
}
.ssp-paywall-card__close {
  position: absolute;
  top: 20px;
  inset-inline-end: 20px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 300px;
  background: rgba(255, 255, 255, .5);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ssp-paywall-card__close:focus-visible {
  outline: 3px solid var(--ssp-accent);
  outline-offset: 2px;
}
.ssp-paywall-card__avatars {
  display: flex;
  justify-content: center;
  margin: 0 0 24px;
}
.ssp-paywall-card__avatars img {
  width: 104px;
  height: 104px;
  object-fit: contain;
  margin-inline: -18px;
}
.ssp-paywall-card__avatars img:first-child {
  z-index: 1;
}
.ssp-paywall-card__title {
  margin: 0 0 16px;
  font: 400 36px/1.15 Assistant, sans-serif;
  color: var(--ssp-ink);
}
.ssp-paywall-card__counters {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0 18px;
  margin: 0 0 28px;
  font: 600 18px/18px Assistant, sans-serif;
  color: var(--ssp-ink);
}
.ssp-paywall-card__counters span + span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ssp-ink-2);
  margin-inline-end: 18px;
  vertical-align: middle;
}
.ssp-paywall-card__checks {
  list-style: none;
  margin: 0 0 28px;
  padding: 28px 0 0;
  border-top: 1px dashed var(--ssp-ink);
  text-align: start;
  font: 600 18px/1.3 Assistant, sans-serif;
  color: var(--ssp-ink-2);
}
.ssp-paywall-card__checks li {
  position: relative;
  padding-inline-start: 34px;
  margin: 0 0 14px;
}
.ssp-paywall-card__checks li::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  width: 20px;
  height: 20px;
  border-radius: 5px;
  background: var(--ssp-accent) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path d='M5 10.5l3 3 7-7' fill='none' stroke='white' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/></svg>") center/14px no-repeat;
}
.ssp-paywall-card__cta { width: 100%; }

@media (max-width: 767.98px) {
  .ssp-paywall-modal {
    background: var(--ssp-ultra-glass) url("../img/paywall/paywall-overlay-bg.png") center/cover no-repeat;
    z-index: 99999;
  }
  .ssp-paywall-modal .modal-dialog { margin: 12px; }
  .ssp-paywall-card {
    padding: 64px 24px 28px;
    min-height: 0;
    border-radius: 32px;
  }
  .ssp-paywall-card__title { font-size: 28px; }

  /* QA3 #34 — Figma 601-4016: lower so the badge is never cut, tighter, semi-bold title, the counters on one line,
     the dashed rule above the button across the whole card, X on the right in Hebrew */
  .ssp-paywall-modal .modal-dialog { margin: 38px 12px clamp(28px, 6vh, 48px); }   /* 38px: room for the badge (36px above the card) */
  .ssp-paywall-modal .modal-dialog-centered { min-height: calc(100% - 38px - clamp(28px, 6vh, 48px)); }   /* centred in what is left: a touch above the middle, never cut, air at the bottom (S23) */
  .ssp-paywall-card { padding: 56px 24px 24px; }
  .ssp-paywall-card__avatars { margin-bottom: 16px; }
  .ssp-paywall-card__avatars img { width: clamp(80px, 24vw, 96px); height: clamp(80px, 24vw, 96px); margin-inline: -14px; }
  .ssp-paywall-card__title { font-size: clamp(26px, 7.5vw, 30px); font-weight: 600; line-height: 1.05; margin-bottom: 14px; }
  .ssp-paywall-card__counters { flex-wrap: nowrap; white-space: nowrap; gap: 0 clamp(6px, 2vw, 10px); font-size: clamp(14px, 4.2vw, 18px); margin-bottom: 22px; }
  .ssp-paywall-card__counters span + span::before { width: 6px; height: 6px; margin-inline-end: clamp(6px, 2vw, 10px); }
  .ssp-paywall-card__checks { border-top: 0; padding: 0 24px 22px; margin: 0 -24px 22px; border-bottom: 1px dashed var(--ssp-ink); font-size: 16px; }
  .ssp-paywall-card__checks li { margin-bottom: 12px; }
  html[dir="rtl"] .ssp-paywall-card__close { inset-inline-end: auto; inset-inline-start: 20px; }
}

/* the reading-progress ring that follows the mouse (custom.js) means nothing on a cut story and reads as a
   spinner that never ends (QA2 #24a); custom.js shows it with an inline style, hence !important */
body.ssp-paywall #story-progress-container { display: none !important; }

/* the join modal is up: the newsletter popup waits underneath (paywall.js A1b) — it shows when the modal closes */
html.ssp-join-open #newsletter-popup { visibility: hidden !important; pointer-events: none !important; }
