/* Donation site — the film stage and its chapters. Tokens and components live in /shared/css/base.css. */

/* ---------- Stage: fixed behind everything ---------- */
.stage { position: fixed; inset: 0; z-index: 0; overflow: hidden; background: var(--ink); }
.stage-layer { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.poster { object-position: 68% 58%; transform-origin: 70% 60%; animation: drift 24s ease-in-out infinite alternate; will-change: transform; }
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.12) translate3d(-1.2%, -1%, 0); } }
#heroloop { opacity: 0; object-position: 68% 58%; transition: opacity .8s var(--ease); }
#reel { opacity: 0; --tiltx: 0; --tilty: 0; }
#reel video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0;
  transition: opacity .45s linear;   /* a short dissolve where one clip hands over to the next */
  /* the whole picture leans a little towards the pointer, like looking around a real scene */
  transform: scale(1.045) translate3d(calc(var(--tiltx) * -0.7%), calc(var(--tilty) * -0.7%), 0);
}
#reel video.on { opacity: 1; }
#gl { opacity: 0; pointer-events: none; }
.shade { background: var(--ink); opacity: 0; pointer-events: none; }
/* Cinematic framing: darker edges, readable type side */
.stage::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(130% 100% at 50% 40%, transparent 62%, rgba(4,9,8,.42) 100%),
    linear-gradient(180deg, rgba(4,9,8,.38) 0%, transparent 16%, transparent 62%, rgba(4,9,8,.62) 100%);
}

.progress { position: fixed; inset: 0 0 auto 0; height: 2px; z-index: 70; background: rgba(255,255,255,.08); }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-hi)); transform-origin: 0 50%; transform: scaleX(0); }
[dir="rtl"] .progress i { transform-origin: 100% 50%; }

main { position: relative; z-index: 2; }
em { font-style: italic; color: var(--gold-hi); padding-inline-end: .06em; }
[dir="rtl"] em { font-style: normal; }

/* ---------- Chapters ---------- */
.chapter { position: relative; }
.chapter[data-pin] { height: calc(var(--len, 200) * 1svh); }
.pin { position: sticky; top: 0; height: 100svh; display: grid; align-items: end; padding-block: 96px clamp(72px, 12vh, 140px); }
.solid { background: var(--ink); }

.hero { --len: 170; }
.film { --len: 360; }
.inside { --len: 1250; }
.night { --len: 420; }
.orbit { --len: 300; }

/* Hero */
.hero .pin::before, .film .pin::before, .inside .pin::before, .night .pin::before, .orbit .pin::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(62% 58% at 10% 92%, rgba(4,9,8,.82) 0%, rgba(4,9,8,.5) 38%, rgba(4,9,8,.14) 62%, transparent 78%);
}
[dir="rtl"] .hero .pin::before, [dir="rtl"] .film .pin::before, [dir="rtl"] .inside .pin::before, [dir="rtl"] .night .pin::before, [dir="rtl"] .orbit .pin::before { transform: scaleX(-1); }
#dust { pointer-events: none; mix-blend-mode: screen; }
.hero .pin::before { opacity: calc(1 - var(--p, 0) * 1.6); }
.hero-copy .eyebrow, .hero-copy .lede, .hero-actions { opacity: 0; transform: translate3d(0, 20px, 0); transition: opacity 1s var(--ease) .55s, transform 1s var(--ease) .55s; }
html.loaded .hero-copy .eyebrow, html.loaded .hero-copy .lede, html.loaded .hero-actions { opacity: 1; transform: none; }
.hero-copy { display: grid; gap: clamp(16px, 2.4vh, 28px); max-width: calc(900px + 2 * var(--gutter)); margin-inline: 0 auto; opacity: calc(1 - var(--p, 0) * 2.2); transform: translate3d(0, calc(var(--p, 0) * -60px), 0); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.rise { animation: rise 1.1s var(--ease) both; }
.rise:nth-child(2) { animation-delay: .12s; } .rise:nth-child(3) { animation-delay: .24s; } .rise:nth-child(4) { animation-delay: .36s; }
@keyframes rise { from { opacity: 0; transform: translate3d(0, 34px, 0); } }
.cue { position: absolute; inset-inline-end: var(--gutter); bottom: 28px; display: flex; align-items: center; gap: 12px; font: 600 .72rem/1 var(--sans); letter-spacing: .24em; text-transform: uppercase; color: var(--muted); opacity: calc(1 - var(--p, 0) * 6); }
.cue i { width: 1px; height: 54px; background: linear-gradient(var(--gold-hi), transparent); transform-origin: 50% 0; animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); } 100% { transform: scaleY(1); opacity: 0; } }

