/* =====================================================================
   Surrey Roofing Assistant — voice + text widget (additive)
   Inherits the site design tokens from style.css (ink/amber/moss,
   Fraunces + IBM Plex, --radius:3px). No new palette invented.
   ===================================================================== */

.ra-launcher{
  position:fixed; right:18px; bottom:84px; z-index:900;
  display:inline-flex; align-items:center; gap:10px;
  background:var(--ink); color:var(--white);
  border:1px solid var(--slate-2); border-radius:40px;
  padding:12px 18px 12px 14px; cursor:pointer;
  font-family:var(--font-body); font-weight:600; font-size:.95rem;
  box-shadow:var(--shadow-2);
}
.ra-launcher:hover{background:var(--slate);}
.ra-launcher__dot{
  width:10px; height:10px; border-radius:50%; background:var(--amber);
  box-shadow:0 0 0 0 rgba(217,138,31,.6); animation:ra-pulse 2.4s infinite;
}
@keyframes ra-pulse{0%{box-shadow:0 0 0 0 rgba(217,138,31,.55);}70%{box-shadow:0 0 0 10px rgba(217,138,31,0);}100%{box-shadow:0 0 0 0 rgba(217,138,31,0);}}
@media (prefers-reduced-motion: reduce){.ra-launcher__dot{animation:none;}}

/* Panel ---------------------------------------------------------------- */
.ra-panel{
  position:fixed; right:18px; bottom:18px; z-index:950;
  width:min(400px, calc(100vw - 24px));
  height:min(640px, calc(100vh - 36px));
  background:var(--white); border:1px solid var(--line);
  border-radius:8px; box-shadow:var(--shadow-2);
  display:none; flex-direction:column; overflow:hidden;
}
.ra-panel.is-open{display:flex;}
.ra-panel.ra-emergency{border-color:var(--danger); box-shadow:0 0 0 3px rgba(166,61,47,.18), var(--shadow-2);}

.ra-head{
  background:var(--ink); color:var(--white);
  padding:14px 16px; display:flex; align-items:center; gap:12px;
}
.ra-panel.ra-emergency .ra-head{background:var(--danger);}
.ra-head__mark{width:26px;height:20px;flex:none;}
.ra-head__title{font-family:var(--font-display); font-weight:600; font-size:1.02rem; line-height:1.1;}
.ra-head__sub{font-family:var(--font-mono); font-size:.66rem; letter-spacing:.1em; text-transform:uppercase; color:var(--fog); opacity:.85;}
.ra-head__spacer{margin-left:auto;}
.ra-head__btn{
  background:transparent; border:1px solid rgba(255,255,255,.3); color:#fff;
  border-radius:var(--radius); width:32px; height:32px; cursor:pointer; font-size:1rem; line-height:1;
}
.ra-head__btn:hover{background:rgba(255,255,255,.12);}

