/* Checkout pop-up, swipe cards, offer and downsell. Scoped with fn- so it can't touch the sales page. */
body.fn-locked { overflow: hidden; }

.fn-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(30, 22, 18, 0.72);
}
.fn-modal {
  position: relative;
  width: 100%;
  max-width: 460px;
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  padding: 22px 18px;
  border-radius: 16px;
  background: #fff;
  color: #2f2f2f;
  font-size: 20px;
  line-height: 1.35;
  text-align: center;
}
.fn-modal h2 { margin: 0 0 12px; font-size: 1.5rem; line-height: 1.2; color: #2f2f2f; }
.fn-kicker { margin: 0 0 6px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #d9432f; }
.fn-copy { margin: 0 0 16px; }
.fn-close { position: absolute; top: 6px; right: 8px; width: 44px; height: 44px; border: 0; background: none; font-size: 30px; line-height: 1; color: #5c4e42; cursor: pointer; }

/* Buttons */
.fn-btn {
  display: block;
  width: 100%;
  min-height: 62px;
  padding: 14px 12px;
  border: 0;
  border-radius: 12px;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 800;
  cursor: pointer;
  touch-action: manipulation;
}
.fn-btn-yes { background: #38c83a; color: #0f2d10; }
.fn-btn-yes:disabled { background: #e3ddd8; color: #5c4e42; cursor: not-allowed; }
.fn-btn-no { background: #f1ebe6; color: #5c4e42; }
.fn-link { display: block; width: 100%; min-height: 48px; margin-top: 8px; border: 0; background: none; font: inherit; font-size: 1rem; color: #5c4e42; text-decoration: underline; cursor: pointer; }

/* Checkout */
.fn-line { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding: 12px; border-radius: 10px; background: #fff2ef; text-align: left; }
.fn-form label { display: block; margin-bottom: 10px; font-size: 0.9rem; font-weight: 700; text-align: left; }
.fn-form input { display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 12px; border: 1px solid #d8cabf; border-radius: 8px; font: inherit; font-size: 1rem; }
.fn-payment { min-height: 120px; margin-bottom: 12px; text-align: left; }
.fn-error { margin: 0 0 12px; font-size: 0.95rem; font-weight: 700; color: #d9432f; }

/* Cards */
.fn-modal-cards { display: flex; flex-direction: column; height: calc(100dvh - 24px); max-height: 760px; padding: 12px; overflow: hidden; }
/* Intro: lines fade in at 0.2s, 1.3s, 2.4s, then all fade out by 4s (INTRO_MS in funnel.js). */
.fn-modal-intro { justify-content: center; gap: 22px; padding: 24px; cursor: pointer; animation: fn-fade-out 0.4s ease 3.6s forwards; }
.fn-intro-line { margin: 0; font-size: 1.15rem; color: #5c4e42; opacity: 0; animation: fn-fade 0.6s ease forwards; }
.fn-intro-line:nth-child(1) { animation-delay: 0.2s; color: #2d6a3e; font-weight: 700; }
.fn-intro-line:nth-child(2) { animation-delay: 1.3s; }
.fn-intro-line:nth-child(3) { animation-delay: 2.4s; }
.fn-intro-main { font-size: 1.6rem; font-weight: 800; line-height: 1.2; color: #2f2f2f; }
.fn-fade-in { animation: fn-fade 0.4s ease; }
@keyframes fn-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fn-fade-out { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .fn-intro-line { animation: none; opacity: 1; }
}
.fn-progress { display: flex; flex: none; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 0.85rem; font-weight: 700; color: #5c4e42; white-space: nowrap; }
.fn-bar { flex: 1; height: 6px; overflow: hidden; border-radius: 3px; background: #efe3db; }
.fn-bar span { display: block; height: 100%; background: #38c83a; }
.fn-stack { position: relative; flex: 1; min-height: 0; margin-bottom: 12px; }
.fn-card { position: absolute; inset: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid #efe3db; border-radius: 14px; background: #fff; }
.fn-card picture { position: relative; display: block; flex: 1; min-height: 0; background: #f7f2ee; }
.fn-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.fn-card-next { transform: scale(0.96) translateY(6px); }
.fn-card-top { z-index: 1; padding-top: 12px; box-shadow: 0 6px 18px rgba(47, 47, 47, 0.14); cursor: grab; touch-action: none; user-select: none; transition: transform 0.26s ease; }
.fn-card-top.fn-dragging { cursor: grabbing; transition: none; }
.fn-card-top.fn-tapped { transition-duration: 0.45s; }
.fn-card-top h2 { flex: none; margin: 0 12px 10px; font-size: 1.3rem; }
.fn-stamp { position: absolute; top: 90px; padding: 4px 12px; border: 4px solid; border-radius: 10px; background: rgba(255, 255, 255, 0.85); font-size: 1.4rem; white-space: nowrap; font-weight: 900; opacity: 0; transition: opacity 0.1s; }
.fn-stamp-yes { left: 16px; color: #2d6a3e; transform: rotate(-12deg); }
.fn-stamp-no { right: 16px; color: #d9432f; transform: rotate(12deg); }
.fn-show-yes .fn-stamp-yes, .fn-show-no .fn-stamp-no { opacity: 1; }
/* First card only: leans right then left, showing each stamp, until they touch it. */
.fn-hint { animation: fn-nudge 3.2s ease-in-out 0.5s infinite; }
.fn-hint .fn-stamp-yes { animation: fn-hint-yes 3.2s ease-in-out 0.5s infinite; }
.fn-hint .fn-stamp-no { animation: fn-hint-no 3.2s ease-in-out 0.5s infinite; }
@keyframes fn-nudge {
  0%, 8%, 36%, 64%, 100% { transform: none; }
  22% { transform: translateX(30px) rotate(2deg); }
  50% { transform: translateX(-30px) rotate(-2deg); }
}
@keyframes fn-hint-yes { 0%, 10%, 34%, 100% { opacity: 0; } 22% { opacity: 1; } }
@keyframes fn-hint-no { 0%, 38%, 62%, 100% { opacity: 0; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .fn-hint, .fn-hint .fn-stamp { animation: none; }
}

/* Yes sits on the right and takes the wider share, under a right thumb. */
.fn-choices { display: grid; flex: none; grid-template-columns: 1fr 2fr; gap: 10px; }
.fn-choices .fn-btn { min-height: 72px; font-size: 1.4rem; }
.fn-choices .fn-btn-no { font-size: 1.05rem; }

/* Offer and downsell */
/* The list scrolls so the yes button stays on screen with all 9 classes picked. */
.fn-summary { max-height: 38dvh; margin: 0 0 12px; padding: 0; overflow-y: auto; list-style: none; text-align: left; }
.fn-summary li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid #efe3db; font-size: 1rem; }
.fn-summary li > span { flex: 1; }
.fn-summary s { color: #5c4e42; }
.fn-thumb { flex: none; display: block; width: 52px; height: 52px; }
.fn-thumb img { display: block; width: 52px; height: 52px; border-radius: 8px; object-fit: cover; }
.fn-pick li { padding: 0; }
.fn-pick label { display: flex; flex: 1; align-items: center; gap: 10px; min-height: 64px; cursor: pointer; }
.fn-pick label span { flex: 1; }
.fn-pick input { flex: none; width: 24px; height: 24px; accent-color: #2d6a3e; }
.fn-totals { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.fn-totals strong { font-size: 1.5rem; color: #2d6a3e; }
.fn-frame { min-height: 1.4em; margin: 0 0 10px; font-weight: 800; color: #d9432f; }
.fn-final b { flex: none; }

.fn-or { margin: 14px 0 4px; text-align: center; font-size: 14px; color: #6b6b6b; }
/* The checkout is built hidden in the background so it opens instantly. visibility alone is not
   enough: Stripe sets visibility: visible on its own frames, and its blurred loading skeleton
   showed through over the sales page. opacity and pointer-events cannot be overridden by children. */
.fn-overlay.fn-prepared { visibility: hidden; opacity: 0; pointer-events: none; }
/* Stripe adds its Link pop-up straight to <body>, outside the hidden prepared checkout. For a
   recognised Link user it opens with a blurred backdrop over the sales page, so keep it hidden
   unless our checkout is actually open (body.fn-locked). */
body:not(.fn-locked) > div:has(> iframe[src*="universal-link-modal"]) { display: none !important; }
.fn-alt { margin: 8px 0 12px; font-size: 16px; text-align: center; }
.fn-alt a { color: inherit; font-weight: 700; text-decoration: underline; }