/* Beats: lines that come and go while the chapter is pinned */
.beats { position: relative; display: grid; }
.beat {
  grid-area: 1 / 1; align-self: end; display: grid; gap: 18px; justify-items: start; max-width: 46rem;
  opacity: 0; pointer-events: none;
  transition: opacity .7s var(--ease);
}
.beat.on { opacity: 1; pointer-events: auto; }
.beat .eyebrow, .beat .lede, .beat .btn, .beat .num { transform: translate3d(0, 18px, 0); transition: transform .9s var(--ease) .15s; }
.beat.on .eyebrow, .beat.on .lede, .beat.on .btn, .beat.on .num { transform: none; }
.beat h2 { max-width: 12em; font-size: clamp(2.6rem, 7vw, 6.2rem); text-shadow: 0 2px 30px rgba(0,0,0,.45), 0 0 80px rgba(0,0,0,.25); }
.hero h1 { text-shadow: 0 2px 30px rgba(0,0,0,.45); }
.room .num { font: 300 clamp(4rem, 12vw, 9rem)/.8 var(--serif); color: transparent; -webkit-text-stroke: 1px rgba(231,207,147,.7); letter-spacing: -.03em; }
.room .lede { text-shadow: 0 1px 24px rgba(0,0,0,.7); }

/* Chapter rail: where you are in the walk */
.rail { position: absolute; inset-inline-end: var(--gutter); top: 50%; transform: translateY(-50%); margin: 0; padding: 0; list-style: none; display: grid; gap: 14px; font: 600 .7rem/1 var(--sans); letter-spacing: .2em; text-transform: uppercase; color: rgba(243,239,228,.45); text-align: end; }
[dir="rtl"] .rail { letter-spacing: 0; font-size: .85rem; }
.rail li { position: relative; padding-inline-end: 26px; transition: color .5s var(--ease); }
.rail li::after { content: ""; position: absolute; inset-inline-end: 0; top: 50%; width: 14px; height: 1px; background: currentColor; transform-origin: 100% 50%; transition: transform .5s var(--ease), background-color .5s var(--ease); }
[dir="rtl"] .rail li::after { transform-origin: 0 50%; }
.inside { --step: calc(var(--p, 0) * 5); }
.rail li.now { color: var(--gold-hi); }
.rail li.now::after { transform: scaleX(2.4); }
.drag-hint { display: inline-flex; align-items: center; gap: 14px; }
.orbit .pin { cursor: ew-resize; touch-action: pan-y; }

/* Rabbi */
.rabbi { padding-block: clamp(110px, 18vh, 220px); overflow: hidden; }
.rabbi::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 70% at 22% 50%, rgba(205,174,104,.12), transparent 70%); pointer-events: none; }
.rabbi-grid { position: relative; display: grid; gap: clamp(32px, 7vw, 110px); align-items: center; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); }
.portrait { border-radius: 4px; overflow: hidden; box-shadow: 0 60px 140px rgba(0,0,0,.7); aspect-ratio: 4 / 5; }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%; transform: scale(1.12); transition: transform 2.2s var(--ease); }
.portrait.in img { transform: scale(1.02); }
.quote { margin: 0; display: grid; gap: 28px; justify-items: start; }
.quote blockquote { margin: 0; }
.quote blockquote p { font: 400 clamp(2rem, 4.6vw, 4.2rem)/1.08 var(--serif); letter-spacing: -.012em; }
.quote blockquote p span { transition: opacity .5s var(--ease); }
[dir="rtl"] .quote blockquote p { line-height: 1.22; letter-spacing: 0; }

