/* ═══════════════════════════════════════════════════════════
   ADVENTURE WITH FLETCHER :: Give & Sponsor popup + Thank-you
   Uses the tokens from style.css (--gold, --red, --cream …).
   ═══════════════════════════════════════════════════════════ */

/* ── Popup shell ────────────────────────────────────────── */
.give-portal { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 18px; }
.give-portal[hidden] { display: none; }
.give-backdrop {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 30%, rgba(31,61,43,.78), rgba(10,16,11,.88));
  backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .35s ease;
}
.give-portal.is-open .give-backdrop { opacity: 1; }

.give-card {
  position: relative; width: 100%; max-width: 620px;
  max-height: calc(100vh - 36px); max-height: calc(100dvh - 36px);
  overflow-y: auto; overscroll-behavior: contain;
  background: linear-gradient(170deg, #FFFDF6 0%, var(--cream) 55%, var(--cream-deep) 100%);
  border: 1.5px solid rgba(244,201,93,.7);
  border-radius: 28px;
  box-shadow: 0 0 0 6px rgba(244,201,93,.12), 0 40px 100px rgba(0,0,0,.55), 0 0 80px rgba(233,168,60,.25);
  transform: translateY(26px) scale(.96); opacity: 0;
  transition: transform .5s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
  scrollbar-width: thin;
}
.give-portal.is-open .give-card { transform: none; opacity: 1; }

.give-x {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.7);
  background: rgba(16,27,20,.45); color: #fff;
  font-size: 1rem; font-weight: 800; cursor: pointer;
  backdrop-filter: blur(4px);
  transition: transform .25s ease, background .25s ease;
}
.give-x:hover { transform: rotate(90deg) scale(1.08); background: var(--red); }

/* ── Hero art band ──────────────────────────────────────── */
.give-hero { position: relative; height: 190px; overflow: hidden; border-radius: 26px 26px 0 0; }
.give-hero img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 38%; display: block; transform: scale(1.04); }
.give-portal.is-open .give-hero img { animation: giveDrift 14s ease-in-out infinite alternate; }
@keyframes giveDrift { to { transform: scale(1.12) translateY(-6px); } }
.give-hero-shade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(16,27,20,0) 35%, rgba(249,242,227,.4) 72%, #FFFDF6 100%);
}
.give-seal {
  position: absolute; left: 50%; bottom: -2px; transform: translateX(-50%);
  width: 74px; height: 74px; padding: 6px; border-radius: 50%;
  background: #FFFDF6;
  box-shadow: 0 8px 24px rgba(46,36,24,.25), 0 0 0 4px rgba(244,201,93,.45), 0 0 34px rgba(244,201,93,.6);
  animation: giveSeal 3.2s ease-in-out infinite;
}
.give-seal svg { width: 100%; height: 100%; display: block; }
@keyframes giveSeal { 50% { box-shadow: 0 8px 24px rgba(46,36,24,.25), 0 0 0 7px rgba(244,201,93,.3), 0 0 50px rgba(244,201,93,.85); } }

