/* ==========================================================================
   Ray Savings — SunPay Energy mascot (hero art, video, "Ask Ray" chat)
   Self-contained: works on every page, whether or not it loads site.css.
   ========================================================================== */
:root{
  --ray-green:#0E5A34;
  --ray-green-dark:#0A4A2C;
  --ray-green-soft:#F1FAF4;
  --ray-sun:#FFC61A;
  --ray-ink:#0C1611;
  --ray-muted:#5E6F65;
}

/* ---------- Hero stage (home page) ---------- */
.ray-hero-stage{position:relative;width:100%;height:100%;display:flex;align-items:flex-end;justify-content:center}
.ray-hero-stage::before{
  content:"";position:absolute;inset:6% 4% 4% 4%;border-radius:50%;
  background:radial-gradient(circle at 50% 40%, #FFF3C4 0%, #FFE58A 38%, #F1FAF4 72%, rgba(241,250,244,0) 100%);
  z-index:0;
}
.ray-hero-img{position:relative;z-index:1;width:78%;height:auto;max-height:100%;object-fit:contain;
  filter:drop-shadow(0 18px 24px rgba(12,22,17,.18));animation:ray-bob 4.5s ease-in-out infinite}

/* ---------- Speech bubble ---------- */
.ray-bubble{
  position:absolute;z-index:2;top:2%;left:-2%;max-width:230px;
  background:#fff;color:var(--ray-ink);font:600 .98rem/1.35 inherit;padding:.8rem 1rem;border-radius:16px;
  box-shadow:0 10px 28px rgba(12,22,17,.14);border:2px solid var(--ray-sun);
}
.ray-bubble b{color:var(--ray-green)}
.ray-bubble::after{
  content:"";position:absolute;bottom:-11px;right:34px;width:18px;height:18px;background:#fff;
  border-right:2px solid var(--ray-sun);border-bottom:2px solid var(--ray-sun);transform:rotate(45deg);
}
/* Home hero: bubble sits top-right so it doesn't cover the stat cards */
.ray-hero-stage .ray-bubble{left:auto;right:-6%;top:4%}
.ray-hero-stage .ray-bubble::after{right:auto;left:30px;border-right:none;border-left:2px solid var(--ray-sun);transform:rotate(-45deg)}
@media (max-width:900px){ .ray-hero-stage .ray-bubble{right:0;top:0;max-width:200px;font-size:.88rem} }

/* ---------- Inline Ray (inner pages / landing pages) ---------- */
.ray-inline{display:flex;align-items:center;gap:1rem;margin:1.25rem 0 0}
.ray-inline img{width:110px;height:auto;flex:none;filter:drop-shadow(0 10px 14px rgba(12,22,17,.16))}
.ray-inline .ray-bubble{position:relative;top:auto;left:auto;max-width:none}
.ray-inline .ray-bubble::after{bottom:auto;right:auto;left:-11px;top:50%;margin-top:-9px;
  border-right:none;border-bottom:2px solid var(--ray-sun);border-left:2px solid var(--ray-sun);border-top:none}
/* Pointing Ray: put him on the right so he points at his speech bubble */
.ray-inline-rev{flex-direction:row-reverse;justify-content:flex-end}
.ray-inline-rev .ray-bubble::after{left:auto;right:-11px;transform:rotate(-135deg)}
.ray-inline-photo img{width:120px;border-radius:16px;filter:none;box-shadow:0 10px 22px rgba(12,22,17,.16)}
.ray-corner{position:absolute;right:2%;bottom:0;width:min(26vw,230px);height:auto;pointer-events:none;
  filter:drop-shadow(0 14px 20px rgba(12,22,17,.18));z-index:1}
@media (max-width:900px){ .ray-corner{display:none} }

/* ---------- Ray video block (Maine pages) ---------- */
.ray-video-section{padding:clamp(2.5rem,6vw,4.5rem) 1.25rem;background:var(--ray-green-soft)}
.ray-video-wrap{max-width:1040px;margin:0 auto;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,360px);gap:clamp(1.5rem,4vw,3.5rem);align-items:center}
.ray-video-copy h2{font-family:Fraunces,Georgia,serif;font-size:clamp(1.7rem,3.4vw,2.4rem);line-height:1.15;color:var(--ray-ink);margin:0 0 .75rem}
.ray-video-copy p{color:var(--ray-muted);font-size:1.05rem;line-height:1.6;margin:0 0 1.25rem}
.ray-util-toggle{display:inline-flex;background:#fff;border-radius:999px;padding:4px;box-shadow:inset 0 0 0 1.5px #d6e6dc;margin-bottom:1.25rem}
.ray-util-toggle button{border:0;background:transparent;font:700 .95rem/1 inherit;padding:.7rem 1.1rem;border-radius:999px;cursor:pointer;color:var(--ray-green)}
.ray-util-toggle button[aria-pressed="true"]{background:var(--ray-green);color:#fff}
.ray-video-frame{position:relative;border-radius:22px;overflow:hidden;box-shadow:0 18px 40px rgba(12,22,17,.18);background:#000;aspect-ratio:9/16}
.ray-video-frame video{display:block;width:100%;height:100%;object-fit:cover}
.ray-cta-row{display:flex;flex-wrap:wrap;gap:.75rem}
.ray-btn{display:inline-flex;align-items:center;gap:.5rem;text-decoration:none;font:700 1rem/1 inherit;padding:.95rem 1.35rem;border-radius:999px;transition:transform .15s ease, box-shadow .15s ease}
.ray-btn-primary{background:var(--ray-sun);color:var(--ray-ink);box-shadow:0 8px 20px rgba(233,164,0,.32)}
.ray-btn-ghost{background:#fff;color:var(--ray-green);box-shadow:inset 0 0 0 1.5px var(--ray-green)}
.ray-btn:hover{transform:translateY(-2px)}
@media (max-width:760px){
  .ray-video-wrap{grid-template-columns:1fr}
  .ray-video-frame{max-width:340px;margin:0 auto}
}

/* ---------- "Ask Ray" chat ---------- */
.ray-chat-launch{
  position:fixed;right:18px;bottom:18px;z-index:9998;width:74px;height:74px;border-radius:50%;
  border:3px solid var(--ray-sun);background:#fff;padding:0;cursor:pointer;
  box-shadow:0 10px 26px rgba(12,22,17,.28);display:grid;place-items:center;overflow:visible;
  transition:transform .2s ease;
}
.ray-chat-launch:hover{transform:scale(1.06)}
.ray-chat-launch img{width:100%;height:100%;border-radius:50%;object-fit:cover}
.ray-chat-launch .ray-dot{position:absolute;top:2px;right:2px;width:16px;height:16px;border-radius:50%;background:#2FA84F;border:2px solid #fff}
.ray-chat-teaser{
  position:fixed;right:102px;bottom:34px;z-index:9998;background:#fff;color:var(--ray-ink);
  font:600 .95rem/1.3 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;padding:.7rem .9rem;border-radius:14px;max-width:220px;
  box-shadow:0 10px 26px rgba(12,22,17,.18);border:2px solid var(--ray-sun);cursor:pointer;
  opacity:0;transform:translateY(6px);transition:opacity .3s ease, transform .3s ease;pointer-events:none;
}
.ray-chat-teaser.show{opacity:1;transform:none;pointer-events:auto}
.ray-chat-teaser .ray-x{margin-left:.4rem;color:var(--ray-muted);font-weight:700}

.ray-chat-panel{
  position:fixed;right:18px;bottom:104px;z-index:9999;width:min(370px,calc(100vw - 24px));height:min(560px,calc(100vh - 130px));
  background:#fff;border-radius:20px;box-shadow:0 24px 60px rgba(12,22,17,.3);display:flex;flex-direction:column;overflow:hidden;
  font-family:system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  opacity:0;transform:translateY(12px) scale(.98);pointer-events:none;transition:opacity .2s ease, transform .2s ease;
}
.ray-chat-panel.open{opacity:1;transform:none;pointer-events:auto}
.ray-chat-head{display:flex;align-items:center;gap:.7rem;padding:.85rem 1rem;background:var(--ray-green);color:#fff}
.ray-chat-head img{width:42px;height:42px;border-radius:50%;background:#fff;border:2px solid var(--ray-sun)}
.ray-chat-head strong{display:block;font-size:1.02rem}
.ray-chat-head small{opacity:.85;font-size:.8rem}
.ray-chat-close{margin-left:auto;background:transparent;border:0;color:#fff;font-size:1.6rem;line-height:1;cursor:pointer;padding:.2rem .4rem;border-radius:8px}
.ray-chat-close:focus-visible{outline:2px solid var(--ray-sun)}
.ray-chat-body{flex:1;overflow-y:auto;padding:1rem;background:#F7FAF8;display:flex;flex-direction:column;gap:.6rem}
.ray-msg{max-width:88%;padding:.7rem .85rem;border-radius:16px;font-size:.95rem;line-height:1.45;white-space:pre-line}
.ray-msg.ray{background:#fff;color:var(--ray-ink);border:1px solid #e3ebe6;border-bottom-left-radius:4px;align-self:flex-start}
.ray-msg.you{background:var(--ray-green);color:#fff;border-bottom-right-radius:4px;align-self:flex-end}
.ray-msg a{color:var(--ray-green);font-weight:700}
.ray-chips{display:flex;flex-wrap:wrap;gap:.45rem;padding:.75rem 1rem;max-height:42%;overflow-y:auto;border-top:1px solid #e3ebe6;background:#fff}
.ray-chip{border:1.5px solid var(--ray-green);background:#fff;color:var(--ray-green);font:600 .86rem/1.2 inherit;padding:.5rem .75rem;border-radius:999px;cursor:pointer}
.ray-chip:hover,.ray-chip:focus-visible{background:var(--ray-green-soft)}
.ray-chip.cta{background:var(--ray-sun);border-color:var(--ray-sun);color:var(--ray-ink);text-decoration:none}
.ray-typing{align-self:flex-start;color:var(--ray-muted);font-size:.85rem;padding:.2rem .4rem}
.ray-chat-foot{font-size:.7rem;color:var(--ray-muted);text-align:center;padding:.35rem .75rem .6rem;background:#fff}

@media (max-width:480px){
  .ray-chat-launch{width:64px;height:64px;right:12px;bottom:12px}
  .ray-chat-panel{right:12px;bottom:86px}
  .ray-chat-teaser{right:84px;bottom:24px}
}

@keyframes ray-bob{0%,100%{transform:translateY(0)}50%{transform:translateY(-8px)}}
@media (prefers-reduced-motion: reduce){
  .ray-hero-img{animation:none}
  .ray-chat-panel,.ray-chat-teaser{transition:none}
}
