/* The website chat (assets/chat.js). Palette tokens come from style.css. */
.chat { position: fixed; right: 1.25rem; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); z-index: 40; font-family: var(--body, system-ui, sans-serif); }
.chat [hidden] { display: none !important; }
.chat button, .chat textarea { font-family: inherit; }
/* Phones: tuck into the corner. Only the campaign pages have the fixed
   action bar, so only there does the chat sit above it. */
@media (max-width: 61.99rem) {
  .chat { right: .9rem; bottom: calc(.9rem + env(safe-area-inset-bottom, 0px)); }
  /* Kept off the first screen so it never sits on the hero's own button. */
  .chat--wait:not(.is-open) { opacity: 0; visibility: hidden; transform: translateY(10px); }
  .chat { transition: opacity .3s ease, transform .3s ease, visibility .3s; }
  body:has(.actionbar) .chat { bottom: calc(4.4rem + env(safe-area-inset-bottom, 0px)); }
  .chat__launch { width: 3.4rem; height: 3.4rem; padding: 0; justify-content: center; }
  .chat__launch span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .chat__launch svg { width: 1.65rem; height: 1.65rem; }
}

.chat__launch {
  display: inline-flex; align-items: center; gap: .5rem; border: 0; cursor: pointer;
  background: var(--gold); color: var(--on-gold); font-size: .9375rem; font-weight: 600; line-height: 1;
  padding: .85rem 1.15rem .85rem 1rem; border-radius: 999px;
  box-shadow: 0 6px 20px rgba(19, 32, 41, .22), 0 1px 3px rgba(19, 32, 41, .2);
  transition: transform .15s ease, background .15s ease;
}
.chat__launch:hover { background: var(--gold-h); transform: translateY(-1px); }
.chat__launch svg { width: 1.2rem; height: 1.2rem; }
.chat.is-open .chat__launch { display: none; }
/* A soft ring every few seconds until the chat has been opened once. */
.chat__launch { position: relative; }
.chat--pulse .chat__launch::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: 0 0 0 0 var(--gold); opacity: .55; animation: chat-pulse 3.2s ease-out 1.5s infinite;
}

.chat__nudge {
  position: absolute; right: 0; bottom: calc(100% + .7rem); width: 16.5rem;
  animation: chat-in .35s ease both;
}
.chat__nudge-msg {
  display: block; width: 100%; text-align: left; cursor: pointer; border: 1px solid var(--hair);
  background: var(--surface); color: var(--ink); font-size: .9375rem; line-height: 1.45;
  padding: .85rem 1rem; border-radius: 14px 14px 4px 14px;
  box-shadow: 0 10px 30px rgba(19, 32, 41, .16);
}
.chat__nudge-x {
  position: absolute; top: -.6rem; left: -.6rem; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 1px solid var(--hair); background: var(--surface); color: var(--muted); cursor: pointer;
  display: grid; place-items: center; padding: 0; box-shadow: 0 2px 6px rgba(19, 32, 41, .12);
}
.chat__nudge-x svg { width: .8rem; height: .8rem; }

.chat__panel {
  width: min(23.5rem, calc(100vw - 1.8rem)); height: min(34rem, calc(100vh - 7rem));
  height: min(34rem, calc(100dvh - 7rem));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); color: var(--ink); border: 1px solid var(--hair); border-radius: 16px;
  box-shadow: 0 18px 50px rgba(19, 32, 41, .25); animation: chat-in .25s ease both;
}
@media (max-width: 61.99rem) { .chat__panel { height: min(34rem, calc(100dvh - 9rem)); } }
.chat__head { display: flex; align-items: center; gap: .7rem; padding: .85rem .9rem; background: var(--forest); color: var(--on-brand); }
.chat__mark { width: 2.1rem; height: 2.1rem; flex: none; display: grid; place-items: center; border-radius: 3px; background: var(--brand-2); color: #fff; font: 800 1.05rem/1 "Archivo", system-ui, sans-serif; }
.chat__who { display: grid; gap: .1rem; flex: 1; min-width: 0; }
.chat__who b { font-weight: 600; font-size: .9875rem; }
.chat__who small { font-size: .78rem; color: var(--on-brand-2); display: flex; align-items: center; gap: .4rem; }
.chat__dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--mint); flex: none; }
.chat__x { border: 0; background: transparent; color: var(--on-brand); width: 2.2rem; height: 2.2rem; border-radius: 8px; cursor: pointer; display: grid; place-items: center; padding: 0; }
.chat__x:hover { background: rgba(255, 255, 255, .08); }
.chat__x svg { width: 1.1rem; height: 1.1rem; }

