/* Suri, the little Naalai sun: the helper in the corner of every page (js/sections/_shared/suri.js). A handmade felt sun
   (web/assets/cast/suri/*.webp) on a button; the panel is a paper card with a felt top band. Motion uses transform and
   opacity only. Reduced motion: no breathe, no bounce, no pop-in, words appear at once. */

.suri { position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 60;
  font: 500 16px/1.5 var(--font-body); color: var(--ink); }
.suri.is-open { z-index: 70; }

/* the felt sun button, 72 px */
.suri__sun { position: relative; display: block; width: 72px; height: 72px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer;
  transition: transform .3s var(--ease-settle), opacity .3s ease; }
.suri__sun:active { transform: scale(.94); }
.suri__sun:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.suri__shadow { position: absolute; left: 10%; right: 10%; bottom: -5px; height: 14px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse at 50% 50%, rgba(90, 42, 0, .38), rgba(90, 42, 0, .14) 55%, transparent 72%); }
.suri__body { position: absolute; inset: 0; display: block; transform-origin: 50% 90%; animation: suri-breathe 4.2s ease-in-out infinite; }
.suri__body img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none;
  filter: drop-shadow(0 3px 3px rgba(90, 42, 0, .3)); }
.suri__wink, .suri__listen { opacity: 0; }
.suri.is-blink .suri__face { opacity: 0; }
.suri.is-blink .suri__wink { opacity: 1; }
.suri.is-open .suri__face, .suri.is-open .suri__wink { opacity: 0; }
.suri.is-open .suri__listen { opacity: 1; }
.suri__sun:hover .suri__body { animation: suri-bounce .5s var(--ease-settle) 1; }
@keyframes suri-breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04, 1.035); } }
@keyframes suri-bounce { 0% { transform: translateY(0) scale(1); } 35% { transform: translateY(-7px) scale(.98, 1.04); } 70% { transform: translateY(0) scale(1.04, .96); } 100% { transform: translateY(0) scale(1); } }

/* the hello note: torn paper */
.suri__hello { position: absolute; right: 4px; bottom: 88px; width: max-content; max-width: min(270px, 70vw); padding: 14px 34px 18px 18px;
  background: #FFFBEF; color: var(--ink); cursor: pointer; transform: rotate(-1.5deg); transform-origin: 100% 100%;
  clip-path: polygon(0 3%, 6% 0, 13% 3%, 21% 0, 30% 2%, 38% 0, 47% 3%, 56% 0, 65% 2%, 74% 0, 83% 3%, 92% 0, 100% 2%,
    100% 95%, 94% 100%, 86% 96%, 77% 100%, 68% 97%, 59% 100%, 50% 96%, 41% 100%, 32% 97%, 23% 100%, 14% 96%, 6% 100%, 0 96%);
  filter: drop-shadow(0 2px 2px rgba(90, 42, 0, .22)); animation: suri-pop .5s var(--ease-settle) both; }
.suri__hello::before { content: ""; position: absolute; left: 14px; top: 0; width: 46px; height: 10px; background: rgba(244, 182, 58, .55); transform: rotate(-3deg); }
.suri__hello p { margin: 0; font-size: 15.5px; line-height: 1.4; }
.suri__hello b { display: block; font-family: var(--font-display); font-size: 17px; }
.suri__hello span { display: block; color: var(--ink-2); }
.suri__x { position: absolute; top: 6px; right: 4px; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent;
  color: var(--ink-2); font-size: 20px; line-height: 1; cursor: pointer; }
.suri__x:hover { background: rgba(90, 42, 0, .08); }
@keyframes suri-pop { from { opacity: 0; transform: translateY(10px) rotate(-5deg) scale(.92); } }

/* the chat panel: paper card, felt band on top */
.suri__panel { position: absolute; right: 0; bottom: 92px; width: min(390px, calc(100vw - 32px)); max-height: min(720px, calc(100vh - 120px));
  display: flex; flex-direction: column; background: var(--card); border-radius: 26px 26px 8px 26px; overflow: hidden;
  box-shadow: 0 2px 3px rgba(90, 42, 0, .24), 0 28px 60px -18px rgba(90, 42, 0, .42);
  transform-origin: 100% 100%; animation: suri-open .38s var(--ease-settle) both; isolation: isolate; }
.suri__panel::after { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; border-radius: inherit;
  background: url(/assets/art/textures/grain-tile.webp) 0 0 / 256px 256px; mix-blend-mode: multiply; opacity: .45; }
.suri__panel[hidden] { display: none; }
@keyframes suri-open { from { opacity: 0; transform: translateY(14px) scale(.92); } }

