/* ============================================================
   ROBIN — the orb character, the "Robin" word, the docked
   button and the chat window.
   The orb is sized in em: set font-size on .orb to scale it.
   ============================================================ */

/* ---------- The orb ---------- */
.orb {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  flex: none;
}
.orb__body {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 34% 24%, #b06a52 0%, #7a3024 34%, #3c0f0f 70%, #1f0606 100%);
  box-shadow:
    inset 0 0 .1em rgba(255,226,190,.55),
    inset 0 -.08em .16em rgba(226,163,36,.4),
    0 0 0 .035em rgba(214,188,150,.85),
    0 .08em .22em rgba(40,8,8,.35);
  animation: orb-float 3.4s ease-in-out infinite;
  transform-origin: 50% 90%;
}
/* glossy highlight */
.orb__body::before {
  content: "";
  position: absolute;
  left: 16%;
  top: 9%;
  width: 34%;
  height: 20%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255,255,255,.55), rgba(255,255,255,0));
  transform: rotate(-24deg);
}
/* the glass "cup" across the lower half */
.orb__visor {
  position: absolute;
  left: -8%;
  right: -8%;
  bottom: -6%;
  height: 56%;
  border-radius: 58% 42% 50% 50% / 34% 20% 80% 80%;
  background: linear-gradient(180deg, rgba(236,212,180,.6) 0%, rgba(184,140,96,.42) 45%, rgba(90,36,26,.55) 100%);
  border-top: .02em solid rgba(255,255,255,.75);
}
.orb__eye {
  position: absolute;
  top: 30%;
  width: 11%;
  height: 20%;
  border-radius: 50%;
  background: linear-gradient(180deg, #fff3cf, #f2b93a 55%, #e2a324);
  box-shadow: 0 0 .1em #f2b93a, 0 0 .24em rgba(226,163,36,.7);
  animation: orb-blink 4.2s infinite;
}
.orb__eye--l { left: 31%; }
.orb__eye--r { left: 57%; }
/* little hand, only seen while waving */
.orb__hand {
  position: absolute;
  right: -10%;
  top: 34%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #b06a52, #4a1612);
  box-shadow: 0 0 0 .02em rgba(214,188,150,.85);
  opacity: 0;
  transform: scale(.2);
  transform-origin: -80% 160%;
}
.orb__zzz {
  position: absolute;
  right: -8%;
  top: -14%;
  font: 600 .22em/1 var(--f-body);
  color: var(--gold-deep);
  opacity: 0;
}
.orb__shadow {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: -11%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(60,15,15,.32), rgba(60,15,15,0));
  animation: orb-shadow 3.4s ease-in-out infinite;
}

@keyframes orb-float { 50% { transform: translateY(-.045em); } }
@keyframes orb-shadow { 50% { transform: scale(.86); opacity: .7; } }
@keyframes orb-blink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.08); } }

/* --- wave --- */
.orb[data-state="wave"] .orb__body { animation: orb-tilt 1.2s ease-in-out infinite; }
.orb[data-state="wave"] .orb__hand { opacity: 1; animation: orb-wave .6s ease-in-out infinite alternate; }
@keyframes orb-tilt { 50% { transform: rotate(-7deg); } }
@keyframes orb-wave { from { transform: scale(1) rotate(-18deg); } to { transform: scale(1) rotate(24deg); } }

/* --- hop --- */
.orb[data-state="hop"] .orb__body { animation: orb-hop .8s cubic-bezier(.3,.6,.4,1) infinite; }
.orb[data-state="hop"] .orb__shadow { animation: orb-hop-shadow .8s infinite; }
@keyframes orb-hop {
  0%, 100% { transform: translateY(0) scale(1.08, .9); }
  20% { transform: translateY(-.06em) scale(.94, 1.07); }
  50% { transform: translateY(-.3em) scale(1); }
  85% { transform: translateY(0) scale(1); }
}
@keyframes orb-hop-shadow { 50% { transform: scale(.55); opacity: .4; } }

/* --- sleep --- */
.orb[data-state="sleep"] .orb__body { animation: orb-snooze 3s ease-in-out infinite; }
.orb[data-state="sleep"] .orb__eye { animation: none; transform: scaleY(.1); box-shadow: none; opacity: .8; }
.orb[data-state="sleep"] .orb__zzz { animation: orb-zzz 2s ease-out infinite; }
@keyframes orb-snooze { 0%, 100% { transform: rotate(-9deg) scale(1); } 50% { transform: rotate(-11deg) scale(1.03, .98); } }
@keyframes orb-zzz { 0% { opacity: 0; transform: translate(0, .1em) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(.14em, -.22em) scale(1.3); } }

/* --- dizzy --- */
.orb[data-state="dizzy"] .orb__body { animation: orb-wobble .9s ease-in-out infinite; }
.orb[data-state="dizzy"] .orb__eye { animation: orb-swirl .5s linear infinite; height: 13%; }
.orb[data-state="dizzy"] .orb__eye--r { animation-direction: reverse; }
@keyframes orb-wobble { 0%, 100% { transform: rotate(-9deg) translateX(-.02em); } 50% { transform: rotate(9deg) translateX(.02em); } }
@keyframes orb-swirl {
  0% { transform: translate(.03em, 0); } 25% { transform: translate(0, .03em); }
  50% { transform: translate(-.03em, 0); } 75% { transform: translate(0, -.03em); } 100% { transform: translate(.03em, 0); }
}

