/* ==========================================================================
   Website assistant (assets/js/chat.js). Uses the tokens in styles.css.
   Ink header, limestone body, one red element: the send button.
   ========================================================================== */

.lmc { --lmc-gap: 20px; --lmc-launch: 52px; --lmc-bottom: calc(var(--lmc-gap) + var(--sa-b, 0px)); --lmc-end: max(var(--lmc-gap), var(--sa-ie, 0px)); --lmc-start: max(var(--lmc-gap), var(--sa-is, 0px)); font-family: var(--f-text); }
.lmc [hidden] { display: none !important; }
.lmc button { font: inherit; }
.lmc-ico { width: 20px; height: 20px; flex: none; }
html[dir="rtl"] .lmc-send-ico { transform: scaleX(-1); }
.lmc-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Launcher ---------- */
.lmc-launcher {
  position: fixed;
  z-index: 45;
  inset-block-end: var(--lmc-bottom);
  inset-inline-end: var(--lmc-end);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: var(--lmc-launch);
  padding-inline: 16px 20px;
  border: 0;
  border-radius: 4px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 14px 30px -14px rgba(27, 25, 21, .55);
  transition: background-color .3s ease, transform .4s var(--ease), opacity .3s ease, visibility 0s;
}
@media (hover: hover) and (pointer: fine) { .lmc-launcher:hover { background: var(--ink-3); } }
.lmc-launcher:active { background: var(--ink-3); transform: translateY(1px) scale(.985); transition-duration: .12s; }
.lmc-launcher .lmc-ico { width: 22px; height: 22px; }
.lmc-launcher .lmc-sq { fill: var(--sadu-glow); }

/* ---------- Shared marks and buttons ---------- */
.lmc-mark { display: inline-grid; place-items: center; flex: none; }
.lmc-mark svg { width: 20px; height: 20px; fill: var(--ink); }
.lmc-mark .lmc-sq { fill: var(--sadu); }
.lmc-mark-ink { width: 34px; height: 34px; border-radius: 3px; background: var(--paper); }

.lmc-icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
@media (hover: hover) and (pointer: fine) { .lmc-icon-btn:hover { background: var(--paper-2); color: var(--text); } }
.lmc-icon-btn:active { background: var(--paper-2); color: var(--text); transition-duration: .12s; }

.lmc-chips { display: grid; gap: 6px; }
.lmc-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper);
  color: var(--text);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
  transition: border-color .2s ease, background-color .2s ease, transform .3s var(--ease);
}
@media (hover: hover) and (pointer: fine) { .lmc-chip:hover { border-color: var(--text); background: var(--paper-hi); } }
.lmc-chip:active { border-color: var(--text); background: var(--paper-hi); transform: translateY(1px); transition-duration: .12s; }
.lmc-chip .lmc-ico { width: 16px; height: 16px; color: var(--text-3); transition: color .2s ease; }
@media (hover: hover) and (pointer: fine) { .lmc-chip:hover .lmc-ico { color: var(--text); } }

/* ---------- Greeting card ---------- */
.lmc-teaser {
  position: fixed;
  z-index: 45;
  inset-inline-end: var(--lmc-end);
  inset-block-end: calc(var(--lmc-bottom) + var(--lmc-launch) + 12px);
  width: min(344px, calc(100vw - 2 * var(--lmc-gap)));
  padding: 14px 16px 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper-hi);
  color: var(--text);
  box-shadow: 0 28px 56px -28px rgba(27, 25, 21, .42), 0 2px 6px rgba(27, 25, 21, .06);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .35s ease, transform .55s var(--ease);
}
.lmc-teaser.is-in { opacity: 1; transform: none; }
.lmc-teaser-top { display: flex; align-items: center; gap: 10px; margin-block-end: 8px; }
.lmc-teaser-label { flex: 1; font-size: .8125rem; font-weight: 600; color: var(--text-2); }
.lmc-teaser-top .lmc-icon-btn { margin-inline-end: -8px; }
.lmc-teaser-text { font-size: .9375rem; line-height: 1.65; }
.lmc-teaser-chips { margin-block-start: 12px; }
.lmc-teaser-reply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  margin-block-start: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
  font-size: .875rem;
  text-align: start;
  cursor: text;
  transition: border-color .2s ease;
}
@media (hover: hover) and (pointer: fine) { .lmc-teaser-reply:hover { border-color: var(--line-strong); } }
.lmc-teaser-reply:active { border-color: var(--line-strong); background: var(--paper); }
.lmc-teaser-reply .lmc-ico { width: 16px; height: 16px; }