.suri__head { position: relative; display: flex; align-items: center; gap: 12px; padding: 8px 12px 8px 14px; flex: none;
  background: radial-gradient(circle at 20% 0, #FFC94D, #F4A92B 70%); border-radius: 0 0 22px 22px; margin: 0 0 8px; box-shadow: 0 2px 2px rgba(90, 42, 0, .18); }
.suri__head::before { content: ""; position: absolute; inset: 6px; border: 2px dashed rgba(255, 250, 235, .75); border-radius: 18px; pointer-events: none; }
.suri__head::after { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: url(/assets/art/textures/grain-tile.webp) 0 0 / 256px 256px; mix-blend-mode: multiply; opacity: .5; }
.suri__ava { position: relative; width: 56px; height: 56px; flex: none; z-index: 1; filter: drop-shadow(0 2px 2px rgba(90, 42, 0, .3)); }
.suri__head > div { position: relative; z-index: 1; min-width: 0; }
.suri__head h2 { font: 800 22px/1.05 var(--font-display); margin: 0; color: #3A1E00; }
.suri__head p { margin: 0; font-size: 14px; color: #5A2A00; font-weight: 700; }
.suri__close { position: relative; z-index: 1; margin-left: auto; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .6);
  color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; }
.suri__close:hover { background: #fff; }

.suri__log { flex: 1 1 auto; min-height: 150px; overflow-y: auto; padding: 8px 14px 8px; display: flex; flex-direction: column; gap: 10px;
  overscroll-behavior: contain; }
.suri__msg { max-width: 88%; padding: 10px 14px; border-radius: 18px; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; animation: suri-in .32s var(--ease-settle) both; }
.suri__msg a { color: var(--blue); font-weight: 800; }
.suri__msg--suri { align-self: flex-start; background: #FFF6DD; border-bottom-left-radius: 6px; box-shadow: 0 1px 1.5px rgba(90, 42, 0, .18); }
.suri__msg--you { align-self: flex-end; background: var(--blue); color: #fff; border-bottom-right-radius: 6px; box-shadow: var(--sh-blue); white-space: pre-wrap; }
.suri__w { opacity: 0; transition: opacity .12s linear; }
.suri__w.on { opacity: 1; }
@keyframes suri-in { from { opacity: 0; transform: translateY(6px); } }

/* three felt dots */
.suri__dots { display: inline-flex; gap: 6px; padding: 5px 2px; }
.suri__dots i { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFD36B, #F0991C 70%); box-shadow: inset 0 0 0 1.5px rgba(150, 70, 0, .3), 0 1px 1px rgba(90, 42, 0, .25);
  animation: suri-dot 1s ease-in-out infinite; }
.suri__dots i:nth-child(2) { animation-delay: .15s; }
.suri__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes suri-dot { 0%, 80%, 100% { opacity: .35; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.suri__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 14px 8px; flex: none; }
.suri__chip { display: inline-flex; align-items: center; min-height: 44px; padding: 5px 12px; border: 0; border-radius: var(--pill); background: var(--paper);
  box-shadow: inset 0 0 0 2px rgba(30, 42, 90, .12); color: var(--ink); font: 700 14px/1.2 var(--font-body); text-align: left; text-decoration: none;
  cursor: pointer; transition: background .15s, box-shadow .15s, transform .1s; }
.suri__chip:hover { background: var(--lemon); box-shadow: inset 0 0 0 2px rgba(90, 42, 0, .18); }
.suri__chip:active { transform: scale(.97); }
.suri__chip--go { background: #FFE9A8; box-shadow: inset 0 0 0 2px rgba(140, 80, 0, .3); }
.suri__chip:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

.suri__form { display: flex; gap: 8px; padding: 10px 12px; border-top: 2px dashed rgba(30, 42, 90, .1); flex: none; }
.suri__form input { flex: 1; min-width: 0; height: 46px; padding: 0 16px; border: 2px solid rgba(30, 42, 90, .14); border-radius: var(--pill);
  background: #fff; font: 600 16px var(--font-body); }
.suri__form input:focus-visible { outline: 3px solid var(--blue); outline-offset: 1px; border-color: transparent; }
.suri__form button { width: 46px; height: 46px; flex: none; border: 0; border-radius: 50%; background: var(--blue); color: #fff;
  display: grid; place-items: center; cursor: pointer; box-shadow: var(--sh-blue); }
.suri__form button:active { transform: scale(.94); }
.suri__note { margin: 0; padding: 0 16px 12px; font-size: 13px; line-height: 1.4; color: var(--ink-2); flex: none; }

/* a human, one tap away */
.suri__wa { display: flex; align-items: center; gap: 8px; margin: 0 14px 4px; padding: 8px 12px; border-radius: 12px; background: #E9F7EC; color: #1F7A3A;
  font: 700 14px/1.25 var(--font-body); text-decoration: none; flex: none; }
.suri__wa:hover { background: #DDF2E2; }
.suri__wa:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.suri__wa svg { flex: none; }

.suri.is-tucked .suri__sun { opacity: 0; transform: translateY(130%); pointer-events: none; visibility: hidden; }

/* phones: a smaller sun, no hello note; the panel is full width and sits above the sun and the WhatsApp button (.wa is stacked bottom-right above the sun) */
@media (max-width: 760px) {
  .suri__hello { display: none !important; }
  .suri__sun { width: 64px; height: 64px; }
  .suri__chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .suri__chip { flex: none; }
  .suri__panel { position: fixed; left: 10px; right: 10px; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 150px); width: auto;
    max-height: calc(100vh - max(16px, env(safe-area-inset-bottom)) - 170px); max-height: calc(100dvh - max(16px, env(safe-area-inset-bottom)) - 170px); }
}
@media (prefers-reduced-motion: reduce) {
  .suri__body, .suri__sun:hover .suri__body, .suri__hello, .suri__panel, .suri__msg, .suri__dots i { animation: none; }
  .suri__w { opacity: 1; transition: none; }
  .suri__sun { transition: none; }
}
@media print { .suri { display: none; } }
