/* Carl / Carlos — chat button + panel, booking helper, service cameo (includes/mascot.php, js/mascot-chat.js).
   Brand navy + forest from tokens.css; the panel is a card on desktop and a bottom sheet on phones. */

/* ---------- launcher + teaser */
.mascot {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: calc(var(--z-header, 100) + 10);   /* above the sticky header, below overlays (lightbox) */
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.6rem;
  pointer-events: none;
}
.mascot > * { pointer-events: auto; }
@media (max-width: 1040px) {
  body:has(.sticky-cta-bar) .mascot { bottom: calc(var(--sticky-cta-h) + 0.75rem + env(safe-area-inset-bottom, 0px)); }
}
.mascot-launcher {
  position: relative;
  width: 4.75rem;
  height: 4.75rem;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: var(--color-forest-100, #e6f2ec);
  box-shadow: 0 8px 24px rgba(11, 31, 51, 0.28);
  cursor: pointer;
  overflow: hidden;
  transition: transform var(--duration-fast, 0.15s) var(--ease-out, ease);
}
.mascot-launcher:hover { transform: translateY(-2px); }
.mascot-launcher:focus-visible { outline: 3px solid var(--color-forest-700, #1f5c45); outline-offset: 3px; }
.mascot-launcher img, .mascot-launcher video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 18%;
}
.mascot-launcher video { opacity: 0; transition: opacity 0.3s ease; }
.mascot-launcher.is-waving video { opacity: 1; }
.mascot-launcher.is-waving .mascot-launcher__still { opacity: 0; }
.mascot[data-state="open"] .mascot-launcher { transform: scale(0.9); }

.mascot-teaser {
  order: -2;
  position: relative;
  margin: 0;
  max-width: 15rem;
  padding: 0.65rem 2.1rem 0.65rem 0.9rem;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: var(--color-navy-950, #0b1f33);
  font: 600 0.95rem/1.35 var(--font-body, system-ui);
  box-shadow: 0 8px 24px rgba(11, 31, 51, 0.2);
  cursor: pointer;
  animation: mascot-pop 0.35s var(--ease-out, ease) both;
}
.mascot-teaser__x {
  position: absolute; top: 0.2rem; right: 0.2rem;
  width: 1.9rem; height: 1.9rem; border: 0; background: none; cursor: pointer;
  color: var(--color-navy-900, #12304a); font-size: 1.2rem; line-height: 1;
}
@keyframes mascot-pop { from { opacity: 0; transform: translateY(6px) scale(0.96); } to { opacity: 1; transform: none; } }

/* the launcher + its little shrink toggle */
.mascot-dock { position: relative; }
.mascot-launcher__icon { display: none; }
.mascot-shrink {
  position: absolute; top: -0.35rem; left: -0.35rem;
  width: 1.6rem; height: 1.6rem; padding: 0; border: 2px solid #fff; border-radius: 50%;
  background: var(--color-navy-950, #0b1f33); color: #fff; font: 700 1rem/1 var(--font-body, system-ui);
  cursor: pointer; opacity: 0; transition: opacity 0.2s ease;
}
.mascot-dock:hover .mascot-shrink, .mascot-shrink:focus-visible { opacity: 1; }
.mascot-shrink:focus-visible { outline: 3px solid var(--color-forest-700, #1f5c45); outline-offset: 2px; }
@media (hover: none) { .mascot-shrink { opacity: 1; } }

/* compact: a small chat icon (phones always; desktop after "shrink") */
.mascot--compact .mascot-launcher {
  width: 3.25rem; height: 3.25rem; border-width: 2px;
  background: var(--color-forest-700, #1f5c45); color: #fff;
}
.mascot--compact .mascot-launcher__still, .mascot--compact .mascot-launcher video { display: none; }
.mascot--compact .mascot-launcher__icon { display: block; position: absolute; inset: 0; margin: auto; width: 1.6rem; height: 1.6rem; }
.mascot--compact .mascot-shrink span { display: none; }
.mascot--compact .mascot-shrink::before { content: "+"; }
.mascot--compact .mascot-teaser { display: none; }
.mascot--phone .mascot-shrink { display: none; }

/* ---------- panel */
.mascot-panel {
  order: -1;
  width: min(24rem, calc(100vw - 2rem));
  /* the panel + launcher fit under the sticky header, so the × is never hidden */
  max-height: min(42rem, calc(100vh - var(--header-h, 5rem) - 8rem));
  max-height: min(42rem, calc(100dvh - var(--header-h, 5rem) - 8rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  color: var(--color-navy-950, #0b1f33);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(11, 31, 51, 0.32);
  overflow: hidden;
  animation: mascot-pop 0.25s var(--ease-out, ease) both;
}
.mascot-panel[hidden] { display: none; }
.mascot-panel__head {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0 0.9rem;
  background: var(--color-navy-950, #0b1f33);
  color: #fff;
}
.mascot-panel__pose { height: 5.5rem; width: auto; max-width: 9rem; object-fit: contain; flex: none; margin-bottom: -0.35rem; }
.mascot-panel__pose.is-swap { animation: mascot-swap 0.35s var(--ease-out, ease); }
@keyframes mascot-swap { from { opacity: 0.2; transform: translateY(6px) scale(0.94); } to { opacity: 1; transform: none; } }
.mascot-panel__who { display: grid; gap: 0.1rem; padding-bottom: 0.85rem; min-width: 0; flex: 1; }
.mascot-panel__who strong { font: 700 1.15rem/1.1 var(--font-display, Georgia, serif); color: #fff; }
.mascot-panel__who span { font-size: 0.82rem; color: rgba(255, 255, 255, 0.75); }
.mascot-panel__tools { align-self: flex-start; display: flex; gap: 0.35rem; }
.mascot-panel__btn {
  width: 2.5rem; height: 2.5rem; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); color: #fff; font-size: 1.5rem; line-height: 1; cursor: pointer;
}
.mascot-panel__btn:hover { background: rgba(255, 255, 255, 0.2); }
.mascot-panel__btn:focus-visible { outline: 3px solid #9fd3b8; outline-offset: 2px; }

.mascot-log {
  flex: 1 1 auto;
  min-height: 5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.9rem 0.9rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  background: var(--color-sand-50, #f7f4ee);
}
.mascot-msg { max-width: 88%; display: grid; gap: 0.45rem; }
.mascot-msg p {
  margin: 0;
  padding: 0.6rem 0.8rem;
  border-radius: 14px 14px 14px 4px;
  background: #fff;
  font-size: 0.95rem;
  line-height: 1.45;
  box-shadow: 0 1px 2px rgba(11, 31, 51, 0.08);
  overflow-wrap: anywhere;
}
.mascot-msg--you { align-self: flex-end; }
.mascot-msg--you p { border-radius: 14px 14px 4px 14px; background: var(--color-forest-700, #1f5c45); color: #fff; }
.mascot-msg__links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.mascot-link {
  display: inline-flex; align-items: center; min-height: 2.4rem;
  padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--color-forest-700, #1f5c45);
  color: var(--color-forest-700, #1f5c45); background: #fff;
  font-weight: 600; font-size: 0.9rem; text-decoration: none;
}
.mascot-link--primary { background: var(--color-forest-700, #1f5c45); color: #fff; }
.mascot-link:hover { background: var(--color-forest-600, #2a7356); border-color: var(--color-forest-600, #2a7356); color: #fff; }

.mascot-chips {
  /* options always fully visible (Julio 2026-10-13: no scroll inside the options); only the conversation scrolls */
  flex: none;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
  padding: 0.65rem 0.8rem 0.8rem;
  border-top: 1px solid var(--color-border, #e3ded4);
  background: #fff;
}
.mascot-chips--list { grid-template-columns: minmax(0, 1fr); }
.mascot-chips:empty { display: none; }
.mascot-chip {
  min-height: 2.6rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  border: 1px solid var(--color-border, #d9d3c7);
  background: #fff;
  color: var(--color-navy-950, #0b1f33);
  font: 600 0.92rem/1.25 var(--font-body, system-ui);
  text-align: center;
  cursor: pointer;
}
.mascot-chips--list .mascot-chip { text-align: left; padding-inline: 0.85rem; }
.mascot-chip:hover { border-color: var(--color-forest-700, #1f5c45); background: var(--color-forest-100, #e6f2ec); }
.mascot-chip--primary { background: var(--color-forest-700, #1f5c45); border-color: var(--color-forest-700, #1f5c45); color: #fff; }
.mascot-chip--primary:hover { background: var(--color-forest-600, #2a7356); color: #fff; }
/* a lone last option in the 2-column grid spans the row instead of sitting half-empty */
.mascot-chips:not(.mascot-chips--list) .mascot-chip:last-child:nth-child(odd) { grid-column: 1 / -1; }
.mascot-chip:focus-visible, .mascot-link:focus-visible { outline: 3px solid var(--color-forest-700, #1f5c45); outline-offset: 2px; }

.mascot-ask[hidden] { display: none; }
.mascot-ask {
  display: flex;
  gap: 0.4rem;
  padding: 0.55rem 0.7rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--color-border, #e3ded4);
  background: #fff;
}
.mascot-ask input {
  flex: 1; min-width: 0; min-height: 2.6rem;
  padding: 0.45rem 0.75rem; border: 1px solid var(--color-border, #d9d3c7); border-radius: 999px;
  font: 400 1rem/1.2 var(--font-body, system-ui);   /* 16px: no zoom on iPhone */
}
.mascot-ask button {
  min-height: 2.6rem; padding: 0.4rem 1rem; border: 0; border-radius: 999px;
  background: var(--color-navy-950, #0b1f33); color: #fff; font-weight: 600; cursor: pointer;
}

/* phones: the panel becomes a bottom sheet over the page */
@media (max-width: 560px) {
  .mascot[data-state="open"],
  body:has(.sticky-cta-bar) .mascot[data-state="open"] { left: 0; right: 0; bottom: 0; align-items: stretch; }
  .mascot[data-state="open"] .mascot-launcher { display: none; }
  .mascot-panel {
    width: 100%;
    max-height: 78vh;
    max-height: 78dvh;
    border-radius: 18px 18px 0 0;
  }
  .mascot-panel__pose { height: 4rem; width: auto; max-width: 7rem; }
  .mascot-panel__who { padding-bottom: 0.6rem; }
  .mascot-chip { min-height: 2.5rem; font-size: 0.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot-teaser, .mascot-panel, .mascot-panel__pose.is-swap { animation: none; }
  .mascot-launcher { transition: none; }
}

/* ---------- service-page cameo (under the hero) */
.mascot-cameo { background: var(--color-forest-100, #e6f2ec); border-bottom: 1px solid rgba(31, 92, 69, 0.15); }
.mascot-cameo__inner {
  display: flex;
  align-items: center;
  gap: 0.5rem 1.25rem;
  padding-block: 0.6rem;
  flex-wrap: wrap;
}
.mascot-cameo__pose { height: 6.5rem; width: auto; max-width: 14rem; object-fit: contain; flex: none; margin-block: -0.4rem; }
.mascot-cameo__bubble {
  position: relative;
  margin: 0;
  flex: 1 1 16rem;
  min-width: 0;
  padding: 0.7rem 1rem;
  border-radius: 14px;
  background: #fff;
  color: var(--color-navy-950, #0b1f33);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(11, 31, 51, 0.1);
}
.mascot-cameo__bubble::before {
  content: "";
  position: absolute;
  left: -8px; top: 50%;
  border: 8px solid transparent;
  border-right-color: #fff;
  border-left: 0;
  transform: translateY(-50%);
}
.mascot-cameo__btn { flex: none; }
@media (max-width: 560px) {
  .mascot-cameo__inner { flex-wrap: nowrap; align-items: flex-start; }
  .mascot-cameo__pose { height: 4.75rem; width: auto; max-width: 9rem; margin: 0; }
  .mascot-cameo__bubble { font-size: 0.95rem; }
  .mascot-cameo__inner { display: grid; grid-template-columns: auto 1fr; }
  .mascot-cameo__btn { grid-column: 1 / -1; justify-self: stretch; }
}

/* ---------- booking-page helper */
.mascot-helper {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  margin: 0 0 1.25rem;
}
.mascot-helper__pose { height: 5.5rem; width: auto; max-width: 9rem; object-fit: contain; flex: none; }
.mascot-helper__bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 0.4rem;
  justify-items: start;
  padding: 0.8rem 1rem;
  border-radius: 14px 14px 14px 4px;
  background: var(--color-forest-100, #e6f2ec);
  color: var(--color-navy-950, #0b1f33);
}
.mascot-helper__text { margin: 0; font-size: 1rem; line-height: 1.45; }
.mascot-helper__ask {
  padding: 0; border: 0; background: none; cursor: pointer;
  color: var(--color-forest-700, #1f5c45); font-weight: 700; text-decoration: underline; text-underline-offset: 3px;
}
.mascot-helper__ask:focus-visible { outline: 3px solid var(--color-forest-700, #1f5c45); outline-offset: 2px; }