/* ── Body ───────────────────────────────────────────────── */
.give-body { padding: 14px clamp(20px, 4.5vw, 42px) 26px; text-align: center; }
.give-kicker { font-weight: 800; font-size: .74rem; letter-spacing: .26em; text-transform: uppercase; color: var(--red); margin: 6px 0 4px; }
.give-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(1.6rem, 4.6vw, 2.25rem); line-height: 1.08;
  color: var(--ink); margin: 0 0 10px;
}
.give-title span {
  background: linear-gradient(100deg, #D88E20, var(--gold) 40%, #C8372D);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.give-lede { color: var(--ink-soft); font-size: .98rem; line-height: 1.55; margin: 0 auto 18px; max-width: 470px; }

/* ── Tabs (segmented) ───────────────────────────────────── */
.give-tabs {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: rgba(107,74,47,.1); border: 1.5px solid rgba(107,74,47,.16);
  border-radius: 999px; padding: 5px; margin: 0 auto 18px; max-width: 460px;
}
.give-tab {
  position: relative; z-index: 1;
  font: 800 .92rem/1.2 var(--font-body); color: var(--wood);
  background: none; border: 0; border-radius: 999px; padding: .8em .6em; cursor: pointer;
  transition: color .3s ease;
}
.give-tab.is-on { color: #3A2410; }
.give-tab:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.give-tab-glider {
  position: absolute; top: 5px; bottom: 5px; left: 5px; width: calc(50% - 5px);
  border-radius: 999px;
  background: linear-gradient(160deg, var(--gold-light), var(--gold) 60%, #D88E20);
  box-shadow: 0 6px 18px rgba(233,168,60,.45), inset 0 1px 0 rgba(255,255,255,.55);
  transition: transform .45s cubic-bezier(.34,1.56,.64,1);
}
.give-portal[data-tab="sponsor"] .give-tab-glider { transform: translateX(100%); }

.give-pane { animation: givePane .35s ease; }
@keyframes givePane { from { opacity: 0; transform: translateY(8px); } }
.give-step { font-weight: 800; font-size: .86rem; letter-spacing: .04em; color: var(--ink); margin: 0 0 10px; text-align: left; }
.give-step b {
  display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 6px;
  border-radius: 50%; background: var(--red); color: #fff; font-size: .75rem;
}
.give-hint { font-size: .84rem; color: var(--ink-soft); margin: 10px 0 0; }

/* ── Amount chips ───────────────────────────────────────── */
.give-chips { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.give-chip {
  font: 800 1.02rem/1 var(--font-body); color: var(--wood);
  background: #FFFDF6; border: 2px solid rgba(107,74,47,.2); border-radius: 16px;
  padding: 15px 4px; cursor: pointer; text-align: center;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), border-color .2s, box-shadow .2s, background .2s;
}
.give-chip:hover { transform: translateY(-2px); border-color: var(--gold); }
.give-chip.is-on {
  background: linear-gradient(160deg, #FFF7E2, #FBE7B5);
  border-color: var(--gold); color: #3A2410;
  box-shadow: 0 0 0 3px rgba(244,201,93,.35), 0 8px 20px rgba(233,168,60,.3);
}
.give-chip:focus-visible, .give-chip-other:focus-within { outline: 3px solid var(--red); outline-offset: 2px; }
.give-chip-other { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 6px; cursor: text; }
.give-chip-other > span:first-child { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; }
.give-other-wrap { display: flex; align-items: center; gap: 1px; font-size: .95rem; }
.give-other-wrap input {
  width: 100%; min-width: 0; max-width: 64px; border: 0; background: transparent;
  font: 800 .95rem var(--font-body); color: #3A2410; text-align: center; padding: 0;
  -moz-appearance: textfield; appearance: textfield;
}
.give-other-wrap input:focus { outline: none; }
.give-other-wrap input::-webkit-outer-spin-button, .give-other-wrap input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* ── Episode picker ─────────────────────────────────────── */
.give-eps {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  max-height: 238px; overflow-y: auto; padding: 4px 4px 6px; margin: 0 -4px;
  scrollbar-width: thin;
  mask-image: linear-gradient(180deg, #000 88%, transparent);
  -webkit-mask-image: linear-gradient(180deg, #000 88%, transparent);
}
.give-ep {
  position: relative; text-align: left; cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; min-height: 74px;
  padding: 10px 12px 10px 14px; border-radius: 14px;
  background: #FFFDF6; border: 2px solid rgba(107,74,47,.14);
  font-family: var(--font-body); color: var(--ink);
  overflow: hidden;
  transition: transform .2s cubic-bezier(.34,1.56,.64,1), border-color .2s, box-shadow .2s;
}
.give-ep::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--ep-color); }
.give-ep:hover { transform: translateY(-2px); border-color: var(--ep-color); }
.give-ep:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.give-ep-num { font-weight: 800; font-size: .66rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ep-color); color: color-mix(in srgb, var(--ep-color) 62%, #2E2418); }
.give-ep-title { font-family: var(--font-display); font-weight: 700; font-size: .86rem; line-height: 1.2; }
.give-ep.is-on {
  border-color: var(--ep-color);
  background: linear-gradient(160deg, #FFFDF6, #FBEFD6);
  box-shadow: 0 0 0 3px rgba(244,201,93,.4), 0 10px 22px rgba(46,36,24,.16);
}
.give-ep.is-on::after {
  content: "♥"; position: absolute; top: 7px; right: 9px;
  width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 50%; background: var(--red); color: #fff; font-size: .7rem;
  animation: givePop .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes givePop { from { transform: scale(0); } }
.give-picked { font-size: .88rem; color: var(--ink-soft); margin: 8px 0 16px; min-height: 1.3em; }
.give-picked strong { color: var(--ink); }
.give-shake { animation: giveShake .5s ease; }
@keyframes giveShake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.give-field { display: block; text-align: left; margin: 16px 0 0; }
.give-field > span { display: block; font-weight: 800; font-size: .86rem; color: var(--ink); margin: 0 0 6px; }
.give-field em { font-weight: 600; color: var(--ink-soft); font-style: normal; }
.give-field input {
  width: 100%; box-sizing: border-box; padding: 13px 16px; border-radius: 14px;
  border: 2px solid rgba(107,74,47,.2); background: #FFFDF6;
  font: 600 .98rem var(--font-body); color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.give-field input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(244,201,93,.35); }

/* ── The big button ─────────────────────────────────────── */
.give-go {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; gap: .5em;
  width: 100%; margin: 22px 0 0; padding: 1.15em 1.4em;
  border: 0; border-radius: 999px; cursor: pointer;
  font: 900 1.12rem/1.1 var(--font-body); letter-spacing: .01em; color: #fff;
  background: linear-gradient(160deg, #E0493E, var(--red) 55%, #9E2620);
  box-shadow: 0 10px 28px rgba(200,55,45,.45), inset 0 1px 0 rgba(255,255,255,.35), 0 0 0 4px rgba(244,201,93,.35);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .25s ease;
}
.give-go:hover { transform: translateY(-3px) scale(1.015); box-shadow: 0 16px 38px rgba(200,55,45,.55), inset 0 1px 0 rgba(255,255,255,.35), 0 0 0 5px rgba(244,201,93,.5); }
.give-go:active { transform: scale(.98); }
.give-go:focus-visible { outline: 3px solid var(--gold-light); outline-offset: 3px; }
.give-go-shine {
  position: absolute; top: 0; bottom: 0; left: -40%; width: 30%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.45), transparent);
  transform: skewX(-20deg);
  animation: giveShine 3.6s ease-in-out infinite;
}
@keyframes giveShine { 0%, 55% { left: -40%; } 100% { left: 130%; } }

.give-amt-hint { margin: 10px 0 0; font-size: .88rem; color: var(--ink-soft); min-height: 1.3em; }
.give-amt-hint strong { color: var(--red); font-size: 1rem; }
.give-err {
  margin: 12px 0 0; padding: 10px 14px; border-radius: 12px;
  background: #FCE8E5; color: #8E2019; font-weight: 700; font-size: .9rem;
}
.give-err[hidden], .give-pending[hidden] { display: none; }
.give-pending {
  margin: 14px 0 0; padding: 14px; border-radius: 16px;
  background: #FFF7E2; border: 1.5px dashed var(--gold);
  font-size: .92rem; color: var(--ink-soft);
}
.give-pending p { margin: 0 0 10px; }
.give-pending-yes {
  font: 800 .95rem var(--font-body); color: #3A2410; cursor: pointer;
  border: 0; border-radius: 999px; padding: .7em 1.6em;
  background: linear-gradient(160deg, var(--gold-light), var(--gold) 60%, #D88E20);
}
.give-secure { margin: 14px 0 4px; font-size: .84rem; font-weight: 700; color: var(--green); }
.give-mail { margin: 0; font-size: .8rem; color: var(--ink-soft); }
.give-foot { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px 18px; margin: 16px 0 0; padding-top: 14px; border-top: 1.5px solid rgba(107,74,47,.12); }
.give-later, .give-pray {
  background: none; border: 0; cursor: pointer; padding: 6px 4px;
  font: 700 .88rem var(--font-body); color: var(--wood);
  text-decoration: underline; text-decoration-color: rgba(107,74,47,.35); text-underline-offset: 3px;
}
.give-later:hover, .give-pray:hover { color: var(--red); }

/* ── Sponsor band under the episode carousel ────────────── */
.give-sponsor-band { text-align: center; margin: 26px auto 0; padding: 0 20px; }
.give-sponsor-band p { margin: 10px 0 0; font-size: .9rem; color: var(--ink-soft); }

/* ── Thank-you screen ───────────────────────────────────── */
.give-thanks {
  position: fixed; inset: 0; z-index: 150;
  display: flex; flex-direction: column; padding: 18px; overflow-y: auto;
  background: radial-gradient(ellipse at 50% 28%, #2C5238 0%, var(--green-deep) 48%, #0A120D 100%);
  opacity: 0; transition: opacity .45s ease;
}
.give-thanks[hidden] { display: none; }
.give-thanks.is-open { opacity: 1; }
.ty-confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.ty-rays {
  position: fixed; left: 50%; top: 32%; width: 170vmax; height: 170vmax; margin: -85vmax 0 0 -85vmax;
  background: repeating-conic-gradient(from 0deg, rgba(244,201,93,.11) 0deg 8deg, transparent 8deg 22deg);
  border-radius: 50%; pointer-events: none;
  mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 62%);
  animation: tySpin 60s linear infinite;
}
@keyframes tySpin { to { transform: rotate(360deg); } }
.ty-card { position: relative; z-index: 3; width: 100%; max-width: 640px; margin: auto; text-align: center; padding: 20px 0 10px; color: var(--cream); }
.ty-kicker { font-weight: 800; font-size: .78rem; letter-spacing: .28em; text-transform: uppercase; color: var(--gold-light); margin: 0 0 4px; }
.ty-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: clamp(3.2rem, min(13vw, 14vh), 7rem); line-height: .95; letter-spacing: .01em;
  margin: 0 0 18px;
}
.ty-w { display: inline-block; white-space: nowrap; }
.ty-l {
  display: inline-block;
  background: linear-gradient(180deg, #FFF3C4 0%, var(--gold-light) 40%, var(--gold) 70%, #C9781A 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 4px 0 #6B3E12) drop-shadow(0 0 26px rgba(244,201,93,.55));
  opacity: 0; transform: translateY(60px) scale(.4) rotate(-12deg);
}
.give-thanks.is-open .ty-l { animation: tyLetter .8s cubic-bezier(.34,1.56,.64,1) forwards, tyBob 2.8s ease-in-out infinite; animation-delay: calc(var(--i) * 70ms + 150ms), calc(var(--i) * 120ms + 1.2s); }
@keyframes tyLetter { to { opacity: 1; transform: none; } }
@keyframes tyBob { 0%, 100% { transform: none; } 50% { transform: translateY(-7px); } }

.ty-polaroid {
  width: min(330px, 78vw, 40vh); margin: 0 auto 20px; padding: 12px 12px 14px;
  background: #FFFDF6; border-radius: 6px;
  box-shadow: 0 24px 50px rgba(0,0,0,.5), 0 0 60px rgba(244,201,93,.25);
  transform: rotate(-3deg) scale(.6); opacity: 0;
}
.give-thanks.is-open .ty-polaroid { animation: tyPol .9s cubic-bezier(.34,1.56,.64,1) .75s forwards; }
@keyframes tyPol { to { transform: rotate(-3deg); opacity: 1; } }
.ty-polaroid img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; border-radius: 3px; }
.ty-polaroid figcaption { font-family: var(--font-display); font-style: italic; font-weight: 600; color: var(--wood); margin-top: 10px; font-size: 1rem; }

.ty-gift, .ty-msg, .ty-sign, .ty-actions, .ty-close { opacity: 0; }
.give-thanks.is-open .ty-gift  { animation: tyUp .6s ease 1.25s forwards; }
.give-thanks.is-open .ty-msg   { animation: tyUp .6s ease 1.4s forwards; }
.give-thanks.is-open .ty-sign  { animation: tyUp .6s ease 1.55s forwards; }
.give-thanks.is-open .ty-actions, .give-thanks.is-open .ty-close { animation: tyUp .6s ease 1.7s forwards; }
@keyframes tyUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.ty-gift { font-size: clamp(1.05rem, 2.6vw, 1.25rem); margin: 0 0 10px; color: #fff; }
.ty-gift[hidden] { display: none; }
.ty-gift strong { color: var(--gold-light); }
.ty-honor { display: inline-block; margin-top: 6px; font-family: var(--font-display); font-style: italic; color: var(--cream); opacity: .9; }
.ty-msg { font-size: 1.02rem; line-height: 1.6; max-width: 520px; margin: 0 auto 14px; color: rgba(249,242,227,.92); }
.ty-sign { font-size: .95rem; color: rgba(249,242,227,.8); margin: 0 0 22px; }
.ty-sign strong { color: var(--cream); font-family: var(--font-display); font-size: 1.1rem; }
.ty-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
.ty-copied { margin: 12px 0 0; font-weight: 700; color: var(--gold-light); }
.ty-copied[hidden] { display: none; }
.ty-close {
  margin: 20px 0 0; background: none; border: 0; cursor: pointer;
  font: 700 .95rem var(--font-body); color: rgba(249,242,227,.85);
  text-decoration: underline; text-underline-offset: 4px;
}
.ty-close:hover { color: var(--gold-light); }

/* thank-you.html: a plain page behind the overlay */
body[data-give-page="thanks"] { background: var(--green-deep); min-height: 100vh; }

/* ── Short screens (laptops) ────────────────────────────── */
@media (max-height: 760px) { .give-hero { height: 140px; } }

/* ── Small screens ──────────────────────────────────────── */
@media (max-width: 560px) {
  .give-portal { padding: 0; align-items: end; }
  .give-card { max-height: 94vh; max-height: 94dvh; border-radius: 26px 26px 0 0; transform: translateY(60px); }
  .give-hero { height: 140px; }
  .give-seal { width: 62px; height: 62px; }
  .give-chips { grid-template-columns: repeat(3, 1fr); }
  .give-eps { grid-template-columns: repeat(2, 1fr); max-height: 210px; }
  .give-tab { font-size: .84rem; }
  .ty-title { font-size: clamp(3rem, 19vw, 4.6rem); }
}

@media (prefers-reduced-motion: reduce) {
  .ty-l, .ty-polaroid, .ty-gift, .ty-msg, .ty-sign, .ty-actions, .ty-close { opacity: 1 !important; transform: none !important; }
  .ty-polaroid { transform: rotate(-3deg) !important; }
  .give-go-shine, .ty-rays { display: none; }
}

/* Sponsor a Lesson: name-in-the-credits promise (2026-11-02) */
.give-credits { margin: 0 0 14px; padding: 10px 14px; border-radius: 14px; font-size: .9rem; font-weight: 700; color: var(--ink);
  background: linear-gradient(135deg, rgba(244,196,48,.22), rgba(255,236,170,.35)); border: 1.5px solid rgba(201,148,22,.45);
  box-shadow: 0 0 0 3px rgba(244,196,48,.10), 0 6px 18px -10px rgba(201,148,22,.6); }
.give-credits strong { color: #8a5a00; }

