/* room service · gentle note for guests on a gift pass (comped tier with an end date) · v3 floating card */
(function(){
if(/^\/join\/?$/.test(location.pathname))return;
function ss(k,v){try{if(v===undefined)return sessionStorage.getItem(k);sessionStorage.setItem(k,v)}catch(e){return null}}
document.addEventListener('DOMContentLoaded',async function(){try{
if(ss('rs_guest_x'))return;
var r=await fetch('/members/api/member/',{credentials:'include'});if(r.status!==200)return;var m=await r.json();
if(m.status!=='comped')return;
var g=(m.subscriptions||[]).find(function(s){return !s.id&&s.tier&&s.tier.expiry_at});if(!g)return;
var left=Math.ceil((new Date(g.tier.expiry_at)-Date.now())/864e5);if(!(left>0)||left>14)return;
var bar=document.createElement('div');bar.className='rs-guest';
bar.style.cssText='position:fixed;left:50%;bottom:calc(18px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);z-index:2147483000;width:max-content;max-width:min(560px,calc(100vw - 24px));box-sizing:border-box;background:#34414C;color:#F2E2CA;border-radius:14px;box-shadow:0 10px 30px rgba(13,13,13,.35);font-size:12px;line-height:1.55;letter-spacing:.02em;text-align:left;padding:13px 40px 13px 18px;opacity:0;transition:opacity .6s';
bar.innerHTML='consider supporting the art|join now and receive gifts';
bar.querySelector('button').onclick=function(){bar.remove();ss('rs_guest_x','1')};
setTimeout(function(){document.body.appendChild(bar);requestAnimationFrame(function(){bar.style.opacity='1'})},1500);
}catch(e){}});
})();