/* The card's setting and the globe's artwork: a wooden tabletop at night, soft lights behind, a glass globe on a turned stand.
   Loaded after styles.css, which holds the layout, the gift, the messages and the studio. */
#sky{z-index:6}

/* ---------- the room ---------- */
.stage{isolation:isolate;overflow:clip;background:radial-gradient(110% 44% at 50% 0,#10141f 0,#06070b 100%)}
.pedestal{width:calc(var(--g)*1.16);height:calc(var(--g)*1.28)}
.pedestal::before{content:"";position:absolute;z-index:-1;left:50%;top:9%;width:100vw;height:115vh;transform:translateX(-50%);will-change:transform;
  -webkit-mask-image:linear-gradient(180deg,transparent 0,#000 calc(var(--g)*.55));mask-image:linear-gradient(180deg,transparent 0,#000 calc(var(--g)*.55));
  background:
    radial-gradient(ellipse calc(var(--g)*.95) calc(var(--g)*.26) at 50% calc(var(--g)*1.05),rgba(255,196,140,.16),transparent 72%),
    radial-gradient(ellipse max(62vw,calc(var(--g)*1.7)) calc(var(--g)*1.5) at 50% calc(var(--g)*.9),transparent 34%,rgba(5,5,8,.8) 100%),
    linear-gradient(180deg,rgba(6,7,11,.75) 0,rgba(6,7,11,0) calc(var(--g)*.8)),
    linear-gradient(180deg,transparent calc(var(--g)*1.15),rgba(5,4,6,.72) calc(var(--g)*1.7),rgba(5,4,6,.94) calc(var(--g)*2.4)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1024' height='512'%3E%3Cfilter id='a' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.0025 .055' numOctaves='3' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .19 0 0 0 0 .11 1.4 0 0 0 -.3'/%3E%3C/filter%3E%3Cfilter id='b' x='0' y='0' width='100%25' height='100%25' color-interpolation-filters='sRGB'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .7' numOctaves='2' seed='9' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .07 0 0 0 0 .03 0 0 0 0 .02 1.8 0 0 0 -.62'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' fill='%232b170e'/%3E%3Crect width='100%25' height='100%25' filter='url(%23a)'/%3E%3Crect width='100%25' height='100%25' filter='url(%23b)'/%3E%3C/svg%3E") 50% 0/1024px 512px}
.shadow{left:2%;right:-12%;bottom:-1%;height:17%;background:radial-gradient(closest-side,rgba(0,0,0,.78),rgba(0,0,0,.35) 60%,transparent);filter:blur(6px)}
.burst-fade .rays{opacity:0}
.bokeh{position:absolute;z-index:-1;inset:0 0 auto;height:46%;overflow:hidden;pointer-events:none}
.bokeh i{position:absolute;aspect-ratio:1;border-radius:50%;background:radial-gradient(circle,rgb(var(--c)/.24) 0 56%,rgb(var(--c)/.4) 65%,rgb(var(--c)/0) 71%);animation:glimmer 6s ease-in-out infinite alternate}
@keyframes glimmer{from{opacity:.3}to{opacity:1}}

/* ---------- fitting the window: nothing scrolls. The words and buttons take the room they need and the globe takes the rest ---------- */
.stage{padding:64px 20px max(20px,env(safe-area-inset-bottom));gap:clamp(8px,2vh,22px);transition:padding-top .9s cubic-bezier(.4,0,.2,1)}
.seat{flex:none;display:grid;place-items:center}
.panel{min-height:0;gap:12px}
.message{min-height:0;justify-content:center;overflow:hidden}
[data-scene="globe"] .message{min-height:4.9rem}
.message>*{flex:none}
.message>.say{flex:0 1 auto;min-height:1.35em;overflow-y:auto;scrollbar-width:thin}
.message[data-len="2"] .say{font-size:clamp(1.1rem,3.1vw,1.3rem)}
.message[data-len="3"] .say{font-size:clamp(.98rem,2.8vw,1.12rem);line-height:1.3}
.panel:has(.message[data-len="3"]){width:min(46rem,100%)}
.message[data-len="3"] .say{max-width:none}
.sign.small{font-size:clamp(1.5rem,5.5vw,2rem)}
.acts{display:flex;flex-wrap:wrap;align-items:center;justify-content:center;gap:10px}
.vslot{display:contents}
.hint{min-height:0}
.hint:empty{display:none}
@supports (width:1cqw){
  .stage{height:100vh;height:100dvh;min-height:0}
  .seat{flex:1 1 0;align-self:stretch;min-height:128px;max-height:calc(min(430px,(100vw - 40px)/1.16)*1.28);container-type:size}
  .pedestal{--g:min(100cqw/1.16,100cqh/1.28,430px)}
  .panel{flex:0 1 auto}
  .message{flex:0 1 auto}
}
@media (max-width:600px){
  .stage{padding:14px 16px max(12px,env(safe-area-inset-bottom));gap:12px}
  .stage[data-scene="gift"],.stage:has(.exit){padding-top:58px} /* room for the title beside the sound button, and for "Back to editing" */
  .seat{max-height:calc((100vw - 32px)/1.16*1.28)}
  .hint:not(:has(a)):not(.show){display:none}
  .panel:has(.hint a) .dots{display:none}
  .sign{font-size:clamp(2rem,8vw,2.6rem)}
}
@media (orientation:landscape) and (max-height:520px){ /* a phone on its side: the globe takes the left half, words and buttons the right */
  .stage,.stage[data-scene="gift"],.stage:has(.exit){padding:12px max(16px,env(safe-area-inset-right)) 12px 50%;gap:10px}
  .seat{position:absolute;left:max(12px,env(safe-area-inset-left));top:12px;bottom:12px;width:calc(50% - 24px - env(safe-area-inset-left));max-height:none}
  .pedestal::before{width:230vw}
  .lede{flex:0 1 auto;min-height:0}
  .lede h1{font-size:clamp(1.3rem,7vh,2rem)}
  .panel{padding-right:52px}
  .stage:has(.exit) .panel{padding-top:40px}
  .hint:not(:has(a)):not(.show){display:none}
  .panel:has(.hint a) .dots{display:none}
}

/* ---------- the close look: after each shake the globe comes forward, then is set back down ---------- */
.pedestal{transform-origin:50% 0;transition:transform .9s cubic-bezier(.3,0,.2,1)}
.zoomed .pedestal{transform:var(--zoom)}
.panel{position:relative;z-index:3}
.message{transition:opacity .35s,transform .85s cubic-bezier(.3,0,.2,1)}
.zoomed .message{transform:translateY(var(--drop))}
.zoomed .message.arrive{animation-name:arrive-low}
@keyframes arrive-low{from{opacity:0;transform:translateY(calc(var(--drop) + 12px))}}
.acts,.dots,.hint,.zoom{transition:opacity .35s}
.stage.zoomed :is(.acts,.dots,.hint,.zoom){opacity:0;pointer-events:none}
.stage::after{content:"";position:absolute;inset:var(--veil,60%) 0 0;z-index:2;pointer-events:none;opacity:0;transition:opacity .8s;background:linear-gradient(180deg,rgba(6,7,11,0) 0,rgba(6,7,11,.94) 56px,#06070b 120px)}
.zoomed::after{opacity:1}
.stage .globe:has(.pic){cursor:zoom-in}
[data-scene="gift"] .gift{touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;cursor:grab;transition:opacity .8s,transform .8s,rotate .16s} /* the wrapping can be rubbed off */
.gift:is(.bow-off,:active){animation:none}
.glint{position:fixed;z-index:7;width:6px;height:6px;border-radius:50%;box-shadow:0 0 9px 2px rgba(255,214,130,.9);pointer-events:none}
.zoomed{cursor:zoom-out}

/* ---------- the globe ---------- */
.globe{display:block;width:calc(var(--g)*1.16);height:calc(var(--g)*1.26);transform-origin:50% 90%}
.globe .defs{position:absolute}
.stand{position:absolute;inset:0;width:100%;height:100%;pointer-events:none} /* drawn over the glass, so presses must pass through to the photo */
.glass{position:absolute;left:calc(var(--g)*.08);top:0;height:var(--g);background:radial-gradient(circle at 44% 36%,#3f4b63 0,#1f2737 52%,#0c111b 100%);box-shadow:0 0 0 1px rgba(255,255,255,.14),0 0 70px rgba(160,195,255,.14)}
.glass>.photo{inset:0 0 auto;height:78%}
.glass .scene{transition:opacity .25s}
.glass.pic .scene{opacity:0}
.gloss .win{transition:opacity .6s}
.glass.pic .win{opacity:.38}
.plate{font:400 34px var(--label);letter-spacing:4px;text-transform:uppercase;fill:#3a2808;text-shadow:0 1.2px 0 rgba(255,250,220,.55)}
.zoom{right:auto;left:calc(var(--g)*1.035);top:calc(var(--g)*.7)}

/* the globe is wider than its glass now, so the small previews in the studio step down a size */
.preview{--g:226px}
.pos-dlg{--g:min(64vw,270px)}
@media (max-width:860px){
  .preview{--g:180px}
}
@media (prefers-reduced-motion:reduce){
  .bokeh i{animation:none}
}

/* ---------- the end of a card: make your own, or reply to the sender ---------- */
.end-cta{display:flex;flex-direction:column;align-items:stretch;gap:10px;width:min(22rem,100%);margin:6px auto 0}
.end-cta .btn-brass{min-height:52px;padding:1em 1.2em;font-size:.9rem;letter-spacing:.1em}
.end-cta .btn-ghost{min-height:48px;border-color:rgba(255,138,122,.55);color:#ffd3cc}
.hint:has(.end-cta){display:block;min-height:0;font-size:1rem}
.end-legal{display:flex;justify-content:center;gap:2px;font-size:.74rem;opacity:.7}
.end-legal a{display:inline-flex;align-items:center;min-height:32px;padding:0 6px;color:inherit}
.btn-brass.main.again{color:var(--frost);background:rgba(255,255,255,.06);border:1px solid var(--line);box-shadow:none}