/* ---------- Panel ----------
   chat.js moves the panel with springs and writes transform and opacity only
   while it is moving. These rules are the resting states, so there is no CSS
   transition here: one would smear every frame the script draws. */
.lmc-scrim, .lmc-grabber { display: none; }
.lmc-panel {
  position: fixed;
  z-index: 46;
  inset-inline-end: var(--lmc-end);
  inset-block-end: calc(var(--lmc-bottom) + var(--lmc-launch) + 12px);
  display: flex;
  flex-direction: column;
  width: min(392px, calc(100vw - 2 * var(--lmc-gap)));
  height: min(640px, calc(100dvh - var(--lmc-launch) - 72px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 36px 72px -32px rgba(27, 25, 21, .5), 0 2px 8px rgba(27, 25, 21, .08);
  opacity: 0;
  transform: translateY(12px) scale(.96);
  transform-origin: right bottom;   /* it grows out of the launcher's corner and returns to it */
}
html[dir="rtl"] .lmc-panel { transform-origin: left bottom; }
.lmc-panel.is-in { opacity: 1; transform: none; }

.lmc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 12px;
  padding-inline: 14px 8px;
  background: var(--ink);
  color: var(--on-ink);
}
.lmc-head-text { flex: 1; min-width: 0; }
.lmc-head h2 { font-family: var(--f-display); font-size: 1rem; font-weight: 600; line-height: 1.3; letter-spacing: 0; } /* tight tracking is for display sizes, not a 16px title */
.lmc-head p { font-size: .75rem; line-height: 1.4; color: var(--on-ink-2); }
.lmc-head .lmc-icon-btn { color: var(--on-ink-2); }
@media (hover: hover) and (pointer: fine) { .lmc-head .lmc-icon-btn:hover { background: var(--ink-3); color: var(--on-ink); } }
.lmc-head .lmc-icon-btn:active { background: var(--ink-3); color: var(--on-ink); }

.lmc-disclosure {
  padding: 8px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--text-2);
  font-size: .75rem;
  line-height: 1.55;
}
.lmc-disclosure a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }

.lmc-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.lmc-log:focus { outline: none; }

.lmc-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: .9375rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.lmc-msg p + p, .lmc-msg p + ul, .lmc-msg ul + p { margin-block-start: 8px; }
.lmc-msg ul { padding-inline-start: 18px; list-style: square; }
.lmc-msg li + li { margin-block-start: 2px; }
.lmc-msg li::marker { color: var(--text-3); }
.lmc-msg strong { font-weight: 600; }
.lmc-msg a { text-decoration: underline; text-underline-offset: 2px; }

.lmc-a {
  align-self: flex-start;
  border: 1px solid var(--line);
  border-start-start-radius: 2px;
  background: var(--paper-hi);
}
.lmc-u {
  align-self: flex-end;
  border-start-end-radius: 2px;
  background: var(--ink);
  color: var(--on-ink);
}
.lmc-error { border-inline-start: 2px solid var(--sadu); }
.lmc-log-chips { width: 88%; }

.lmc-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 10px; }
.lmc-actions a {
  padding: 6px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: border-color .2s ease;
}
@media (hover: hover) and (pointer: fine) { .lmc-actions a:hover { border-color: var(--text); } }
.lmc-actions a:active { border-color: var(--text); }
.lmc-teaser-text .lmc-actions { margin-block-start: 12px; }

.lmc-note {
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: none;
  padding: 2px 0;
  color: var(--text-2);
  font-size: .8125rem;
}
.lmc-note .lmc-ico { width: 16px; height: 16px; color: var(--text); }