/* ---------- The word "Robin" with the orb as the O ---------- */
.robinword { position: relative; display: inline-grid; justify-items: center; margin-top: 62px; }
.robinword__btn {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--f-display);
  font-size: clamp(76px, 9.4vw, 124px);
  line-height: 1;
  color: var(--maroon);
}
.robinword__btn .orb { font-size: .56em; margin: 0 .07em 0 .05em; align-self: flex-end; translate: 0 -.36em; }
/* the little speech card */
.robinword__card {
  position: absolute;
  left: 50%;
  top: 0;
  translate: -50% -118%;
  padding: 10px 16px;
  border-radius: 16px 16px 16px 4px;
  background: var(--white);
  box-shadow: 0 12px 30px -8px rgba(60,15,15,.35);
  font-size: clamp(12.5px, 1.3vw, 15px);
  white-space: nowrap;
  animation: card-pop 5s ease-in-out infinite;
}
.robinword__card b { font-weight: 600; }
@keyframes card-pop { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@media (max-width: 900px) { .robinword__btn { font-size: clamp(84px, 24vw, 170px); } }
@media (max-width: 560px) { .robinword__card { translate: -50% -118%; } }

/* ---------- Docked button (appears after you scroll past Robin's intro) ---------- */
.rdock {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 16px 7px 7px;
  border-radius: 999px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 14px 34px -8px rgba(60,15,15,.5), 0 0 0 1px rgba(60,15,15,.08);
  font-size: 14px;
  font-weight: 500;
  transition: transform .35s cubic-bezier(.2,.9,.3,1.2), opacity .25s ease;
}
.rdock .orb { font-size: 44px; }
.rdock:not(.is-in) { transform: translateY(24px) scale(.8); opacity: 0; pointer-events: none; }

/* ---------- Chat window ---------- */
.rchat {
  position: fixed;
  right: clamp(12px, 2vw, 24px);
  bottom: clamp(12px, 2vw, 24px);
  z-index: 100;
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100svh - 24px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  border-radius: 24px;
  overflow: hidden;
  background: var(--white);
  color: var(--ink);
  box-shadow: 0 30px 70px -16px rgba(60,15,15,.6), 0 0 0 1px rgba(60,15,15,.1);
  transform-origin: 100% 100%;
  transition: transform .3s cubic-bezier(.2,.9,.3,1.1), opacity .2s ease;
}
.rchat:not(.is-open) { transform: scale(.85) translateY(20px); opacity: 0; pointer-events: none; visibility: hidden; }
.rchat__head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--maroon); color: var(--white); }
.rchat__head .orb { font-size: 42px; }
.rchat__name { font-family: var(--f-display); font-size: 24px; line-height: 1; }
.rchat__role { font-size: 12px; color: var(--tan); }
.rchat__x { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.12); font-size: 14px; }
.rchat__x:hover { background: var(--gold); color: var(--maroon); }

.rchat__log { overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.msg { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg a { text-decoration: underline; text-underline-offset: 2px; font-weight: 500; }
.msg--bot { align-self: flex-start; background: var(--tint); border-bottom-left-radius: 5px; }
.msg--me { align-self: flex-end; background: var(--maroon); color: var(--white); border-bottom-right-radius: 5px; }
.msg--typing { display: inline-flex; gap: 5px; padding: 14px; }
.msg--typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--maroon-2); animation: typing 1s infinite; }
.msg--typing i:nth-child(2) { animation-delay: .15s; }
.msg--typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.rchat__chips[hidden] { display: none; }
.rchat__chips { display: flex; gap: 6px; padding: 0 14px 10px; overflow-x: auto; scrollbar-width: none; }
.rchat__chips::-webkit-scrollbar { display: none; }
.rchat__chips button { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid rgba(60,15,15,.22); font-size: 12.5px; }
.rchat__chips button:hover { background: var(--maroon); color: var(--white); }

.rchat__form { display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(60,15,15,.1); }
.rchat__form input {
  flex: 1;
  min-width: 0;
  padding: 11px 14px;
  border-radius: 999px;
  border: 1px solid rgba(60,15,15,.2);
  font: inherit;
  font-size: 16px;            /* 16px stops iPhone from zooming in */
  color: var(--ink);
  background: var(--white);
}
.rchat__form input:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: transparent; }
.rchat__form button { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--gold); color: var(--maroon); display: grid; place-items: center; }
.rchat__form button svg { width: 18px; height: 18px; }
.rchat__form button:disabled { opacity: .5; cursor: default; }

@media (prefers-reduced-motion: reduce) {
  .orb__body, .orb__eye, .orb__shadow, .orb__hand, .orb__zzz, .robinword__card { animation: none !important; }
}

/* small privacy note under the chat box */
.rchat__note { padding: 0 14px 10px; font-size: 11px; line-height: 1.35; color: var(--brown); text-align: center; }
.rchat__note a { text-decoration: underline; }