/* Goal: an outlined number that fills with gold as gifts arrive */
.goal { padding-block: clamp(110px, 20vh, 220px); overflow: hidden; text-align: center; }
.goal::before { content: ""; position: absolute; inset: 0; background: radial-gradient(50% 60% at 50% 55%, rgba(205,174,104,.14), transparent 70%); pointer-events: none; }
.goal-inner { position: relative; display: grid; justify-items: center; gap: 26px; }
.goal-num { position: relative; margin: 0; font: 300 clamp(3.6rem, 15vw, 13rem)/.9 var(--serif); letter-spacing: -.045em; font-variant-numeric: lining-nums; white-space: nowrap; }
.goal-ghost {
  color: transparent; -webkit-text-stroke: 1.5px rgba(231,207,147,.85);
  /* a slow band of light passes across the outline */
  background: linear-gradient(100deg, transparent 35%, rgba(255,236,190,.55) 50%, transparent 65%) 0 0 / 300% 100% no-repeat;
  -webkit-background-clip: text; background-clip: text;
  animation: sheen 5.5s cubic-bezier(.45,0,.55,1) infinite;
}
@keyframes sheen { from { background-position: 120% 0; } to { background-position: -40% 0; } }
.goal-fill { position: absolute; inset: 0; color: var(--gold-hi); clip-path: inset(calc(100% - var(--fill, 0%)) 0 0 0); transition: clip-path 2.4s cubic-bezier(.16,1,.3,1); text-shadow: 0 0 60px rgba(231,207,147,.35); }
.goal-raised { font-weight: 600; color: var(--gold-hi); letter-spacing: .02em; }

/* Give */
.give-scene { min-height: 100svh; display: grid; align-items: center; padding-block: 110px 80px; background: linear-gradient(180deg, var(--ink) 0%, rgba(7,15,12,0) 24%, rgba(7,15,12,0) 62%, rgba(7,15,12,.7) 100%); }
.give-grid { display: grid; gap: clamp(28px, 5vw, 72px); align-items: end; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); }
.give-copy { --gap: 18px; align-self: end; padding-bottom: 8px; }
.raised { font-weight: 600; color: var(--gold-hi); }
.give { display: grid; gap: 16px; scroll-margin-top: 90px; }
.give-title { font: 600 1.15rem/1.2 var(--sans); }
.ref-note { background: rgba(205,174,104,.14); border: 1px solid rgba(205,174,104,.35); border-radius: 10px; padding: 10px 12px; font-size: .92rem; }

.seg, .amounts { display: grid; gap: 8px; }
.seg { grid-template-columns: 1fr 1fr; }
.amounts { grid-template-columns: repeat(3, 1fr); }
.seg label, .amounts label { position: relative; cursor: pointer; }
.seg input, .amounts input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.seg span, .amounts span {
  display: grid; place-items: center; min-height: 54px; padding: 0 6px; font-weight: 700;
  border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,.05);
  transition: background-color .25s var(--ease), border-color .25s var(--ease), color .25s var(--ease), transform .25s var(--ease), box-shadow .25s var(--ease);
}
.seg label:hover span, .amounts label:hover span { border-color: var(--gold); transform: translateY(-1px); }
.seg label:active span, .amounts label:active span { transform: scale(.97); }
.seg input:checked + span, .amounts input:checked + span { background: var(--gold-hi); border-color: var(--gold-hi); color: #17130a; box-shadow: 0 8px 30px -8px rgba(205,174,104,.7); }
.seg input:focus-visible + span, .amounts input:focus-visible + span { outline: 2px solid var(--gold-hi); outline-offset: 3px; }
.money { position: relative; }
.money span { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); font-weight: 700; color: var(--muted); }
.money .input { padding-inline-start: 32px; font-weight: 700; }
.trust { text-align: center; }

