/* The paywall.
   A modal over whatever was already on screen, dimmed rather than replaced —
   in the viewer that means their own scan is still visible behind the price,
   which is the entire reason it is not a separate page. */

.paywall-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
  overflow-y: auto;
}

.paywall {
  width: min(30rem, 100%);
  margin: auto;
  padding: 28px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: 15px/1.5 var(--font-ui);
}

.paywall-title {
  margin: 0 0 12px;
  font-size: 1.35rem;
  line-height: 1.2;
}

/* The one deadline in the product, and a real one — a nightly sweep enforces
   it. Coloured to be noticed, not to alarm. */
.paywall-expiry {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
}

.paywall-list {
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
}

.paywall-list li {
  position: relative;
  padding: 6px 0 6px 26px;
  color: var(--muted);
}

.paywall-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* The billed amount, directly above the button that commits to it. The same
   weight as the CTA text on purpose: the iOS 3.1.2(c) rule — the amount is
   never less conspicuous than the offer — kept on a surface Apple will never
   review. */
.paywall-price {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 17px;
  font-weight: 600;
  text-align: center;
}

/* The wallet row (Apple Pay / Google Pay / Link). Zero-height until the
   element reports a wallet actually exists in this browser, so a walletless
   visitor never sees an empty socket where a button should be. */
.paywall-wallet {
  margin: 0;
}

.paywall-wallet.has-wallet {
  margin: 0 0 10px;
  min-height: 48px;
}

/* The reserved slot while Stripe.js is still loading, on browsers whose
   synchronous Apple Pay hint says the button is coming. A quiet skeleton —
   deliberately NOT styled as any wallet's mark — that the real button
   replaces in place. */
.paywall-wallet.wallet-loading {
  border-radius: 12px;
  background: var(--line-soft);
  animation: paywall-wallet-pulse 1.2s ease-in-out infinite;
}

@keyframes paywall-wallet-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.paywall-cta {
  display: block;
  width: 100%;
  padding: 14px;
  border: 0;
  border-radius: 12px;
  /* No background here: the lit accent fill comes from app.css's base
     button rule, so the commit button and every other primary agree. */
  color: var(--accent-ink);
  font: 600 17px/1 inherit;
  cursor: pointer;
}

/* The card button once a wallet holds the primary slot: still a real,
   full-size way to pay — the demotion is visual, not functional. */
.paywall-cta-secondary {
  background: transparent;
  box-shadow: none;
  border: 1px solid var(--line);
  color: var(--muted);
}

.paywall-cta:disabled {
  opacity: 0.6;
  cursor: default;
}

/* Shown instead of the CTA while web billing does not exist. Deliberately not
   styled as an error: nothing has gone wrong for the reader. */
.paywall-unavailable {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

/* The test unlock. Dashed and unbranded on purpose: it must never look like
   the CTA a real visitor is offered, in the modal or in a screenshot of it. */
.paywall-test-unlock {
  display: block;
  width: 100%;
  padding: 12px;
  border: 1px dashed var(--dim);
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: 600 15px/1 inherit;
  cursor: pointer;
}

.paywall-test-unlock:disabled {
  opacity: 0.6;
  cursor: default;
}

/* The guarantee and the cancel instructions. Full-brightness body text at the
   same size as everything else — the way out must never read as fine print,
   which is exactly what the iOS rejection was about. */
.paywall-fine {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.paywall-error {
  margin: 12px 0 0;
  color: var(--bad);
  font-size: 14px;
}

.paywall-dismiss {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: 15px/1 inherit;
  cursor: pointer;
}

.paywall-dismiss:hover {
  color: var(--text);
}

/* ── the 3D tease background (§13.3) ──────────────────────────────────────
   The visitor's own volume orbiting — the worker's thumb.gif — blurred
   behind the price card. Layering rules:

     - the img and its veil are absolute and sit UNDER every other child
       (which all get z-index 1 via the has-tease rule below);
     - the veil is what keeps the text honest: the price and the cancel
       sentence must never be less legible than the tease (the iOS
       3.1.2(c) rule, applied where no reviewer will ever look);
     - blur + brightness rather than opacity, so the volume reads as depth
       behind the card instead of a watermark on it. */
.paywall.has-tease {
  position: relative;
  overflow: hidden;
}

.paywall.has-tease > :not(.paywall-tease):not(.paywall-tease-veil) {
  position: relative;
  z-index: 1;
}

.paywall-tease {
  position: absolute;
  inset: -24px;                    /* blur samples past the edges; no halo */
  width: calc(100% + 48px);
  height: calc(100% + 48px);
  object-fit: cover;
  filter: blur(14px) brightness(0.45) saturate(1.1);
  z-index: 0;
}

.paywall-tease-veil {
  position: absolute;
  inset: 0;
  z-index: 0;
  /* Darker where the fine print lives. */
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--panel) 55%, transparent) 0%,
    color-mix(in srgb, var(--panel) 72%, transparent) 55%,
    color-mix(in srgb, var(--panel) 90%, transparent) 100%
  );
}
