/* Sage the owl and its yellow balloon, in the style of the old desktop's notification balloons. */
/* The button covers only the visible owl (80 x 108 px inside the 192 x 144 frame); the frame
   hangs outside it, so clicks on the empty corners reach the desktop. */
.sage-owl {
  position: absolute; left: calc(40% + 53px); bottom: 4px; z-index: 2;
  width: 80px; height: 108px; overflow: visible;
  padding: 0; border: 0; background: none; cursor: pointer;
  filter: drop-shadow(2px 4px 4px rgb(0 0 0 / 0.35));
}
.sage-owl img { position: absolute; left: -53px; top: -36px; display: block; width: 192px; height: 144px; max-width: none; pointer-events: none; }
.sage-owl:focus-visible { outline: 1px dotted var(--white); outline-offset: 2px; }
.sage-owl.is-arriving { animation: sage-fly-in 1.6s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes sage-fly-in {
  from { transform: translate(-220px, -260px) rotate(-8deg); }
  70% { transform: translate(6px, -10px) rotate(2deg); }
  to { transform: none; }
}

.sage-balloon {
  position: absolute; left: calc(40% + 70px); bottom: 140px; z-index: 3;
  width: 290px; padding: 10px 12px 12px;
  background: #ffffe1; color: var(--ink);
  border: 1px solid #000; border-radius: 8px;
  box-shadow: 2px 3px 6px rgb(0 0 0 / 0.35);
  font: 11px/1.4 var(--ui-font);
}
.sage-balloon::after {
  content: ""; position: absolute; left: 22px; bottom: -14px; width: 0; height: 0;
  border-top: 14px solid #000; border-right: 14px solid transparent;
}
.sage-balloon::before {
  content: ""; position: absolute; left: 23px; bottom: -12px; z-index: 1; width: 0; height: 0;
  border-top: 12px solid #ffffe1; border-right: 12px solid transparent;
}
.sage-balloon p { margin: 0 0 8px; }
.sage-balloon__title { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.sage-balloon__close {
  position: absolute; top: 5px; right: 5px; width: 14px; height: 14px; padding: 0;
  border: 1px solid transparent; border-radius: 2px; background: none; color: #6b6b6b; font: 13px/11px var(--ui-font); cursor: pointer;
}
.sage-balloon__close:hover, .sage-balloon__close:focus-visible { border-color: #a9a9a9; background: #fff; color: #000; }
.sage-balloon__cta { padding: 0; border: 0; background: none; color: #0c32a5; font: 11px var(--ui-font); text-decoration: underline; cursor: pointer; }

/* Tray icons */
.tray__icon { display: grid; place-items: center; width: 18px; height: 18px; padding: 0 !important; }
.tray__icon img, .tray__icon svg { width: 16px; height: 16px; }
.tray__icon.is-offline svg { opacity: 0.6; }

/* Phones (his ask, s7): the owl stays on the desktop, bottom right beside the note; its balloon sits above it. */
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .sage-owl { left: auto; right: 14px; bottom: 6px; }
  .sage-balloon { position: fixed; left: auto; right: 8px; bottom: calc(var(--taskbar-h) + 124px); z-index: 9003; }
  .sage-balloon::after { left: auto; right: 44px; border-right: 0; border-left: 14px solid transparent; }
  .sage-balloon::before { left: auto; right: 45px; border-right: 0; border-left: 12px solid transparent; }
}
@media (prefers-reduced-motion: reduce) { .sage-owl.is-arriving { animation: none; } }

/* Sage's chat inside the balloon */
.sage-chat__log { max-height: 190px; overflow-y: auto; margin: 0 0 8px; }
.sage-chat__msg { margin: 0 0 6px; }
.sage-chat__msg--visitor { margin-left: 24px; padding: 4px 6px; background: #fff; border: 1px solid #c9c4ad; border-radius: 4px; }
.sage-chat__msg--thinking { color: #595959; font-style: italic; }
.sage-chat__actions { margin: 0 0 8px; }
.sage-chat__actions:empty { display: none; }
.sage-chat__form { display: flex; gap: 6px; margin: 0 0 6px; }
.sage-chat__input { flex: 1; min-width: 0; padding: 2px 4px; border: 1px solid #7f9db9; font: 11px var(--ui-font); }
.sage-chat__send { min-width: 52px; }
@media (max-width: 720px), (pointer: coarse) and (max-height: 500px) {
  .sage-balloon { width: min(310px, calc(100vw - 16px)); font-size: 14px; }
  .sage-balloon__cta, .sage-chat__send { font-size: 14px; }
  /* The close cross stays small to look at; its tap area is 32 px. */
  .sage-balloon__close { top: 0; right: 0; width: 32px; height: 32px; font-size: 18px; line-height: 30px; }
}
@media (max-width: 720px), (pointer: coarse) { .sage-chat__input { font-size: 16px; } } /* stops phones zooming in on focus */