.lmc-typing { padding-block: 14px; }
.lmc-dots { display: inline-flex; gap: 5px; }
.lmc-dots i { width: 6px; height: 6px; background: var(--text-3); animation: lmc-dot 1.2s var(--ease) infinite; }
.lmc-dots i:nth-child(2) { animation-delay: .15s; }
.lmc-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes lmc-dot {
  0%, 60%, 100% { opacity: .35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}

/* ---------- Composer ---------- */
.lmc-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px 8px;
  border-top: 1px solid var(--line);
  background: var(--paper-hi);
}
/* Under the message box: carry on with a person on WhatsApp, request already typed */
.lmc-handover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  padding: 0 14px 10px;
  background: var(--paper-hi);
  color: var(--text-2);
  font-size: .8125rem;
  line-height: 1.5;
}
.lmc-wa {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* The WhatsApp glyph, in the colour of its text */
.lmc-wa-ico {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  margin-inline-end: .4em;
  vertical-align: -.16em;
  fill: currentColor;
  flex: none;
}
.lmc-wa .lmc-wa-ico { width: 15px; height: 15px; margin: 0; }
.lmc-compose textarea {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 132px;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--paper-hi);
  color: var(--text);
  font-family: var(--f-text);
  font-size: 1rem;
  line-height: 1.4;
  overflow-y: hidden;
  resize: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.lmc-compose textarea::placeholder { color: var(--text-3); }
.lmc-compose textarea:focus { outline: none; border-color: var(--text); box-shadow: 0 0 0 3px rgba(168, 50, 45, .16); }
.lmc-send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--sadu);
  color: var(--paper-hi);
  cursor: pointer;
  transition: background-color .2s ease, transform .3s var(--ease);
}
@media (hover: hover) and (pointer: fine) { .lmc-send:hover { background: var(--sadu-press); } }
.lmc-send:active { background: var(--sadu-press); transform: translateY(1px) scale(.97); transition-duration: .12s; }
.lmc-send:disabled { background: var(--paper-2); color: var(--text-3); cursor: default; transform: none; }

/* ---------- Hide behind the mobile menu ---------- */
html.menu-open .lmc-launcher,
html.menu-open .lmc-teaser { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .2s ease, visibility 0s linear .2s; }

/* ---------- Phones: compact greeting, conversation as a sheet ---------- */
@media (max-width: 599px) {
  .lmc { --lmc-gap: 16px; --lmc-sheet-gap: calc(var(--sa-t, 0px) + 10px); }
  .lmc-launcher { width: var(--lmc-launch); padding: 0; justify-content: center; }
  .lmc-launcher-label { display: none; }
  .lmc-teaser { width: auto; inset-inline-start: var(--lmc-start); }
  .lmc-teaser-chips .lmc-chip:nth-child(3) { display: none; }

  /* The page stays visible, dimmed, in a strip above the sheet: the chat sits on
     top of the site, it does not replace it. Tapping the dimmed strip closes it. */
  .lmc-scrim {
    display: block;
    position: fixed;
    z-index: 46;                      /* same layer as the panel, which comes after it */
    inset: 0;
    background: rgba(27, 25, 21, .5);
    opacity: 0;
    pointer-events: none;             /* only an open chat may take taps */
  }
  html.lmc-open .lmc-scrim { opacity: 1; pointer-events: auto; }

  /* The sheet rises from the bottom edge and leaves by the same path */
  .lmc-panel {
    inset: auto 0 0 0;
    width: 100%;
    height: calc(100% - var(--lmc-sheet-gap));
    height: calc(100dvh - var(--lmc-sheet-gap));
    overflow: visible;
    border: 0;
    border-radius: 6px 6px 0 0;
    box-shadow: 0 -16px 40px -20px rgba(27, 25, 21, .45);
    opacity: 1;
    transform: translateY(100%);
  }
  /* Keeps the page covered when a pull or a bounce lifts the sheet a little above rest */
  .lmc-panel::after {
    content: "";
    position: absolute;
    inset-inline: 0;
    inset-block-start: 100%;
    height: 160px;
    background: var(--paper-hi);
  }
  /* The header is the handle: drag it down to close */
  .lmc-head {
    position: relative;
    padding-block-start: 20px;
    border-radius: 6px 6px 0 0;
    touch-action: none;               /* the drag belongs to the sheet, not to page scrolling */
    -webkit-user-select: none;
    user-select: none;
  }
  .lmc-grabber {
    display: block;
    position: absolute;
    inset-block-start: 7px;
    inset-inline-start: 50%;
    width: 36px;
    height: 4px;
    margin-inline-start: -18px;
    border-radius: 2px;
    background: var(--on-ink-3);
  }
  .lmc-handover { padding-block-end: max(10px, var(--sa-b, 0px)); }   /* clears the home indicator */
  html.lmc-open .lmc-launcher { display: none; }
  html.lmc-open body { overflow: hidden; }
}