.chat__log { flex: 1; overflow-y: auto; padding: 1rem .9rem; display: flex; flex-direction: column; gap: .45rem; background: var(--screen-2); overscroll-behavior: contain; }
.chat__msg { max-width: 85%; padding: .6rem .85rem; font-size: .9375rem; line-height: 1.45; border-radius: 14px; white-space: pre-wrap; overflow-wrap: anywhere; animation: chat-msg .2s ease both; }
.chat__msg--them { align-self: flex-start; background: var(--surface); border: 1px solid var(--hair); border-bottom-left-radius: 4px; }
.chat__msg--me { align-self: flex-end; background: var(--brand-2); color: #fff; border-bottom-right-radius: 4px; }
.chat__msg--me + .chat__msg--them, .chat__msg--them + .chat__msg--me { margin-top: .4rem; }
.chat__typing { display: inline-flex; gap: .25rem; padding: .8rem .9rem; }
.chat__typing i { width: .4rem; height: .4rem; border-radius: 50%; background: var(--muted); opacity: .4; animation: chat-dot 1.1s infinite ease-in-out; }
.chat__typing i:nth-child(2) { animation-delay: .15s; }
.chat__typing i:nth-child(3) { animation-delay: .3s; }

.chat__form { display: flex; align-items: flex-end; gap: .5rem; padding: .65rem .7rem; border-top: 1px solid var(--hair); background: var(--surface); }
.chat__form textarea { flex: 1; resize: none; border: 1px solid var(--rule); border-radius: 10px; padding: .6rem .75rem; font-size: 1rem; line-height: 1.4; color: var(--ink); background: var(--surface); max-height: 7.5rem; }
.chat__form textarea:focus { outline: 2px solid var(--brand-2); outline-offset: 0; border-color: transparent; }
.chat__form button { flex: none; width: 2.6rem; height: 2.6rem; border: 0; border-radius: 10px; background: var(--gold); color: var(--on-gold); cursor: pointer; display: grid; place-items: center; padding: 0; }
.chat__form button:hover { background: var(--gold-h); }
.chat__form button svg { width: 1.15rem; height: 1.15rem; }
.chat__small { margin: 0; padding: 0 .9rem .6rem; font-size: .72rem; color: var(--muted); background: var(--surface); }
.chat__small a { color: inherit; }
.chat__sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

@keyframes chat-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes chat-msg { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes chat-pulse { 0% { box-shadow: 0 0 0 0 var(--gold); opacity: .55; } 45%, 100% { box-shadow: 0 0 0 12px var(--gold); opacity: 0; } }
@keyframes chat-dot { 0%, 80%, 100% { opacity: .35; transform: none; } 40% { opacity: 1; transform: translateY(-2px); } }
@media (prefers-reduced-motion: reduce) { .chat *, .chat { animation: none !important; transition: none !important; } }
@media print { .chat { display: none; } }

/* Keep the chat out of the way of a form the visitor is filling in: when the
   booking or enquiry form is in view the launcher and nudge step aside. */
.chat--aside:not(.is-open) { opacity: 0; visibility: hidden; transform: translateY(10px); pointer-events: none; }

/* Starter chips under the greeting, gone once the first message is sent. */
.chat__chips { display: flex; flex-wrap: wrap; gap: .4rem; align-self: flex-start; max-width: 92%; }
.chat__chip { font: inherit; font-size: .875rem; font-weight: 600; line-height: 1.2; cursor: pointer; padding: .5rem .85rem; border-radius: 999px; border: 1px solid var(--brand-2); background: var(--surface); color: var(--brand-ink, var(--brand-2)); }
.chat__chip:hover { background: var(--brand-2); color: #fff; }

/* The free times, offered in the chat the way the booking form shows them. */
.chat__pick { align-self: stretch; background: var(--surface); border: 1px solid var(--hair); border-radius: 14px; padding: .7rem .75rem .8rem; animation: chat-msg .2s ease both; }
.chat__pick-days { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .4rem; scrollbar-width: thin; }
.chat__pick-day { flex: 0 0 auto; min-width: 4.1rem; font: inherit; cursor: pointer; display: grid; gap: .1rem; text-align: center; padding: .45rem .55rem; border-radius: 10px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.chat__pick-day b { font-size: .8125rem; font-weight: 600; }
.chat__pick-day span { font-size: .72rem; color: var(--muted); }
.chat__pick-day[aria-pressed="true"] { border-color: var(--brand-2); background: var(--brand-2); color: #fff; }
.chat__pick-day[aria-pressed="true"] span { color: rgba(255, 255, 255, .8); }
.chat__pick-dayname { margin: .35rem 0 .2rem; font-size: .8125rem; font-weight: 600; }
.chat__pick-head { margin: .35rem 0 .25rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chat__pick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; }
.chat__pick-time { font: inherit; font-size: .8125rem; font-weight: 600; cursor: pointer; padding: .45rem .2rem; border-radius: 8px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.chat__pick-time:hover { border-color: var(--brand-2); color: var(--brand-2); }

/* The call just put in the diary. */
.chat__booked { align-self: flex-start; display: flex; align-items: center; gap: .6rem; max-width: 85%; padding: .6rem .85rem; border-radius: 14px; border: 1px solid var(--hair); background: var(--surface); font-size: .9375rem; line-height: 1.4; animation: chat-msg .2s ease both; }
.chat__booked-tick { flex: none; width: 1.8rem; height: 1.8rem; border-radius: 50%; display: grid; place-items: center; background: var(--brand-2); color: #fff; }
.chat__booked-tick svg { width: 1rem; height: 1rem; }