/* Emergency banner ----------------------------------------------------- */
.ra-emerbar{display:none; background:var(--danger); color:#fff; padding:12px 14px; gap:8px;}
.ra-panel.ra-emergency .ra-emerbar{display:block;}
.ra-emerbar__row{display:flex; gap:8px; margin-bottom:8px;}
.ra-emerbar__btn{
  flex:1; text-align:center; text-decoration:none; font-weight:700; font-size:.92rem;
  background:#fff; color:var(--danger); border-radius:var(--radius); padding:12px 8px; border:none; cursor:pointer;
}
.ra-emerbar__btn--ghost{background:transparent; color:#fff; border:1px solid rgba(255,255,255,.55);}
.ra-emerbar__list{margin:6px 0 0; padding-left:18px; font-size:.82rem; line-height:1.5;}
.ra-emerbar__list li{margin-bottom:3px;}
.ra-emerbar summary{cursor:pointer; font-weight:600; font-size:.85rem;}

/* Log ------------------------------------------------------------------ */
.ra-log{flex:1; overflow-y:auto; padding:16px; display:flex; flex-direction:column; gap:12px; background:var(--fog);}
.ra-msg{max-width:86%; padding:11px 14px; border-radius:12px; font-size:.94rem; line-height:1.5; white-space:pre-wrap;}
.ra-msg--bot{background:var(--white); border:1px solid var(--line); border-bottom-left-radius:3px; align-self:flex-start;}
.ra-msg--user{background:var(--ink); color:var(--white); border-bottom-right-radius:3px; align-self:flex-end;}
.ra-msg a{color:var(--amber-dark); font-weight:600;}
.ra-msg--user a{color:var(--amber);}

.ra-typing{align-self:flex-start; display:flex; gap:4px; padding:12px 14px;}
.ra-typing span{width:7px;height:7px;border-radius:50%;background:var(--slate-2);animation:ra-bounce 1.2s infinite;}
.ra-typing span:nth-child(2){animation-delay:.15s;}
.ra-typing span:nth-child(3){animation-delay:.3s;}
@keyframes ra-bounce{0%,60%,100%{opacity:.3;transform:translateY(0);}30%{opacity:1;transform:translateY(-4px);}}
@media (prefers-reduced-motion: reduce){.ra-typing span{animation:none;}}

/* Rich blocks (video / actions / handoff) ------------------------------ */
.ra-card{background:var(--white); border:1px solid var(--line); border-radius:var(--radius); padding:12px; align-self:flex-start; max-width:92%;}
.ra-video{width:100%; border-radius:var(--radius); background:#000; margin-bottom:8px; aspect-ratio:16/9;}
.ra-card__cta{display:inline-flex; align-items:center; gap:8px; background:var(--amber); color:var(--ink); font-weight:600; text-decoration:none; padding:9px 14px; border-radius:var(--radius); font-size:.9rem; border:none; cursor:pointer;}
.ra-card__link{display:inline-block; margin-top:8px; color:var(--amber-dark); font-weight:600; text-decoration:none; font-size:.9rem;}

.ra-chips{display:flex; flex-wrap:wrap; gap:8px; padding:0 16px 10px; background:var(--fog);}
.ra-chip{background:var(--white); border:1px solid var(--line); border-radius:20px; padding:7px 13px; font-size:.82rem; cursor:pointer; color:var(--ink); font-family:var(--font-body);}
.ra-chip:hover{border-color:var(--amber); color:var(--amber-dark);}

/* Photos --------------------------------------------------------------- */
.ra-thumbs{display:flex; flex-wrap:wrap; gap:6px; margin-top:6px;}
.ra-thumbs img{width:56px; height:56px; object-fit:cover; border-radius:var(--radius); border:1px solid var(--line);}

/* Handoff form --------------------------------------------------------- */
.ra-form{display:flex; flex-direction:column; gap:8px; margin-top:8px;}
.ra-form input{font-family:var(--font-body); font-size:.9rem; padding:9px 11px; border:1px solid var(--line); border-radius:var(--radius); width:100%;}
.ra-form input:focus{outline:2px solid var(--amber); border-color:var(--amber);}

/* Composer ------------------------------------------------------------- */
.ra-foot{border-top:1px solid var(--line); background:var(--white); padding:10px; display:flex; align-items:flex-end; gap:8px;}
.ra-foot__icon{
  flex:none; width:42px; height:42px; border-radius:50%; border:1px solid var(--line);
  background:var(--white); cursor:pointer; display:flex; align-items:center; justify-content:center; color:var(--slate);
}
.ra-foot__icon:hover{border-color:var(--amber); color:var(--amber-dark);}
.ra-foot__icon svg{width:20px;height:20px;}
.ra-mic.is-listening{background:var(--danger); border-color:var(--danger); color:#fff; animation:ra-mic 1.4s infinite;}
@keyframes ra-mic{0%{box-shadow:0 0 0 0 rgba(166,61,47,.5);}70%{box-shadow:0 0 0 8px rgba(166,61,47,0);}100%{box-shadow:0 0 0 0 rgba(166,61,47,0);}}
@media (prefers-reduced-motion: reduce){.ra-mic.is-listening{animation:none;}}
.ra-input{flex:1; resize:none; max-height:96px; min-height:42px; font-family:var(--font-body); font-size:.94rem; padding:10px 12px; border:1px solid var(--line); border-radius:var(--radius); line-height:1.4;}
.ra-input:focus{outline:2px solid var(--amber); border-color:var(--amber);}
.ra-send{flex:none; background:var(--ink); color:#fff; border:none; border-radius:50%; width:42px; height:42px; cursor:pointer; display:flex; align-items:center; justify-content:center;}
.ra-send:hover{background:var(--slate);}
.ra-send svg{width:19px;height:19px;}

.ra-voicebadge{font-family:var(--font-mono); font-size:.66rem; letter-spacing:.08em; text-transform:uppercase; color:var(--slate-2); text-align:center; padding:0 0 8px; background:var(--white);}
.ra-voicebadge b{color:var(--moss);}

@media (max-width:480px){
  .ra-panel{right:0; bottom:0; width:100vw; height:100dvh; border-radius:0;}
  .ra-launcher{right:12px; bottom:78px;}
}