/* ---------- Glass ----------
   The panel is a translucent material: the page behind shows through it, blurred
   and tinted in the brand's limestone and ink. One blur layer sits on the panel
   and each region only tints it. Colour passing through is muted (saturate 40%),
   so the red banner behind reads as warm stone, never pink: the brand has one red.
   Messages, quick replies and the text box stay
   solid, so reading never depends on what happens to be behind. Browsers without
   backdrop-filter keep the solid panel above; so do visitors who ask their
   device for more contrast (see the next block). The glass deliberately stays on
   when a device's "transparency effects" are off: the owner chose that, and all
   reading text sits on solid surfaces either way. */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .lmc-panel {
    background: transparent;
    -webkit-backdrop-filter: blur(22px) saturate(40%);
    backdrop-filter: blur(22px) saturate(40%);
    border-color: rgba(255, 255, 255, .42);              /* a bright edge, like light catching the material */
    box-shadow: 0 0 0 1px rgba(27, 25, 21, .1), 0 40px 80px -32px rgba(27, 25, 21, .55), 0 4px 14px rgba(27, 25, 21, .1);
  }
  .lmc-head { background: rgba(27, 25, 21, .86); }                                                   /* ink */
  .lmc-disclosure { background: rgba(235, 229, 216, .8); border-bottom-color: rgba(27, 25, 21, .1); color: var(--text); }
  .lmc-log { background: rgba(244, 240, 232, .8); }                                                   /* limestone */
  .lmc-compose { background: rgba(250, 247, 241, .82); border-top-color: rgba(27, 25, 21, .1); }
  .lmc-handover { background: rgba(250, 247, 241, .82); }
  .lmc-note { color: var(--text); }                      /* text that sits straight on the glass is full strength */

  /* A sheet is a bigger surface, so it reads as thicker glass */
  @media (max-width: 599px) {
    .lmc-panel {
      -webkit-backdrop-filter: blur(28px) saturate(40%);
      backdrop-filter: blur(28px) saturate(40%);
      box-shadow: 0 -16px 40px -20px rgba(27, 25, 21, .45);
    }
    .lmc-disclosure { background: rgba(235, 229, 216, .88); }
    .lmc-log { background: rgba(244, 240, 232, .84); }
    .lmc-compose, .lmc-handover { background: rgba(250, 247, 241, .9); }
  }
}

/* ---------- Accessibility settings ---------- */
/* More contrast: back to the solid panel */
@media (prefers-contrast: more) {
  .lmc-panel { background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--line); }
  .lmc-head { background: var(--ink); }
  .lmc-disclosure { background: var(--paper-2); border-bottom-color: var(--line); }
  .lmc-log { background: transparent; }
  .lmc-compose { background: var(--paper-hi); border-top-color: var(--line); }
  .lmc-handover { background: var(--paper-hi); color: var(--text); }
}
@media (prefers-reduced-motion: reduce) {
  .lmc-launcher, .lmc-teaser, .lmc-chip, .lmc-send { transition: none; }
  .lmc-teaser { transform: none; }
  /* A short cross-fade stands in for the springs and the sliding sheet; dragging is off */
  .lmc-panel, .lmc-panel.is-in { transform: none; transition: opacity .2s ease; }
  .lmc-panel { opacity: 0; }
  .lmc-panel.is-in { opacity: 1; }
  .lmc-scrim { transition: opacity .2s ease; }
  .lmc-grabber { display: none; }
  .lmc-dots i { animation: none; opacity: .7; }
  .lmc-log { scroll-behavior: auto; }
}
@media (prefers-contrast: more) {
  .lmc-panel, .lmc-teaser, .lmc-a, .lmc-chip, .lmc-compose textarea, .lmc-actions a { border-color: var(--text); }
  .lmc-disclosure, .lmc-note { color: var(--text); }
  .lmc-head p { color: var(--on-ink); }
  .lmc-scrim { background: rgba(27, 25, 21, .88); }
}

@media print { .lmc { display: none; } }
