/* The chat button and panel (js/chat.js) – "Ask about John Paul College", or Eddie the Eagle. On every public page.
   Colours: JPC Burgundy and JPC Blue only (Style Guide 2025), with white and neutral greys. JPC Blue is never the
   background of words (white on it is 3.9:1, below AA for body text): it is used for lines, the focus ring and
   Eddie's glow. Every text and background pair here passes WCAG 2.2 AA (tools/editor/test/test-chat-client.js
   checks them). Fonts: the site's own (Roboto, Raleway – self-hosted). Motion: everything animates for everyone,
   unless js/chat.js marks the widget data-motion="reduced" (the administrator's "Follow visitors' 'reduce motion'
   setting" ticked and the device asking for less motion): then nothing moves.
   z-index 1100: above the page, below the offline note (1200). Hidden when printing. */
.jpc-chat{--jpc-burgundy:#880D27;--jpc-burgundy-dark:#5c0919;--jpc-blue:#4980C1;--jpc-ink:#1f2328;--jpc-muted:#555b63;--jpc-line:#dfe2e6;--jpc-tint:#f6f4f5;
  --jpc-gap:max(16px,env(safe-area-inset-right,0px));--jpc-bottom:calc(max(16px,env(safe-area-inset-bottom,0px)) + var(--jpc-chat-offset,0px));
  font:400 15px/1.5 Roboto,"Segoe UI",system-ui,-apple-system,sans-serif;color:var(--jpc-ink);}
.jpc-chat *,.jpc-chat *::before,.jpc-chat *::after{box-sizing:border-box;}
.jpc-chat[hidden],.jpc-chat [hidden]{display:none !important;}   /* (the whole widget too: hidden while the page is being edited) */
.jpc-sr{position:absolute !important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0;}
.jpc-chat svg{width:24px;height:24px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;}

/* ---------------------------------------------------------------- the corner button */
.jpc-chat-launch{position:fixed;right:var(--jpc-gap);bottom:var(--jpc-bottom);z-index:1100;display:flex;align-items:center;justify-content:center;
  width:56px;height:56px;margin:0;padding:0;border:0;border-radius:50%;background:var(--jpc-burgundy);color:#fff;cursor:pointer;
  box-shadow:0 6px 18px rgba(0,0,0,.24),0 1px 3px rgba(0,0,0,.2);transition:transform .18s ease,box-shadow .18s ease;}
