/* ==========================================================================
   OBSIDIAN DESIGN — site assistant (chat widget)
   Same six colours, square corners, bronze as a hairline. Logical properties only.
   ========================================================================== */

.bot-launch {
  position: fixed; z-index: 45;
  inset-block-end: calc(24px + env(safe-area-inset-bottom)); inset-inline-end: 24px;
  display: inline-flex; align-items: center; gap: 0.75rem;
  min-block-size: 52px; padding: 0 1.25rem 0 1.1rem;
  background: var(--onyx); color: var(--bone); border: 1px solid var(--bronze);
  font-family: var(--ff-body); font-size: var(--step--1); font-weight: 500;
  letter-spacing: var(--label-track); text-transform: var(--label-case);
  cursor: pointer;
  transition: color var(--dur-short) var(--ease), border-color var(--dur-short) var(--ease), opacity var(--dur-short) var(--ease), transform var(--dur-short) var(--ease);
}
.bot-launch:hover { color: var(--bronze-lt); border-color: var(--bronze-lt); }
.bot-launch:focus-visible { outline: 1px solid var(--bronze-lt); outline-offset: 3px; }
.bot-launch svg { flex: none; color: var(--bronze); }
.bot-open .bot-launch { opacity: 0; pointer-events: none; transform: translate3d(0, 8px, 0); }
.menu-open .bot-launch { opacity: 0; pointer-events: none; }

.bot {
  position: fixed; z-index: 60;
  inset-block-end: calc(24px + env(safe-area-inset-bottom)); inset-inline-end: 24px;
  inline-size: min(400px, calc(100vw - 32px));
  block-size: min(640px, calc(100dvh - 48px));
  display: grid; grid-template-rows: auto 1fr auto auto;
  background: var(--onyx); color: var(--bone); border: 1px solid var(--hairline);
  box-shadow: 0 24px 80px rgb(0 0 0 / 0.6);
  font-family: var(--ff-body); font-size: 1rem; line-height: 1.75;
  opacity: 0; visibility: hidden; transform: translate3d(0, 16px, 0);
  transition: opacity var(--dur-short) var(--ease), transform var(--dur-short) var(--ease), visibility 0s linear var(--dur-short);
}
.bot-open .bot { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.bot__head {
  display: flex; align-items: center; gap: 0.85rem;
  padding: 0.9rem 1rem; border-block-end: 1px solid var(--hairline);
}
.bot__logo { inline-size: 36px; block-size: 36px; flex: none; object-fit: contain; }
.bot__title { flex: 1; min-inline-size: 0; }
.bot__name { display: block; font-family: var(--ff-display); font-weight: var(--name-weight); font-size: 1.05rem; line-height: 1.3; }
.bot__sub { display: block; font-size: 0.875rem; color: var(--warm-grey); line-height: 1.4; }
.bot__close {
  flex: none; display: grid; place-items: center; inline-size: 44px; block-size: 44px; margin-inline-end: -0.5rem;
  background: none; border: 0; color: var(--warm-grey); cursor: pointer;
  transition: color var(--dur-short) var(--ease);
}
.bot__close:hover { color: var(--bronze-lt); }
.bot__close:focus-visible { outline: 1px solid var(--bronze); outline-offset: -6px; }

.bot__log {
  overflow-y: auto; overscroll-behavior: contain; padding: 1.1rem 1rem 0.5rem;
  display: flex; flex-direction: column; gap: 0.75rem;
  scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--bronze) 40%, transparent) transparent;
}
.bot__msg { max-inline-size: 88%; white-space: pre-line; overflow-wrap: anywhere; }
.bot__msg--bot { align-self: flex-start; padding-inline-start: 0.85rem; border-inline-start: 1px solid var(--bronze); }
.bot__msg--user {
  align-self: flex-end; padding: 0.45rem 0.85rem;
  background: var(--ink); border: 1px solid var(--hairline); color: var(--bone);
}
.bot__msg a { color: var(--bronze-lt); text-decoration: underline; text-underline-offset: 0.25em; text-decoration-thickness: 1px; }
.bot__msg a:hover { color: var(--bone); }
.bot__msg--note { align-self: center; max-inline-size: 100%; font-size: 0.875rem; color: var(--warm-grey); text-align: center; }
.bot__typing { align-self: flex-start; display: inline-flex; gap: 5px; padding: 0.6rem 0.85rem; border-inline-start: 1px solid var(--bronze); }
.bot__typing i { inline-size: 5px; block-size: 5px; background: var(--bronze); opacity: 0.35; animation: bot-dot 1.2s infinite var(--ease-inout); }
.bot__typing i:nth-child(2) { animation-delay: 0.15s; }
.bot__typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bot-dot { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.bot__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; padding: 0.5rem 1rem 0.9rem; max-block-size: 15.5rem; overflow-y: auto; }
.bot__chips:empty { display: none; }
.bot__chip {
  min-block-size: 44px; padding: 0.35rem 0.95rem;
  background: transparent; color: var(--bone); border: 1px solid var(--hairline);
  font: inherit; font-size: 0.9375rem; line-height: 1.4; text-align: start; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center;
  transition: color var(--dur-short) var(--ease), border-color var(--dur-short) var(--ease);
}
.bot__chip:hover { color: var(--bronze-lt); border-color: var(--bronze-lt); }
.bot__chip:focus-visible { outline: 1px solid var(--bronze-lt); outline-offset: 2px; }
.bot__chip--quiet { border-color: transparent; color: var(--warm-grey); padding-inline: 0.5rem; }
.bot__chip--quiet:hover { border-color: transparent; }
.bot__chip[dir='ltr'] { font-family: var(--ff-num); font-variant-numeric: tabular-nums; }