/* FAQ */
.faq-section { padding-block: clamp(80px, 12vh, 150px); }
.faq-photo { margin-top: 36px; border-radius: 4px; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 30%; }
.faq-grid { display: grid; gap: clamp(28px, 6vw, 90px); grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); align-items: start; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-of-type { border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.faq summary { cursor: pointer; list-style: none; padding: 22px 0; font: 400 1.35rem/1.25 var(--serif); min-height: 44px; display: flex; justify-content: space-between; gap: 16px; align-items: center; transition: color .2s var(--ease); }
.faq summary:hover { color: var(--gold-hi); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 300 1.6rem/1 var(--sans); color: var(--gold); transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 24px; color: var(--muted); max-width: 40em; }

/* Gift button that follows the story */
.sticky-give { position: fixed; z-index: 55; inset-inline-end: var(--gutter); bottom: 22px; transition: transform .5s var(--ease), opacity .5s var(--ease); }
.sticky-give[hidden] { display: inline-flex !important; transform: translateY(160%); opacity: 0; pointer-events: none; }

/* Thanks page */
.thanks { position: relative; z-index: 2; min-height: 100svh; display: grid; align-items: end; padding-block: 120px clamp(72px, 12vh, 140px); }
.thanks .stack { --gap: 24px; max-width: 780px; }
.thanks-actions { display: flex; flex-wrap: wrap; gap: 12px; }

@media (max-width: 900px) {
  .rabbi-grid, .give-grid, .faq-grid { grid-template-columns: minmax(0, 1fr); }
  .portrait { max-width: 420px; }
  .faq-photo { display: none; }
  .poster { object-position: 80% 50%; }
  #film { object-position: 80% 50%; }
  .hero .pin::before, .film .pin::before, .inside .pin::before, .night .pin::before, .orbit .pin::before,
  [dir="rtl"] .hero .pin::before, [dir="rtl"] .film .pin::before, [dir="rtl"] .inside .pin::before, [dir="rtl"] .night .pin::before, [dir="rtl"] .orbit .pin::before {
    transform: none; background: linear-gradient(180deg, transparent 46%, rgba(4,9,8,.5) 70%, rgba(4,9,8,.82) 100%);
  }
  .amounts { grid-template-columns: repeat(3, 1fr); }
  .sticky-give { inset-inline: 14px; bottom: 14px; }
  .give-scene { padding-bottom: 110px; }
  .foot { padding-bottom: 96px; }
  .cue, .rail { display: none; }
  .portrait { max-width: 420px; }
}
@media (max-width: 380px) { .amounts { grid-template-columns: repeat(2, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  .poster { animation: none; }
  .beat { transform: none; filter: none; }
}

/* ---------- The 3D building ---------- */
#world { z-index: 1; }
#world[hidden] { display: none !important; }
.walk-btn { position: absolute; inset-inline-end: var(--gutter); bottom: clamp(72px, 12vh, 140px); gap: 10px; }
.walk-hud { position: fixed; inset: auto 0 0 0; z-index: 70; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; padding: 18px var(--gutter) 22px; background: linear-gradient(0deg, rgba(4,9,8,.75), transparent); pointer-events: none; }
.walk-hud > * { pointer-events: auto; }
.walk-hint { color: var(--muted); font-size: .9rem; }
.walk-actions { display: flex; gap: 10px; }
/* While walking, the page steps aside and the building takes the whole screen. */
body.exploring main, body.exploring .sticky-give, body.exploring .progress, body.exploring .stage::after { opacity: 0; pointer-events: none; transition: opacity .6s var(--ease); }
body.exploring .stage { z-index: 60; }
body.exploring #world { pointer-events: auto; }
@media (hover: none) { .walk-hint { display: none; } }
@media (max-width: 900px) { .walk-btn { inset-inline-end: auto; inset-inline-start: var(--gutter); bottom: auto; top: 84px; } }