.jpc-chat-launch:hover{transform:translateY(-2px);box-shadow:0 10px 24px rgba(0,0,0,.28),0 2px 4px rgba(0,0,0,.2);}
.jpc-chat-launch:focus-visible{outline:3px solid #4980C1;outline-offset:3px;}
.jpc-chat-launch svg{width:28px;height:28px;}
.jpc-chat[data-mode="eddie"] .jpc-chat-launch{width:62px;height:62px;border:3px solid #fff;overflow:hidden;background:var(--jpc-burgundy);}
.jpc-chat[data-mode="eddie"] .jpc-chat-launch img{display:block;width:100%;height:100%;border-radius:50%;object-fit:cover;}
/* (12 Nov 2026) The button with words (js/chat.js, the settings' button style): "iconwords" – JPC Eddie's face or the
   speech icon at the corner end with the label beside it – and "words" – the label alone – are burgundy pills with
   bold white words (about 9.6:1), at least 44px tall, never wider than the screen less its gaps (a long label wraps).
   --jpc-launch-h is the button's height: the speech bubble and the side panel sit that far up, so they line up with
   the round button (56px, JPC Eddie's 62px) and the pills alike. */
.jpc-chat{--jpc-launch-h:56px;}
.jpc-chat[data-mode="eddie"]{--jpc-launch-h:62px;}
.jpc-chat[data-button="iconwords"]{--jpc-launch-h:56px;}
.jpc-chat[data-button="words"]{--jpc-launch-h:48px;}
.jpc-chat[data-button="iconwords"] .jpc-chat-launch,.jpc-chat[data-button="words"] .jpc-chat-launch{width:auto;min-width:44px;max-width:calc(100vw - 32px);min-height:44px;gap:10px;
  border-radius:999px;font:700 16px/1.25 Roboto,"Segoe UI",system-ui,sans-serif;text-align:center;}
.jpc-chat[data-button="iconwords"] .jpc-chat-launch{height:auto;min-height:56px;padding:4px 18px 4px 20px;}
.jpc-chat[data-button="words"] .jpc-chat-launch{height:auto;min-height:48px;padding:10px 22px;}
.jpc-chat-launch-words{min-width:0;color:#fff;overflow-wrap:anywhere;}
.jpc-chat[data-mode="eddie"][data-button="iconwords"] .jpc-chat-launch{padding:3px 3px 3px 20px;}
.jpc-chat[data-mode="eddie"][data-button="iconwords"] .jpc-chat-launch img{flex:none;width:44px;height:44px;border:2px solid #fff;}
.jpc-chat[data-mode="eddie"][data-button="words"] .jpc-chat-launch{border-width:2px;}
.jpc-chat[data-button="iconwords"] .jpc-chat-launch svg{flex:none;width:26px;height:26px;}
.jpc-chat.is-open .jpc-chat-launch{transform:none;}
/* (while the site's mobile menu is open everything behind it is inert, this widget too: then it isn't drawn over it) */
.jpc-chat[inert] .jpc-chat-launch,.jpc-chat[inert] .jpc-chat-bubble{visibility:hidden;}

/* ---------------------------------------------------------------- Eddie's greeting bubble */
.jpc-chat-bubble{position:fixed;right:var(--jpc-gap);bottom:calc(var(--jpc-bottom) + var(--jpc-launch-h) + 14px);z-index:1100;display:flex;align-items:flex-start;gap:10px;
  width:max-content;max-width:min(300px,calc(100vw - 32px));padding:12px 8px 12px 12px;border-radius:16px 16px 4px 16px;background:#fff;color:var(--jpc-ink);
  border:1px solid var(--jpc-line);box-shadow:0 10px 30px rgba(0,0,0,.18);transform-origin:100% 100%;animation:jpc-pop .32s cubic-bezier(.2,1.4,.4,1) both;}
.jpc-chat-bubble::after{content:'';position:absolute;right:22px;bottom:-8px;width:14px;height:14px;background:#fff;border-right:1px solid var(--jpc-line);border-bottom:1px solid var(--jpc-line);transform:rotate(45deg);}
.jpc-chat-bubble-img{flex:none;width:32px;height:32px;border-radius:50%;background:var(--jpc-burgundy);}
.jpc-chat-bubble-text{margin:4px 0 0;font-weight:500;cursor:pointer;}
.jpc-chat-bubble-close{flex:none;display:flex;align-items:center;justify-content:center;width:28px;height:28px;margin:0;padding:0;border:0;border-radius:50%;
  background:transparent;color:var(--jpc-muted);font:400 22px/1 Roboto,system-ui,sans-serif;cursor:pointer;}
.jpc-chat-bubble-close:hover{background:var(--jpc-tint);color:var(--jpc-ink);}
.jpc-chat-bubble-close:focus-visible{outline:3px solid #4980C1;outline-offset:1px;}
@keyframes jpc-pop{from{opacity:0;transform:scale(.6) translateY(8px);}to{opacity:1;transform:none;}}

/* ---------------------------------------------------------------- the panel */
.jpc-chat-panel{position:fixed;inset:auto var(--jpc-gap) calc(var(--jpc-bottom) + var(--jpc-launch-h) + 16px) auto;z-index:1100;width:380px;max-width:calc(100vw - 32px);
  height:min(640px,calc(100vh - 120px));max-height:none;margin:0;padding:0;border:0;border-radius:18px;overflow:hidden;background:#fff;color:var(--jpc-ink);
  box-shadow:0 18px 50px rgba(0,0,0,.28),0 2px 8px rgba(0,0,0,.12);flex-direction:column;}
.jpc-chat-panel[open]{display:flex;animation:jpc-rise .22s ease-out both;}
@keyframes jpc-rise{from{opacity:0;transform:translateY(12px);}to{opacity:1;transform:none;}}
/* (8 Nov 2026) Closing while the 3D JPC Eddie shows: the panel closes at once (focus, aria-expanded and Esc as ever)
   but stays on screen for half a second more, fading out and letting every click through, so his goodbye wave is
   seen. Transitions, not animations, so it fades only when an open panel closes (never when JPC Eddie finishes loading
   after the panel has closed); the panel rises in the same way as without him. A browser that can't animate a dialog's
   closing just closes it at once; with data-motion="reduced", nothing fades. (11 Nov 2026) .is-moving: put on by
   chat.js with the first 3D or animated JPC Eddie and never taken off, so when the animated picture takes over from 3D
   in an open panel (3D lost), the panel doesn't rise again and the oval stays. */
.jpc-chat-panel:has(.jpc-chat-stage.is-3d),.jpc-chat-panel:has(.jpc-chat-stage.is-anim),.jpc-chat-panel:has(.jpc-chat-stage.is-moving){transition:opacity .5s ease-in,transform .5s ease-in,display .5s allow-discrete;}
.jpc-chat-panel:not([open]):has(.jpc-chat-stage.is-3d),.jpc-chat-panel:not([open]):has(.jpc-chat-stage.is-anim),.jpc-chat-panel:not([open]):has(.jpc-chat-stage.is-moving){opacity:0;transform:translateY(6px);pointer-events:none;}
.jpc-chat-panel[open]:has(.jpc-chat-stage.is-3d),.jpc-chat-panel[open]:has(.jpc-chat-stage.is-anim),.jpc-chat-panel[open]:has(.jpc-chat-stage.is-moving){animation:none;opacity:1;transform:none;transition:opacity .22s ease-out,transform .22s ease-out;}
@starting-style{.jpc-chat-panel[open]:has(.jpc-chat-stage.is-3d),.jpc-chat-panel[open]:has(.jpc-chat-stage.is-anim),.jpc-chat-panel[open]:has(.jpc-chat-stage.is-moving){opacity:0;transform:translateY(12px);}}
.jpc-chat-panel::backdrop{background:rgba(0,0,0,.45);}

.jpc-chat-head{position:relative;flex:none;display:flex;flex-direction:column;justify-content:center;min-height:64px;padding:14px 60px 14px 18px;background:#880D27;color:#fff;}
.jpc-chat-head h2{margin:0;color:#fff;font:700 18px/1.25 Raleway,Roboto,system-ui,sans-serif;letter-spacing:.01em;}
.jpc-chat-sub{margin:2px 0 0;color:#fff;font-size:13.5px;line-height:1.35;opacity:.92;}
.jpc-chat-close{position:absolute;top:10px;right:10px;display:flex;align-items:center;justify-content:center;width:44px;height:44px;margin:0;padding:0;border:0;border-radius:50%;
  background:transparent;color:#fff;cursor:pointer;}
.jpc-chat-close:hover{background:rgba(255,255,255,.16);}
.jpc-chat-close:focus-visible{outline:3px solid #fff;outline-offset:-3px;}

/* Eddie's stage: his picture (or the 3D Eddie) in a soft JPC Blue glow on burgundy */
.jpc-chat[data-mode="eddie"] .jpc-chat-head{align-items:center;text-align:center;padding:0 56px 14px;}
.jpc-chat-stage{position:relative;width:calc(100% + 112px);height:clamp(150px,22vh,200px);margin:0 -56px 2px;display:flex;align-items:flex-end;justify-content:center;}
.jpc-chat-stage::before{content:'';position:absolute;left:50%;bottom:6px;width:180px;height:40px;margin-left:-90px;border-radius:50%;
  background:radial-gradient(closest-side,rgba(73,128,193,.55),rgba(73,128,193,0));pointer-events:none;}
.jpc-chat-full{position:relative;display:block;width:120px;height:120px;margin-bottom:8px;object-fit:contain;transition:opacity .4s ease;}
.jpc-chat-3d{position:absolute;inset:0;display:block;width:100%;height:100%;pointer-events:none;}
.jpc-chat-stage.is-3d .jpc-chat-full,.jpc-chat-stage.is-anim .jpc-chat-full{opacity:0;}
/* while the 3D or animated JPC Eddie loads (chat.js: about 0.9 s), the picture waits invisibly, with no fade, so a fast
   device never flashes it first; after that, or if he can't load, it fades in */
.jpc-chat-stage.is-wait3d .jpc-chat-full{opacity:0;transition:none;}
/* the 3D or animated Eddie stands on a lighter oval stage edged with a thin JPC Blue line, so his burgundy body doesn't
   sink into the burgundy header. Inside the oval (::before, under him) a soft JPC Blue tint behind his head fades to a
   pale grey-white behind his body and feet, so his white head and crest keep an edge against it (about 1.3:1 or more)
   and the burgundy stays bright */
.jpc-chat-stage.is-3d,.jpc-chat-stage.is-anim,.jpc-chat-stage.is-moving{background:radial-gradient(ellipse 33% 50% at 50% 50%,#fff 0,#f6f4f5 55%,#e4e7eb 89%,#4980C1 90.5%,#4980C1 92.5%,rgba(73,128,193,.3) 94.5%,rgba(73,128,193,0) 99%);}
.jpc-chat-stage.is-3d::before,.jpc-chat-stage.is-anim::before,.jpc-chat-stage.is-moving::before{display:block;left:20.2%;width:59.6%;bottom:auto;top:4.8%;height:90.4%;margin:0;border-radius:50%;
  background:linear-gradient(180deg,rgba(73,128,193,.39) 0,rgba(73,128,193,.31) 22%,rgba(73,128,193,.16) 46%,rgba(73,128,193,0) 64%),linear-gradient(180deg,#fff 0,#f4f6f9 64%,#eef0f3 100%);}
.jpc-chat[data-mode="eddie"][data-state="waiting"] .jpc-chat-full{animation:jpc-bob 1.6s ease-in-out infinite;}

/* ---------------------------------------------------------------- the animated JPC Eddie (js/chat-eddie-2d.js) */
/* (10 Nov 2026) The College's picture of JPC Eddie, cut by the build into six pictures of the same size (300 × 440,
   tools/eddie-picture.js), stacked: his body, his thumbs-up wing, his head with its jaw, upper beak and closed lids.
   Each part turns about a point the build measured (PIVOTS in tools/eddie-picture.js – the tests check these match):
   his feet 53.33% 98.64%, his wing's shoulder 33.33% 36.59%, his neck 52.5% 37.5%, his beak's hinge 50.83% 26.36%.
   data-clip names what he is doing (js/chat-eddie-2d.js, from the brain); the one-shots' lengths – greet 2.2 s,
   happy 1.8 s, unsure 2 s, goodbye 1.6 s – are ONE_SHOT_MS there. */
.jpc-eddie{position:absolute;left:0;right:0;bottom:6%;height:82%;aspect-ratio:300/440;margin:0 auto;pointer-events:none;}
.jpc-eddie img,.jpc-eddie-all,.jpc-eddie-wing,.jpc-eddie-head{position:absolute;inset:0;display:block;width:100%;height:100%;}
.jpc-eddie img{max-width:none;user-select:none;}
.jpc-eddie-shadow{position:absolute;left:18%;width:72%;top:95%;height:6%;border-radius:50%;background:radial-gradient(closest-side,rgba(0,0,0,.28),rgba(0,0,0,0));}
.jpc-eddie-all{transform-origin:53.33% 98.64%;}
.jpc-eddie-wing{transform-origin:33.33% 36.59%;}
.jpc-eddie-head{transform-origin:52.5% 37.5%;}
.jpc-eddie-head .jpc-eddie-jaw{transform-origin:50.83% 26.36%;}
/* the lids show only while he blinks: drawn down over his eyes (rows 15.2–21.4% of the frame) and back up */
.jpc-eddie-head .jpc-eddie-lids{opacity:0;clip-path:inset(15.2% 0 84.8% 0);}
.jpc-eddie.is-blink .jpc-eddie-lids{animation:jpc-ed-blink .16s ease-in-out;}
@keyframes jpc-ed-blink{0%{opacity:1;clip-path:inset(15.2% 0 84.8% 0);}45%,55%{opacity:1;clip-path:inset(15.2% 0 78.6% 0);}100%{opacity:1;clip-path:inset(15.2% 0 84.8% 0);}}
.jpc-eddie-dots{position:absolute;left:69%;top:5%;display:none;gap:5%;width:24%;}
.jpc-eddie-dots i{display:block;width:26%;aspect-ratio:1;border-radius:50%;background:#4980C1;opacity:.35;animation:jpc-ed-dot 1.2s ease-in-out infinite;}
.jpc-eddie-dots i:nth-child(2){animation-delay:.2s;}
.jpc-eddie-dots i:nth-child(3){animation-delay:.4s;}
.jpc-eddie[data-clip="thinking"] .jpc-eddie-dots{display:flex;}
@keyframes jpc-ed-dot{0%,80%,100%{opacity:.35;transform:none;}40%{opacity:1;transform:translateY(-35%);}}
/* (10 Nov 2026, round 2 – the owner: "the old one moved about more, and more fluidly") Bigger, smoother moves: every move
   eases in and out (--ed-ease), his whole body sways and leans, his head follows a moment later, the wave and the
   thumbs-up pump go higher, a hop crouches first and lands with a little squash. The parts' cuts stay hidden at these
   angles (checked at each move's widest point). */
.jpc-eddie{--ed-ease:cubic-bezier(.37,0,.63,1);}
/* idle: a slow sway and breath, his head following, the wing resting */
.jpc-eddie[data-clip="idle"] .jpc-eddie-all{animation:jpc-ed-idle 4.8s var(--ed-ease) infinite;}
.jpc-eddie[data-clip="idle"] .jpc-eddie-head{animation:jpc-ed-idlehead 4.8s var(--ed-ease) .3s infinite;}
.jpc-eddie[data-clip="idle"] .jpc-eddie-wing{animation:jpc-ed-rest 2.4s var(--ed-ease) infinite;}
@keyframes jpc-ed-idle{0%,100%{transform:none;}25%{transform:rotate(-1.4deg) scale(1.006,1.016);}50%{transform:none;}75%{transform:rotate(1.4deg) scale(1.006,1.016);}}
@keyframes jpc-ed-idlehead{0%,100%{transform:none;}25%{transform:rotate(3deg);}50%{transform:rotate(-.5deg);}75%{transform:rotate(-3deg);}}
@keyframes jpc-ed-rest{0%,100%{transform:none;}50%{transform:rotate(4deg);}}
/* greet (and goodbye, quicker): a crouch, then a big wave of his thumbs-up wing, leaning away from it, head tipped */
.jpc-eddie[data-clip="greet"] .jpc-eddie-wing{animation:jpc-ed-wave 2.2s var(--ed-ease) both;}
.jpc-eddie[data-clip="greet"] .jpc-eddie-head{animation:jpc-ed-tip 2.2s var(--ed-ease) both;}
.jpc-eddie[data-clip="greet"] .jpc-eddie-all{animation:jpc-ed-lean 2.2s var(--ed-ease) both;}
.jpc-eddie[data-clip="goodbye"] .jpc-eddie-wing{animation:jpc-ed-wave 1.6s var(--ed-ease) both;}
.jpc-eddie[data-clip="goodbye"] .jpc-eddie-head{animation:jpc-ed-tip 1.6s var(--ed-ease) both;}
.jpc-eddie[data-clip="goodbye"] .jpc-eddie-all{animation:jpc-ed-lean 1.6s var(--ed-ease) both;}
@keyframes jpc-ed-wave{0%{transform:none;}12%{transform:rotate(-5deg);}26%{transform:rotate(28deg);}40%{transform:rotate(9deg);}54%{transform:rotate(28deg);}68%{transform:rotate(9deg);}82%{transform:rotate(25deg);}100%{transform:none;}}
@keyframes jpc-ed-tip{0%,100%{transform:none;}22%{transform:rotate(-7deg);}50%{transform:rotate(-5deg) translateY(-.5%);}78%{transform:rotate(-7deg);}}
@keyframes jpc-ed-lean{0%{transform:none;}10%{transform:scale(1.02,.97);}24%{transform:rotate(2.5deg) scale(.995,1.02);}50%{transform:rotate(1.5deg);}76%{transform:rotate(2.5deg);}100%{transform:none;}}
/* listening (while the visitor types): leaning in, head tilted, with nods */
.jpc-eddie[data-clip="listening"] .jpc-eddie-head{animation:jpc-ed-listen 3s var(--ed-ease) infinite;}
.jpc-eddie[data-clip="listening"] .jpc-eddie-all{animation:jpc-ed-leanin 3s var(--ed-ease) infinite;}
@keyframes jpc-ed-listen{0%,100%{transform:rotate(6deg) translateY(.8%);}30%{transform:rotate(9deg) translateY(1.8%);}60%{transform:rotate(5deg) translateY(.6%);}}
@keyframes jpc-ed-leanin{0%,100%{transform:rotate(1deg);}50%{transform:rotate(2deg) scale(1.004,1.012);}}
/* thinking (while the answer is found): head tipped back, a slow sway, the wing drawn in, the dots */
.jpc-eddie[data-clip="thinking"] .jpc-eddie-head{animation:jpc-ed-think 2.6s var(--ed-ease) infinite;}
.jpc-eddie[data-clip="thinking"] .jpc-eddie-all{animation:jpc-ed-ponder 5.2s var(--ed-ease) infinite;}
.jpc-eddie[data-clip="thinking"] .jpc-eddie-wing{animation:jpc-ed-wingin 2.6s var(--ed-ease) infinite;}
@keyframes jpc-ed-think{0%,100%{transform:rotate(-9deg) translateY(-.8%);}50%{transform:rotate(-12deg) translateY(-1.8%);}}
@keyframes jpc-ed-ponder{0%,100%{transform:rotate(-1.2deg);}50%{transform:rotate(1.2deg);}}
@keyframes jpc-ed-wingin{0%,100%{transform:rotate(-7deg);}50%{transform:rotate(-3deg);}}
/* talking (while the answer appears): nods, a bounce, his wing gesturing; his beak opens and closes */
.jpc-eddie[data-clip="talking"] .jpc-eddie-head{animation:jpc-ed-nod .7s var(--ed-ease) infinite;}
.jpc-eddie[data-clip="talking"] .jpc-eddie-all{animation:jpc-ed-bounce 1.4s var(--ed-ease) infinite;}
.jpc-eddie[data-clip="talking"] .jpc-eddie-wing{animation:jpc-ed-gesture 2.8s var(--ed-ease) infinite;}
.jpc-eddie.is-beak .jpc-eddie-jaw{animation:jpc-ed-jaw .22s ease-in-out infinite alternate;}
@keyframes jpc-ed-nod{0%,100%{transform:rotate(-2.5deg);}50%{transform:rotate(3deg) translateY(.7%);}}
@keyframes jpc-ed-bounce{0%,100%{transform:none;}50%{transform:scale(1.008,1.02);}}
@keyframes jpc-ed-gesture{0%,100%{transform:none;}30%{transform:rotate(10deg);}60%{transform:rotate(2deg);}80%{transform:rotate(7deg);}}
@keyframes jpc-ed-jaw{from{transform:none;}to{transform:scaleY(.7);}}
/* happy (a thumbs up for an answer): a crouch, a big hop and a small one, pumping his thumbs-up wing */
.jpc-eddie[data-clip="happy"] .jpc-eddie-all{animation:jpc-ed-hop 1.8s var(--ed-ease) both;}
.jpc-eddie[data-clip="happy"] .jpc-eddie-wing{animation:jpc-ed-pump 1.8s var(--ed-ease) both;}
.jpc-eddie[data-clip="happy"] .jpc-eddie-head{animation:jpc-ed-cheer 1.8s var(--ed-ease) both;}
.jpc-eddie[data-clip="happy"] .jpc-eddie-shadow{animation:jpc-ed-shadow 1.8s var(--ed-ease) both;}
@keyframes jpc-ed-hop{0%{transform:none;}10%{transform:scale(1.06,.9);}28%{transform:translateY(-11%) scale(.97,1.05);}36%{transform:translateY(-11%) scale(.98,1.03);}48%{transform:scale(1.06,.92);}58%{transform:none;}70%{transform:translateY(-6%) scale(.99,1.02);}82%{transform:scale(1.03,.96);}92%,100%{transform:none;}}
@keyframes jpc-ed-shadow{0%,58%,92%,100%{transform:none;opacity:1;}10%,48%,82%{transform:scale(1.08);opacity:1;}28%,36%{transform:scale(.7);opacity:.5;}70%{transform:scale(.85);opacity:.75;}}
@keyframes jpc-ed-pump{0%{transform:none;}10%{transform:rotate(-6deg);}28%{transform:rotate(22deg) translateY(-2%);}44%{transform:rotate(6deg);}66%{transform:rotate(20deg) translateY(-2%);}88%,100%{transform:none;}}
@keyframes jpc-ed-cheer{0%,100%{transform:none;}28%{transform:rotate(-6deg) translateY(-1%);}50%{transform:rotate(2deg);}70%{transform:rotate(5deg);}}
/* unsure (the website doesn't cover it): a shrug and a tilt of the head, held, then back */
.jpc-eddie[data-clip="unsure"] .jpc-eddie-head{animation:jpc-ed-unsure 2s var(--ed-ease) both;}
.jpc-eddie[data-clip="unsure"] .jpc-eddie-all{animation:jpc-ed-shrug 2s var(--ed-ease) both;}
.jpc-eddie[data-clip="unsure"] .jpc-eddie-wing{animation:jpc-ed-wingshrug 2s var(--ed-ease) both;}
@keyframes jpc-ed-unsure{0%,100%{transform:none;}22%{transform:rotate(13deg) translateY(1%);}45%{transform:rotate(10deg) translateY(1%);}68%{transform:rotate(13deg) translateY(1%);}}
@keyframes jpc-ed-shrug{0%,100%{transform:none;}18%{transform:translateY(-1.5%) scale(1.01,1.04);}30%,70%{transform:scale(1.01,1.03);}86%{transform:scale(1.01,.99);}}
@keyframes jpc-ed-wingshrug{0%,100%{transform:none;}22%,70%{transform:rotate(-9deg) translateY(-2.5%);}}
.jpc-eddie.is-paused,.jpc-eddie.is-paused *{animation-play-state:paused !important;}

/* ---------------------------------------------------------------- the conversation */
.jpc-chat-log{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding:16px 14px 8px;display:flex;flex-direction:column;gap:12px;background:#fff;}
.jpc-chat-log:focus-visible{outline:3px solid #4980C1;outline-offset:-3px;}
.jpc-msg{display:flex;align-items:flex-end;gap:8px;max-width:100%;}
.jpc-msg-body{min-width:0;padding:10px 14px;border-radius:16px 16px 16px 4px;background:var(--jpc-tint);color:var(--jpc-ink);overflow-wrap:anywhere;}
.jpc-msg-body p{margin:0;}
.jpc-msg-body p+p,.jpc-msg-body p+ul,.jpc-msg-body ul+p{margin-top:8px;}
.jpc-msg-body ul{margin:6px 0 0;padding-left:20px;}
.jpc-msg-body li+li{margin-top:2px;}
.jpc-msg a{color:#880D27;font-weight:500;text-decoration:underline;text-underline-offset:2px;}
.jpc-msg a:hover{color:var(--jpc-burgundy-dark);}
.jpc-msg a:focus-visible,.jpc-chat-starters button:focus-visible,.jpc-msg-fb button:focus-visible{outline:3px solid #4980C1;outline-offset:2px;border-radius:4px;}
.jpc-msg-bot{flex-wrap:wrap;align-items:flex-start;padding-right:28px;}
.jpc-msg-bot>.jpc-msg-body{flex:1 1 0;}
.jpc-msg-avatar{flex:none;width:32px;height:32px;border-radius:50%;background:#880D27;}
.jpc-msg-user{align-self:flex-end;max-width:85%;padding:10px 14px;border:2px solid #4980C1;border-radius:16px 16px 4px 16px;background:#fff;color:var(--jpc-ink);overflow-wrap:anywhere;white-space:pre-wrap;}
.jpc-msg-sources{flex:1 0 100%;margin:4px 0 0;color:var(--jpc-muted);font-size:13px;}
/* while the answer types out, its page links and thumbs wait (js/chat.js reveal) */
.jpc-msg.is-typing .jpc-msg-sources,.jpc-msg.is-typing .jpc-msg-fb{display:none;}
.jpc-chat[data-mode="eddie"] .jpc-msg-sources,.jpc-chat[data-mode="eddie"] .jpc-msg-fb{padding-left:40px;}
.jpc-msg-fb{flex:1 0 100%;display:flex;align-items:center;gap:6px;margin-top:2px;}
.jpc-msg-fb button{display:flex;align-items:center;justify-content:center;width:36px;height:36px;margin:0;padding:0;border:1px solid var(--jpc-line);border-radius:50%;
  background:#fff;color:var(--jpc-muted);cursor:pointer;}
.jpc-msg-fb button svg{width:18px;height:18px;stroke-width:1.8;}
.jpc-msg-fb button:hover{border-color:#880D27;color:#880D27;}
.jpc-msg-fb button[aria-pressed="true"]{border-color:#880D27;background:#880D27;color:#fff;}
.jpc-msg-fb button[aria-disabled="true"]{cursor:default;}
.jpc-msg-thanks{color:var(--jpc-muted);font-size:13px;}
.jpc-msg-error .jpc-msg-body{background:#fff;border:1px solid var(--jpc-line);border-left:4px solid #880D27;}

/* starter questions: tappable chips */
.jpc-chat-starters{list-style:none;margin:0;padding:0 0 0 2px;display:flex;flex-wrap:wrap;gap:8px;}
.jpc-chat[data-mode="eddie"] .jpc-chat-starters{padding-left:40px;}
.jpc-chat-starters button{min-height:40px;margin:0;padding:8px 14px;border:1px solid #880D27;border-radius:999px;background:#fff;color:#880D27;
  font:500 14px/1.3 Roboto,system-ui,sans-serif;text-align:left;cursor:pointer;transition:background .15s ease;}
.jpc-chat-starters button:hover{background:var(--jpc-tint);}

/* the typing indicator: three burgundy dots (and Eddie bobbing his head, "thinking") */
.jpc-dots{display:inline-flex;align-items:center;gap:5px;padding:14px 16px;border-radius:16px 16px 16px 4px;background:var(--jpc-tint);}
.jpc-dots span{width:8px;height:8px;border-radius:50%;background:#880D27;animation:jpc-dot 1.2s ease-in-out infinite;}
.jpc-dots span:nth-child(2){animation-delay:.18s;}
.jpc-dots span:nth-child(3){animation-delay:.36s;}
.jpc-typing .jpc-msg-avatar{animation:jpc-bob 1.6s ease-in-out infinite;}
@keyframes jpc-dot{0%,80%,100%{opacity:.3;transform:translateY(0);}40%{opacity:1;transform:translateY(-3px);}}
@keyframes jpc-bob{0%,100%{transform:translateY(0) rotate(0);}50%{transform:translateY(-4px) rotate(-3deg);}}

/* ---------------------------------------------------------------- the question box */
.jpc-chat-form{position:relative;flex:none;display:flex;align-items:flex-end;gap:8px;margin:0;padding:10px 12px 4px;border-top:1px solid var(--jpc-line);background:#fff;}
.jpc-chat-form textarea{flex:1 1 auto;min-width:0;min-height:44px;max-height:132px;margin:0;padding:10px 12px 18px;border:1px solid #8a9099;border-radius:14px;resize:none;
  background:#fff;color:var(--jpc-ink);font:400 15px/1.45 Roboto,system-ui,sans-serif;}
.jpc-chat-form textarea::placeholder{color:#6b7078;opacity:1;}
.jpc-chat-form textarea:focus{outline:3px solid #4980C1;outline-offset:0;border-color:#4980C1;}
.jpc-chat-form textarea:disabled{background:var(--jpc-tint);}
.jpc-chat-count{position:absolute;right:72px;bottom:8px;color:var(--jpc-muted);font-size:11.5px;line-height:1;pointer-events:none;background:#fff;padding:1px 3px;border-radius:4px;}
.jpc-chat-count.jpc-near{color:#880D27;font-weight:700;}
.jpc-chat-send{flex:none;display:flex;align-items:center;justify-content:center;width:44px;height:44px;margin:0;padding:0;border:0;border-radius:50%;background:#880D27;color:#fff;cursor:pointer;}
.jpc-chat-send:hover:not(:disabled){background:var(--jpc-burgundy-dark);}
.jpc-chat-send:focus-visible{outline:3px solid #4980C1;outline-offset:2px;}
.jpc-chat-send:disabled{background:#d5d7db;color:#5d6168;cursor:not-allowed;}
.jpc-chat-intro{flex:none;margin:0;padding:4px 14px 12px;background:#fff;color:var(--jpc-muted);font-size:12px;line-height:1.4;}

/* ---------------------------------------------------------------- phones: a full-height sheet */
@media (max-width:639.98px){
  .jpc-chat-panel,.jpc-chat[data-mode="eddie"] .jpc-chat-panel{inset:0;width:100%;max-width:none;height:100vh;height:100dvh;max-height:none;border-radius:0;
    padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);}
  .jpc-chat-head{background:#880D27;}
  .jpc-chat-stage{height:clamp(130px,22vh,180px);}
  .jpc-chat-form textarea{font-size:16px;}   /* (16 px: iPhones don't zoom in on the box) */
  .jpc-chat-bubble{bottom:calc(var(--jpc-bottom) + var(--jpc-launch-h) + 12px);}
}

/* ---------------------------------------------------------------- short windows: 200% zoom, phones on their side */
/* Eddie's stage and the line under the title get smaller, the conversation keeps at least 120 px, and the whole panel
   scrolls, so the question box and the privacy line can always be reached (WCAG 1.4.10 Reflow, 1.4.4 Resize text) */
@media (max-height:480px){
  .jpc-chat-panel,.jpc-chat[data-mode="eddie"] .jpc-chat-panel{overflow-y:auto;overscroll-behavior:contain;}
  .jpc-chat-head{min-height:48px;padding-top:10px;padding-bottom:10px;}
  .jpc-chat[data-mode="eddie"] .jpc-chat-head{padding-bottom:8px;}
  .jpc-chat-stage{height:84px;}
  .jpc-chat-full{width:72px;height:72px;margin-bottom:4px;}
  .jpc-chat-stage::before{width:120px;height:26px;margin-left:-60px;}
  .jpc-chat-sub{display:none;}
  .jpc-chat-log{min-height:120px;}
}

/* ---------------------------------------------------------------- reduced motion, high contrast, print */
/* (6 Nov 2026, the owner's decision: the chatbot animates for everyone, even where the device asks for less motion.
   js/chat.js sets data-motion="reduced" only when an administrator has ticked "Follow visitors' 'reduce motion'
   setting" and the device asks for less motion – so no rule here is keyed to prefers-reduced-motion directly) */
.jpc-chat[data-motion="reduced"] *,.jpc-chat[data-motion="reduced"] *::before,.jpc-chat[data-motion="reduced"] *::after{animation:none !important;transition:none !important;}
.jpc-chat[data-motion="reduced"] .jpc-chat-launch:hover{transform:none;}
@media (forced-colors:active){
  .jpc-chat-launch,.jpc-chat-panel,.jpc-chat-bubble,.jpc-msg-body,.jpc-chat-starters button{border:2px solid CanvasText;}
  .jpc-dots span{background:CanvasText;}
}
@media print{.jpc-chat{display:none !important;}}