.bot__form { display: flex; align-items: stretch; border-block-start: 1px solid var(--hairline); padding-block-end: env(safe-area-inset-bottom); }
.bot__input {
  flex: 1; min-inline-size: 0; min-block-size: 56px; padding: 0.75rem 1rem;
  background: var(--ink); color: var(--bone); border: 0; border-radius: 0;
  font: inherit; font-size: 1rem; /* 16px: stops iOS zooming the page on focus */
}
.bot__input::placeholder { color: var(--warm-grey); opacity: 1; }
.bot__input:focus-visible { outline: 1px solid var(--bronze); outline-offset: -1px; }
.bot__send {
  flex: none; inline-size: 56px; display: grid; place-items: center;
  background: var(--ink); color: var(--bronze); border: 0; border-inline-start: 1px solid var(--hairline); cursor: pointer;
  transition: color var(--dur-short) var(--ease);
}
.bot__send:hover { color: var(--bronze-lt); }
.bot__send:focus-visible { outline: 1px solid var(--bronze); outline-offset: -1px; }
.bot__send:disabled { color: var(--warm-grey); cursor: default; }
[dir='rtl'] .bot__send svg { transform: scaleX(-1); }

@media (max-width: 759px) {
  /* Phones: the WhatsApp shortcut owns the inline-end corner, so the assistant takes the other one */
  .bot-launch {
    inset-block-end: calc(16px + env(safe-area-inset-bottom)); inset-inline: 16px auto;
    inline-size: 52px; padding: 0; justify-content: center; border-radius: 50%;
  }
  .bot-launch span { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .bot { inset: 0; inline-size: 100%; block-size: 100dvh; border: 0; transform: translate3d(0, 24px, 0); }
  .bot-open { overflow: hidden; }
  .bot-open .wa-fab { opacity: 0 !important; visibility: hidden !important; }
}

@media (prefers-reduced-motion: reduce) {
  .bot, .bot-launch { transform: none !important; }
  .bot__typing i { animation: none; opacity: 0.7; }
}
