/* ══════════════════════════════════════════════════════════════
   trip.expert — Guest Chat Widget
   Mobile-first, RTL-aware, luxury hospitality design
   ══════════════════════════════════════════════════════════════ */

/* ── Design Tokens ─────────────────────────────────────────── */

:root {
  /* Colors */
  --color-bg:           #FFFFFF;
  --color-surface:      #FFFFFF;
  --color-surface-alt:  #F5F5F5;
  --color-primary:      #2B2B2B;
  --color-accent:       #FF5C35;
  --color-accent-hover: #E04E2A;
  --color-accent-tint:  rgba(255, 92, 53, 0.14);   /* --color-accent at 14% */
  --color-guest:        transparent;
  --color-text:         #2C2C2C;
  --color-text-light:   #8A8780;
  --color-success:      #5E8B6A;
  --color-error:        #C0605A;
  --color-border:       #E0E0E0;
  --color-card-border:  #D2D2D2;   /* cards: a step darker than --color-border */

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.10);

  /* Typography */
  --font-display: "Roboto", "Helvetica Neue", sans-serif;
  --font-body:    "DM Sans", "Helvetica Neue", sans-serif;

  /* Radii */
  --radius-bubble:      18px;
  --radius-bubble-tail: 4px;
  --radius-button:      24px;
  --radius-card:        16px;
  --radius-card-sm:     8px;    /* attraction and service cards, details panel */
  --radius-input:       24px;

  /* Images */
  --image-height:       180px;
  --image-width:        240px;

  /* Cards (attractions and services) */
  --card-min-width:     340px;  /* 2 per line in the chat column, 1 on a phone */
  --card-min-height:    96px;
  --card-thumb-width:   112px;

  /* Layout */
  --chat-max-width:     768px;
  --header-compact-height: 56px;  /* read by chat.js (hero collapse point) */
}

/* ── Reset ─────────────────────────────────────────────────── */

*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ── Base ──────────────────────────────────────────────────── */

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-height: 100dvh;
}

/* ── Visually Hidden (accessibility) ───────────────────────── */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Chat Container ────────────────────────────────────────── */

.chat {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--color-bg);
  position: relative;
}


/* ── Header ────────────────────────────────────────────────── */

.chat__header {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 max(24px, calc((100% - var(--chat-max-width)) / 2));
  height: 44px;
  background: var(--color-surface);
  color: var(--color-text);
  flex-shrink: 0;
  direction: ltr;
}

.chat__header-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.chat__header-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 20px;
  background: #333 !important;
  color: #fff;
}

.chat__header-pill-link {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 4px 20px;
  background: var(--color-surface);
  text-decoration: none;
  color: inherit;
}

.chat__header-pill-link:hover {
  background: var(--color-bg);
}

.chat__business-name {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 100;
  line-height: 1.2;
  margin: 0;
}

.chat__header-back {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  color: var(--color-text);
  text-decoration: none;
  font-size: 18px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.chat__header-back:hover {
  opacity: 1;
}

/* ── Hero Header (phones, when a welcome photo is shown) ───── */

/* Compact bar content: hidden unless hero mode is active on a phone. */
.chat__header-compact {
  display: none;
}

@media (max-width: 798px) {
  /* The header floats transparent over the photo, then turns solid with the
     compact bar once the photo has scrolled away (chat--hero-collapsed). */
  .chat--hero .chat__header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    height: var(--header-compact-height);
    padding: 0 16px;
    background: transparent;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
  }

  /* The name is on the photo, so the pill is not needed. */
  .chat--hero .chat__header-pill,
  .chat--hero .chat__header-pill-link {
    display: none;
  }

  .chat--hero .chat__header-back {
    color: #fff;
    opacity: 0.9;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  }

  .chat--hero .chat__header-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-right: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
  }

  .chat--hero .chat__header-back ~ .chat__header-compact {
    margin-left: 28px;
  }

  .chat--hero.chat--hero-collapsed .chat__header {
    background: var(--color-surface);
    box-shadow: 0 1px 0 var(--color-border);
  }

  .chat--hero.chat--hero-collapsed .chat__header-compact {
    opacity: 1;
    visibility: visible;
  }

  .chat--hero.chat--hero-collapsed .chat__header-back {
    color: var(--color-text);
    opacity: 0.5;
    text-shadow: none;
  }
}

.chat__header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.chat__header-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.chat__header-title,
.chat__header-sub {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat__header-title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.chat__header-sub {
  font-size: 12px;
  color: var(--color-text-light);
  line-height: 1.3;
}

/* ── Messages Area ─────────────────────────────────────────── */

.chat__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px max(15px, calc((100% - var(--chat-max-width)) / 2));
  display: flex;
  flex-direction: column;
  scroll-behavior: smooth;
  direction: ltr;
  /* The view is positioned by chat.js (a just-sent question is held at the
     top). The browser's own scroll anchoring would nudge it as the answer and
     the space under it change size. */
  overflow-anchor: none;

  /* Hide scrollbars */
  scrollbar-width: none;
}

.chat__messages::-webkit-scrollbar {
  display: none;
}

/* Empty space under the latest turn, so a just-sent question can be held at
   the top of the view while its answer is still short (chat.js
   updateTurnSpace sets --turn-space). */
.chat__messages::after {
  content: "";
  flex-shrink: 0;
  height: var(--turn-space, 0px);
}

/* ── Message Image ─────────────────────────────────────────── */

.chat__message-images {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chat__message-image {
  display: block;
  width: 100%;
  height: var(--image-height);
  border-radius: var(--radius-card);
  object-fit: cover;
  cursor: pointer;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.chat__message-figure {
  position: relative;
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  flex: 1 1 0;
  min-width: 120px;
  max-width: var(--image-width);
}

.chat__message-figure .chat__message-image {
  border-radius: 0;
}

/* Gallery: a grid of equal 4:3 landscape tiles. The base flex row lets tiles
   shrink to 120px wide at a fixed 180px height, which makes them portrait. */
.chat__message-images--gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.chat__message-images--gallery .chat__message-figure {
  min-width: 0;
  max-width: none;
  aspect-ratio: 4 / 3;
}

.chat__message-images--gallery .chat__message-image {
  height: 100%;
}

.chat__message-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  padding: 4px 10px;
  font-size: 12px;
  color: #fff;
  background: rgba(51, 51, 51, 0.6);
  border-bottom-left-radius: var(--radius-card);
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* ── Message Video ─────────────────────────────────────────── */

.chat__message-videos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chat__message-figure--video {
  min-width: 280px;
  max-width: 320px;
}

.chat__message-figure--video .chat__message-video-wrap {
  min-height: 158px; /* 280 * 9/16 */
}

.chat__message-video-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  border-radius: var(--radius-card);
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.chat__message-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* Click-to-load placeholder. Deliberately draws nothing from a remote host —
   not even a YouTube thumbnail, which would leak the guest's IP exactly as the
   iframe does. Local gradient + glyph only. */
.chat__video-placeholder {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-card);
  background: linear-gradient(135deg, #2c3440 0%, #171c24 100%);
  color: #fff;
  cursor: pointer;
  text-align: center;
  font-family: inherit;
  transition: filter 200ms ease;
}

.chat__video-placeholder:hover,
.chat__video-placeholder:focus-visible {
  filter: brightness(1.15);
}

.chat__video-play {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  position: relative;
  flex: none;
}

/* Play triangle, drawn with borders so no asset is fetched. */
.chat__video-play::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 52%;
  transform: translate(-50%, -50%);
  border-style: solid;
  border-width: 9px 0 9px 15px;
  border-color: transparent transparent transparent #171c24;
}

.chat__video-label {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat__video-notice {
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.75;
  max-width: 95%;
}

/* ── Messages ──────────────────────────────────────────────── */

.chat__message {
  max-width: 65%;
  padding: 4px 0;
  font-size: 15px;
  line-height: 1.6;
  word-wrap: break-word;
  white-space: pre-wrap;
  margin-top: 2px;
  animation: fadeInUp 300ms ease both;
}


/* Bot messages — left-aligned, full width */
.chat__message--bot {
  align-self: flex-start;
  max-width: 100%;
  color: var(--color-text);
  position: relative;
}

/* Bulleted list in an answer (chat.js formatMarkdown). The padding gives a
   hanging indent, so a wrapped item lines up under its own text. */
.chat__list {
  margin: 4px 0;
  padding-inline-start: 1.25em;
}

.chat__list li + li {
  margin-top: 4px;
}

/* Answer still arriving (streaming): a thin blinking caret after the text.
   The reduced-motion block below stops the blink. */
.chat__message--streaming::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-inline-start: 2px;
  vertical-align: text-bottom;
  background: currentColor;
  animation: caretBlink 1s steps(1) infinite;
}

@keyframes caretBlink {
  50% { opacity: 0; }
}

/* Fade-in of the newest streamed characters (chat.js fadeTail): level 0 is the
   newest. FADE_LEVELS in chat.js must match the number of levels here. */
.chat__fade-0 { opacity: 0.15; }
.chat__fade-1 { opacity: 0.3; }
.chat__fade-2 { opacity: 0.45; }
.chat__fade-3 { opacity: 0.6; }
.chat__fade-4 { opacity: 0.75; }
.chat__fade-5 { opacity: 0.9; }

/* ── Copy Button ───────────────────────────────────────────── */

.chat__copy-btn {
  position: absolute;
  top: 4px;
  right: -32px;
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  color: var(--color-text-light);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease;
}

.chat__message--bot:hover .chat__copy-btn {
  opacity: 1;
}

.chat__copy-btn:hover {
  color: var(--color-text);
}

.chat__copy-btn--copied {
  color: var(--color-success);
}

.chat__copy-btn svg {
  width: 16px;
  height: 16px;
}

/* Always show on touch devices */
@media (hover: none) {
  .chat__copy-btn {
    opacity: 0.6;
  }
}

/* Narrow screens: the 15px side gutter has no room for the button beside the
   text (right: -32px pushed it off-screen and made the thread scroll sideways),
   so it sits under the answer instead, with a finger-sized tap area. */
@media (max-width: 798px) {
  .chat__copy-btn {
    position: static;
    width: 32px;
    height: 32px;
    margin: 2px 0 0;
    /* Line the icon up with the text start; follows the answer's own direction. */
    margin-inline-start: -6px;
  }

  /* The copy-button row already separates one turn from the next, so the
     question after an answer drops its usual 20px top margin. */
  .chat__message--bot:not(.chat__message--welcome) + .chat__message--user {
    margin-top: 4px;
  }
}

/* Guest messages — right-aligned bubble */
.chat__message--user {
  align-self: flex-end;
  color: var(--color-text);
  background: #D3E3FD;
  margin-top: 20px;
  padding: 10px 16px;
  border-radius: var(--radius-bubble) var(--radius-bubble-tail) var(--radius-bubble) var(--radius-bubble);
  text-align: left;
  animation-duration: 200ms;
}

/* ── Message Time ──────────────────────────────────────────── */

.chat__msg-time {
  display: none;
}

/* Error messages — centered */
.chat__message--error {
  align-self: center;
  max-width: 90%;
  background: rgba(192, 96, 90, 0.08);
  color: var(--color-error);
  font-size: 14px;
  text-align: center;
  border-radius: 8px;
  padding: 8px 16px;
  margin-top: 8px;
  cursor: pointer;
}

.chat__message--error:hover {
  background: rgba(192, 96, 90, 0.12);
}

/* Grouped messages — reduced spacing */
.chat__message--grouped {
  margin-top: 2px;
}

/* ── RTL Support ───────────────────────────────────────────── */

/* "start", not "right": text-align is inherited, and a physical "right" would
   also push the text of a left-to-right card in a Hebrew answer to the right. */
.chat__message[dir="rtl"] {
  text-align: start;
}

/* Guest messages carry dir="auto" (their own text decides), so match the
   resolved direction, not the attribute. */
.chat__message--user:dir(rtl) {
  margin-top: 15px;
}

.chat__message--bot[dir="rtl"] {
  align-self: flex-end;
  margin-top: 5px;
}

/* ── Widget-Level RTL ─────────────────────────────────────── */

.chat[dir="rtl"] .chat__textarea {
  text-align: right;
  direction: rtl;
}

.chat[dir="rtl"] .chat__copy-btn {
  right: auto;
  left: -32px;
}

.chat[dir="rtl"] .chat__message-caption {
  left: auto;
  right: 0;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: var(--radius-card);
}

.chat[dir="rtl"] .chat__contact-close {
  right: auto;
  left: 4px;
}

.chat[dir="rtl"] .chat__contact-tag {
  left: auto;
  right: 0;
  border-bottom-right-radius: 0;
  border-bottom-left-radius: var(--radius-card);
  direction: rtl;
}

.chat[dir="rtl"] .chat__contact-input,
.chat[dir="rtl"] .chat__contact-textarea {
  text-align: right;
  direction: rtl;
}

.chat[dir="rtl"] #contact-info {
  text-align: left;
  direction: ltr;
}

.chat[dir="rtl"] .chat__contact-label {
  text-align: right;
  direction: rtl;
}

.chat[dir="rtl"] .chat__contact-counter {
  text-align: left;
}


/* ── Links in Messages ─────────────────────────────────────── */

.chat__message a {
  color: var(--color-accent);
  text-decoration: none;
  transition: text-decoration 200ms ease;
}

.chat__message a:hover {
  text-decoration: underline;
}

/* ── Status Indicator ──────────────────────────────────────── */

.chat__status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  align-self: flex-start;
  margin-top: 4px;
  animation: fadeIn 150ms ease;
}

.chat[dir="rtl"] .chat__status {
  align-self: flex-end;
  direction: rtl;
}

.chat__status-icon {
  width: 6px;
  height: 6px;
  background: var(--color-text);
  border-radius: 50%;
  animation: statusBounce 0.6s ease-in-out infinite;
  flex-shrink: 0;
}

.chat__status-text {
  font-size: 15px;
  color: var(--color-text);
  font-family: monospace;
  letter-spacing: 0.5px;
}

.chat__status-ellipsis {
  font-size: 15px;
  color: var(--color-text);
}

@keyframes statusBounce {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-4px); opacity: 1; }
}

.chat__status--dots {
  gap: 4px;
}

.chat__status-dot {
  width: 8px;
  height: 8px;
  background: var(--color-text-light);
  border-radius: 50%;
  animation: statusDotBounce 1.4s infinite ease-in-out;
}

.chat__status-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.chat__status-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes statusDotBounce {
  0%, 80%, 100% {
    transform: scale(0.6);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* ── Input Area ────────────────────────────────────────────── */

.chat__input-area {
  padding: 12px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  min-width: 0;
  background: var(--color-surface);
}

.chat__input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: var(--chat-max-width);
  width: 100%;
  margin: 0 auto;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-input);
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.chat[dir="rtl"] .chat__input-box {
  padding: 6px 14px 6px 6px;
}

.chat[dir="rtl"] .chat__actions {
  direction: rtl;
  justify-content: flex-start;
}

.chat__textarea {
  flex: 1;
  padding: 10px 0;
  border: none;
  border-radius: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  resize: none;
  outline: none;
  min-height: 44px;
  max-height: 120px;
  color: var(--color-text);
  background: transparent;
}

.chat__textarea:focus-visible {
  outline: none;
}

.chat__textarea::placeholder {
  color: var(--color-text-light);
}

.chat__textarea:disabled {
  color: var(--color-text-light);
}

/* ── Disclaimer ───────────────────────────────────────────── */

.chat__disclaimer {
  text-align: center;
  font-family: var(--font-body);
  font-size: 11px;
  color: var(--color-text-light);
  padding: 9px 0 0;
  max-width: var(--chat-max-width);
  margin: 0 auto;
}

/* ── Send Button ───────────────────────────────────────────── */

.chat__send-btn {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--color-accent);
  color: #FFFFFF;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 200ms ease, opacity 200ms ease;
  opacity: 1;
  pointer-events: auto;
  margin-bottom: 4px;
}

.chat__send-btn:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.chat__send-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.chat__send-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.chat__send-btn svg {
  width: 18px;
  height: 18px;
}

/* ── Character Counter ─────────────────────────────────────── */

.chat__char-counter {
  font-size: 11px;
  color: var(--color-text-light);
  text-align: right;
  margin-top: 4px;
  padding-right: 4px;
  transition: color 200ms ease;
  display: none;
}

.chat__char-counter--warning {
  color: #D4A017;
}

.chat__char-counter--danger {
  color: var(--color-error);
}

/* ── Scroll-to-Bottom Button ───────────────────────────────── */

.chat__scroll-btn {
  position: absolute;
  bottom: 100px;
  right: max(16px, calc((100% - var(--chat-max-width)) / 2));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 10;
}

.chat__scroll-btn--visible {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.chat__scroll-btn:hover {
  background: var(--color-surface-alt);
}

.chat__scroll-btn:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

.chat__scroll-btn svg {
  width: 20px;
  height: 20px;
}

/* ── Skeleton Loading ──────────────────────────────────────── */

.chat__skeleton {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px 0;
}

.chat__skeleton-bubble {
  height: 48px;
  border-radius: var(--radius-bubble);
  background: linear-gradient(
    90deg,
    var(--color-surface-alt) 25%,
    var(--color-bg) 50%,
    var(--color-surface-alt) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.chat__skeleton-bubble:nth-child(1) {
  width: 65%;
  align-self: flex-start;
}

.chat__skeleton-bubble:nth-child(2) {
  width: 45%;
  align-self: flex-end;
}

.chat__skeleton-bubble:nth-child(3) {
  width: 55%;
  align-self: flex-start;
}

/* ── Debug Panel ──────────────────────────────────────────── */

.chat__debug {
  align-self: flex-start;
  max-width: 90%;
  margin-top: 4px;
  font-size: 15px;
  font-family: "SF Mono", "Consolas", "Monaco", monospace;
  color: var(--color-text-light);
}

.chat__debug-summary {
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--color-surface-alt);
  user-select: none;
  list-style: none;
}

.chat__debug-summary::before {
  content: "\25B6  ";
  font-size: 9px;
}

.chat__debug[open] .chat__debug-summary::before {
  content: "\25BC  ";
}

.chat__debug-summary::-webkit-details-marker {
  display: none;
}

.chat__debug-content {
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--color-surface-alt);
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
}

/* ── Init Error ────────────────────────────────────────────── */

.chat__init-error {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 24px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 15px;
  line-height: 1.6;
}

/* ── Session-limit notice ──────────────────────────────────── */

.chat__notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 15px;
  line-height: 1.6;
}

.chat__notice-text {
  margin: 0;
}

.chat__notice-link {
  color: inherit;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Action Bar ────────────────────────────────────────────── */

/* ── Drawer toggle (+) button ─────────────────────────────── */

.chat__drawer-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text-light);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 4px;
  transition: transform 200ms ease, color 200ms ease, border-color 200ms ease;
}

.chat__drawer-toggle:hover {
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.chat__drawer-toggle--open {
  transform: rotate(45deg);
  color: var(--color-accent);
  border-color: var(--color-accent);
}

/* ── Drawer overlay ───────────────────────────────────────── */

.chat__drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 9;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

.chat__drawer-overlay--open {
  opacity: 1;
  pointer-events: auto;
}

/* ── Drawer popover ───────────────────────────────────────── */

.chat__drawer {
  position: absolute;
  bottom: 70px;
  width: auto;
  min-width: 200px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
  z-index: 10;
  transform: scale(0.9) translateY(8px);
  transform-origin: bottom left;
  opacity: 0;
  pointer-events: none;
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 150ms ease;
}

.chat[dir="rtl"] .chat__drawer {
  transform-origin: bottom right;
}

.chat__drawer--open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.chat__drawer-items {
  display: flex;
  flex-direction: column;
  padding: 8px 0 12px;
}

.chat__drawer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: background 150ms;
}

.chat[dir="rtl"] .chat__drawer-item {
  text-align: right;
}

.chat__drawer-item:hover {
  background: var(--color-surface-alt);
}

.chat__drawer-item--hidden {
  display: none;
}


/* ── Gallery Toggle ───────────────────────────────────────── */

.chat__gallery-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 20px;
  color: var(--color-text-light);
  padding: 0 2px;
}

/* ── Lightbox ─────────────────────────────────────────────── */

.chat__lightbox {
  position: absolute;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.chat__lightbox-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #fff;
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  z-index: 1;
}

.chat__lightbox-img {
  max-width: 100%;
  max-height: calc(100% - 40px);
  object-fit: contain;
  border-radius: 8px;
}

.chat__lightbox-caption {
  color: #fff;
  font-size: 14px;
  margin-top: 8px;
  text-align: center;
}

/* ── Contact Form ─────────────────────────────────────────── */

.chat__contact-card {
  position: relative;
  align-self: center;
  width: 100%;
  max-width: 420px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 24px;
  padding-top: 48px;
  margin-top: 16px;
  margin-bottom: 10px;
  animation: fadeInUp 300ms ease both;
  overflow: hidden;
  flex-shrink: 0;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

.chat__contact-close {
  position: absolute;
  top: 2px;
  right: 4px;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  font-size: 20px;
  line-height: 1;
  color: var(--color-text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 150ms, color 150ms;
}

.chat__contact-close:hover {
  background: var(--color-surface-alt);
  color: var(--color-text);
}

.chat__contact-tag {
  position: absolute;
  top: 0;
  left: 0;
  padding: 6px 16px;
  background: #d4edda;
  color: #1e5631;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  border-bottom-right-radius: var(--radius-card);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80%;
}

.chat__contact-field {
  margin-bottom: 14px;
}

.chat__contact-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 4px;
}

.chat__required { color: #e74c3c; }

.chat__contact-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text);
  background: var(--color-surface-alt);
  outline: none;
  transition: border-color 200ms ease;
  user-select: text;
  -webkit-touch-callout: default;
}

.chat__contact-input:focus {
  border-color: var(--color-accent);
}

.chat__contact-textarea {
  min-height: 80px;
  max-height: 160px;
  resize: vertical;
  line-height: 1.5;
}

.chat__contact-error {
  font-size: 13px;
  color: var(--color-error);
  margin-top: 4px;
  min-height: 0;
}

.chat__contact-counter {
  font-size: 11px;
  color: var(--color-text-light);
  text-align: right;
  margin-top: 4px;
}

.chat__contact-field-footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 0px;
}

.chat__contact-field-footer .chat__contact-error,
.chat__contact-field-footer .chat__contact-counter {
  margin-top: 0;
}

.chat__contact-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
}

.chat__contact-submit {
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius-button);
  background: var(--color-accent);
  color: #FFFFFF;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 200ms ease;
}

.chat__contact-submit:hover:not(:disabled) {
  background: var(--color-accent-hover);
}

.chat__contact-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat__contact-cancel {
  padding: 10px 16px;
  border: none;
  background: none;
  color: var(--color-text-light);
  font-family: var(--font-body);
  font-size: 14px;
  cursor: pointer;
  transition: color 150ms ease;
}

.chat__contact-cancel:hover {
  color: var(--color-text);
}

/* ── Contact Sent Card ──────────────────────────────────────
   The card frame (see Cards), in a one-card .chat__cards grid built by
   showContactSent: a title line (check, "Message Sent", time), then the
   reason, the guest's contact details and message. */

.chat__contact-sent-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-card-sm);
  background: var(--color-surface);
  animation: fadeInUp 300ms ease both;
}

.chat__contact-sent-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.chat__contact-sent-icon {
  flex-shrink: 0;
  color: var(--color-success);
}

/* Dark text, green icon: --color-success on white is under 4.5:1 for 14px text. */
.chat__contact-sent-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.chat__contact-sent-time {
  margin-inline-start: auto;
  font-size: 12px;
  color: var(--color-text-light);
  font-variant-numeric: tabular-nums;
}

.chat__contact-sent-reason {
  font-size: 13px;
  color: var(--color-text-light);
}

.chat__contact-sent-info {
  font-size: 13px;
  color: var(--color-text);
  word-wrap: break-word;
}

.chat__contact-sent-msg {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* The guest's lines (dir="auto") line up with the card's side, not their own. */
.chat__contact-sent-card:dir(ltr) > * { text-align: left; }
.chat__contact-sent-card:dir(rtl) > * { text-align: right; }

/* ── Cards (attractions and services) ─────────────────────────
   One frame for both card types (plan: unified-chat-cards.md): the photo
   flush with the card's start edge at full height, then the body — the text
   and, at the end, what the card does (attraction: chevron, service: button).
   One grid holds all the cards of an answer, and the "Things to Do" list. */

.chat__cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(var(--card-min-width), 100%), 1fr));
  gap: 10px;
  margin-top: 12px;
}

/* A bot message shrinks to its text width (align-self: flex-start), which would
   squeeze the grid to one column under a short answer: a message with cards
   takes the full width instead. */
.chat__message--bot:has(.chat__cards) {
  align-self: stretch;
}

.chat__card {
  display: flex;
  min-height: var(--card-min-height);
  overflow: hidden;
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-card-sm);
  background: var(--color-surface);
  white-space: normal;   /* the message keeps pre-wrap for its own text */
}

/* The card's own display rule would otherwise beat the browser's [hidden] style. */
.chat__card[hidden] {
  display: none;
}

/* Gray when there is no photo (or it fails to load). The photo is taken out
   of the flow (absolute), so a tall photo cannot stretch the card: the card's
   text decides its height, and the photo fills it, cropped and centered. */
.chat__card-media {
  position: relative;
  flex-shrink: 0;
  width: var(--card-thumb-width);
  background: var(--color-surface-alt);
}

/* The photo's button: fills the photo area, opens the full-screen viewer. */
.chat__card-zoom {
  position: absolute;
  inset: 0;
  display: block;
  padding: 0;
  border: none;
  background: none;
  cursor: zoom-in;
  -webkit-tap-highlight-color: transparent;
}

.chat__card-zoom:focus-visible { outline-offset: -2px; }

.chat__card-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* The button wraps under the text when the card is too narrow for both on one
   line (flex-wrap + the text's 140px basis): no breakpoint needed. */
.chat__card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 12px 14px;
}

.chat__card-info {
  flex: 1 1 140px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Owner text (dir="auto") keeps its own reading order but lines up with the
   card's (interface) start edge, so mixed lines do not zigzag in an RTL card.
   Physical sides, scoped by the card's direction: "start" (and match-parent,
   in Chromium) would follow each line's own direction. */
.chat__card:dir(ltr) .chat__card-info > * { text-align: left; }
.chat__card:dir(rtl) .chat__card-info > * { text-align: right; }

.chat__card-name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat__card-desc,
.chat__card-note {
  font-size: 13px;
  line-height: 1.4;
  color: var(--color-text-light);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chat__card-meta {
  font-size: 13px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.chat__card-action {
  flex-shrink: 0;
  min-height: 36px;   /* touch target */
  padding: 6px 18px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-button);
  background: var(--color-surface);
  color: var(--color-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
  cursor: pointer;
}

.chat__card-action:hover { background: var(--color-surface-alt); }

.chat__cards-more {
  display: block;
  margin: 10px auto 0;
  padding: 7px 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-button);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.chat__cards-more:hover { background: var(--color-surface-alt); }

/* ── Attraction cards ──────────────────────────────────────────
   The card frame above, plus: the whole card opens its details panel. */

.chat__attraction-card {
  cursor: pointer;
  transition: background 150ms, box-shadow 150ms;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.chat__attraction-card:hover {
  background: var(--color-surface-alt);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.chat__attraction-card--expanded {
  background: var(--color-surface-alt);
}

.chat__attraction-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.chat__attraction-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--color-surface-alt);
  color: var(--color-text-light);
  white-space: nowrap;
}

.chat__attraction-pill--must-see { background: #fef3c7; color: #92400e; }
.chat__attraction-pill--free { background: #dcfce7; color: #166534; }
.chat__attraction-pill--kid-friendly { background: #dbeafe; color: #1e40af; }
.chat__attraction-pill--gem { background: #ede9fe; color: #5b21b6; }

.chat__attraction-chevron {
  display: flex;
  flex-shrink: 0;
  color: var(--color-text-light);
  transition: transform 200ms ease;
  margin-inline-start: auto;
}

.chat__attraction-card--expanded .chat__attraction-chevron {
  transform: rotate(90deg);
}

/* Detail panel — expands below the grid row */

.chat__attraction-detail {
  grid-column: 1 / -1;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  padding: 0 12px;
  background: var(--color-surface-alt);
  border-radius: var(--radius-card-sm);
  transition: max-height 300ms ease, padding 300ms ease, opacity 200ms ease;
}

.chat__attraction-detail--open {
  max-height: 500px;
  opacity: 1;
  padding: 12px;
}

.chat__attraction-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.chat__attraction-detail-name {
  font-weight: 600;
  font-size: 15px;
}

.chat__attraction-detail-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: var(--color-text-light);
  padding: 0 2px;
  line-height: 1;
}

.chat__attraction-detail-close:hover {
  color: var(--color-text);
}

.chat__attraction-detail-desc {
  font-size: 13px;
  color: var(--color-text);
  line-height: 1.5;
  margin-bottom: 8px;
}

.chat__attraction-note {
  font-size: 12px;
  font-style: italic;
  color: var(--color-text-light);
  margin-bottom: 8px;
}

.chat__attraction-cta {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-accent);
  text-decoration: none;
}

.chat__attraction-cta:hover {
  text-decoration: underline;
}

/* ── Service request card ─────────────────────────────────
   A request the guest sent with the request form, and its status, in the
   card frame (see Cards), in a one-card .chat__cards grid. The start border
   carries the state, so a glance up the chat shows which
   requests are still waiting. */
.chat__request {
  --request-state-color: var(--color-card-border);
  padding: 12px 14px;
  border: 1px solid var(--color-card-border);
  border-inline-start: 4px solid var(--request-state-color);
  border-radius: var(--radius-card-sm);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat__request--pending  { --request-state-color: var(--color-text-light); }
.chat__request--approved { --request-state-color: var(--color-success); }
.chat__request--declined { --request-state-color: var(--color-error); }

.chat__request-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat__request-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-text-light);
}

.chat__request-name {
  font-weight: 600;
  font-size: 14px;
}

.chat__request-meta {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* "Request no. K7M3PX": the code stands out, spaced so it reads out loud. */
.chat__request-code {
  font-size: 13px;
  color: var(--color-text-light);
}

.chat__request-code bdi {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.06em;
  color: var(--color-text);
}

.chat__request-status {
  margin-top: 2px;
  font-size: 13px;
  color: var(--color-text-light);
}

.chat__request-status--approved { color: var(--color-success); font-weight: 600; }
.chat__request-status--declined { color: var(--color-error); font-weight: 600; }

.chat__request-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}


/* ── Service request sheet ────────────────────────────────
   The request form, sliding up from the bottom of the widget over a dimmed
   chat. Inside .chat (position: relative; overflow: hidden), so in an embed
   iframe it stays within the widget. The body scrolls; head and foot stay. */
.chat__sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 200ms ease;
}

.chat__sheet-backdrop--open { opacity: 1; }

.chat__sheet {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 41;
  width: 100%;
  max-width: var(--chat-max-width);
  max-height: 90%;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-radius: var(--radius-card) var(--radius-card) 0 0;
  box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 200ms ease;
}

.chat__sheet--open { transform: translateY(0); }

.chat__sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.chat__sheet-thumb {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--color-surface-alt);  /* gray when there is no image */
}

.chat__sheet-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chat__sheet-heading {
  flex: 1;
  min-width: 0;
}

.chat__sheet-title {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}

.chat__sheet-sub {
  font-size: 13px;
  color: var(--color-text-light);
}

.chat__sheet-close {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.chat__sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 14px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Two fields per line when each half is at least 158px — a 360px screen, with
   the 16px side padding and the 12px gap — and one per line below that.
   Inputs align at the bottom, so a label that wraps does not move its input. */
.chat__sheet-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  align-items: end;
  gap: 12px;
}

.chat__sheet-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

/* Label at the start, an extra (the notes counter) at the end of the line. */
.chat__sheet-label-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.chat__sheet-label {
  font-size: 13px;
  font-weight: 600;
}

.chat__sheet-counter {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-text-light);
  font-variant-numeric: tabular-nums;
}

.chat__sheet-input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface-alt);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 16px;  /* 16px: iOS does not zoom into the field */
  outline: none;
  transition: border-color 200ms ease;
}

.chat__sheet-input:focus { border-color: var(--color-accent); }

.chat__sheet-input[aria-invalid="true"] { border-color: var(--color-error); }

.chat__sheet-textarea {
  min-height: 72px;
  resize: vertical;
  line-height: 1.5;
}

.chat__sheet-field-error {
  font-size: 12px;
  color: var(--color-error);
}

.chat__sheet-field-error:empty { display: none; }

.chat__sheet-foot {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat__sheet-error {
  font-size: 13px;
  color: var(--color-error);
}

.chat__sheet-error[hidden] { display: none; }

.chat__sheet-contact {
  margin-inline-start: 4px;
  padding: 2px 10px;
  border: 1px solid var(--color-error);
  border-radius: var(--radius-button);
  background: var(--color-surface);
  color: var(--color-error);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.chat__sheet-hint {
  font-size: 12px;
  color: var(--color-text-light);
}

.chat__sheet-send {
  width: 100%;
  min-height: 44px;
  border: none;
  border-radius: var(--radius-button);
  background: var(--color-accent);
  color: #fff;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.chat__sheet-send:hover:not(:disabled) { background: var(--color-accent-hover); }

.chat__sheet-send:disabled {
  opacity: 0.6;
  cursor: default;
}

.chat__sheet-send--busy { cursor: progress; }

.chat__sheet-privacy {
  font-size: 11px;
  color: var(--color-text-light);
  line-height: 1.4;
}

.chat__sheet-privacy a { color: inherit; }

/* ── Attraction RTL ───────────────────────────────────────── */

.chat[dir="rtl"] .chat__attraction-chevron {
  transform: scaleX(-1);
}

.chat[dir="rtl"] .chat__attraction-card--expanded .chat__attraction-chevron {
  transform: scaleX(-1) rotate(90deg);
}

/* ── Animations ────────────────────────────────────────────── */

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}


@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Reduced Motion ────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0ms !important;
    animation-delay: 0ms !important;
    transition-duration: 0ms !important;
  }
}

/* ── Focus Ring ────────────────────────────────────────────── */

*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

/* ── Welcome Image ─────────────────────────────────────────── */

/* Full-width property photo at the top of the conversation, with the property
   name over it. It lives inside .chat__messages so it scrolls away with the
   thread; the negative margins cancel that container's padding (16px top,
   15px gutter below 799px). */
.chat__welcome-image {
  align-self: stretch;
  /* .chat__messages is a flex column and overflow:hidden drops this item's
     min-height to 0 — without this the photo shrinks away as the thread grows. */
  flex-shrink: 0;
  width: calc(100% + 30px);
  max-width: none;
  margin: -16px -15px 6px;
  position: relative;
  overflow: hidden;
  border-radius: 0;
}

/* Darken the top (header legibility) and the bottom (name legibility). */
.chat__welcome-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.35) 0%,
    rgba(0, 0, 0, 0) 28%,
    rgba(0, 0, 0, 0) 45%,
    rgba(0, 0, 0, 0.72) 100%
  );
}

/* Rounded top edge of the page "sheet" overlapping the photo. */
.chat__welcome-image::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 24px;
  z-index: 2;
  background: var(--color-bg);
  border-radius: 24px 24px 0 0;
}

.chat__welcome-image img {
  display: block;
  width: 100%;
  height: clamp(180px, 40vh, 340px);
  /* svh stays stable while mobile browser bars show and hide. */
  height: clamp(180px, 40svh, 340px);
  object-fit: cover;
}

.chat__hero-text {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 40px;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #fff;
  text-align: start;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
}

.chat__hero-location {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  opacity: 0.9;
}

.chat__hero-name {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

/* From 799px the messages gutter grows past 15px: keep the photo inside the
   chat column (the source is only 800px wide) as a rounded card. */
@media (min-width: 799px) {
  .chat__welcome-image {
    width: 100%;
    margin: 0 0 16px;
    border-radius: var(--radius-card);
  }

  .chat__welcome-image::after {
    display: none;
  }

  .chat__hero-text {
    bottom: 20px;
  }
}

/* ── Welcome Title ─────────────────────────────────────────── */

.chat__welcome-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text);
  text-align: center;
  padding: 2px 0 0;
}

/* ── Welcome Message ───────────────────────────────────────── */

.chat__message--welcome {
  align-self: stretch;
  text-align: center;
}

/* ── Privacy Notice ───────────────────────────────────────── */

.chat__privacy-notice {
  font-size: 11px;
  color: var(--color-text-light);
  text-align: center;
  padding: 0px 0 2px;
}

/* ── Suggested Questions (chips under the welcome message) ─── */

.chat__suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin: 12px 0 8px;
}

/* Follow-up chips belong to the bot answer above them, which is left-aligned. */
.chat__suggestions--follow-up {
  justify-content: flex-start;
  margin-top: 4px;
}

/* Orange outline so the chips read as buttons on phones, which have no hover
   state. The text stays dark: orange text on white is too low-contrast at 14px.
   Follow-up chips share the look; their own class keeps the click handlers apart. */
.chat__suggestion,
.chat__follow-up {
  max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius-button);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.35;
  text-align: start;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

/* Touch screens keep :hover after a tap, which would leave the tapped chip
   highlighted — only real pointers get the hover state. */
@media (hover: hover) {
  .chat__suggestion:hover,
  .chat__follow-up:hover {
    background: var(--color-accent-tint);
  }
}

.chat__suggestion:focus-visible,
.chat__follow-up:focus-visible {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--color-accent);
}

.chat__suggestion:active,
.chat__follow-up:active {
  background: var(--color-accent-tint);
}

.chat__privacy-notice a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Art. 13 notice inside the contact card, where an email address or phone
   number is actually collected. Sits under the buttons: it must be readable
   before submitting without competing with the fields for attention. */
.chat__contact-privacy {
  font-size: 11px;
  line-height: 1.5;
  color: var(--color-text-light);
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border, rgba(0, 0, 0, 0.08));
}

.chat__contact-privacy a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Weather forecast credit ──
   One muted line under an answer that used the MET Norway forecast (CC BY 4.0
   asks for the source and a licence link where the data is shown). Interface
   direction (dir set by chat.js), never the answer's. */
.chat__forecast-credit {
  /* Close to the text it credits; room before the cards that follow. */
  margin: 6px 0 4px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-light);
  text-align: start;
}

/* Two classes: beats `.chat__message a` (accent colour), so the line stays muted. */
.chat__forecast-credit .chat__forecast-credit-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat__forecast-credit .chat__forecast-credit-link:hover {
  color: var(--color-text);
}

/* ── Diagnostic code ──
   "Code: TE-101" under a message that says the chat is unavailable or limited
   (services/unavailable_codes.py), so it can be read out to support. Interface
   direction (dir set by chat.js); the code itself stays left-to-right (<bdi>). */
.chat__diagnostic-code {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text-light);
  text-align: start;
}

.chat__notice .chat__diagnostic-code {
  margin-top: 4px;
}

/* A "+" phone number in an answer (keepPhonesLtr in chat.js): one left-to-right run
   that never breaks across lines, in every language. */
.chat__phone {
  white-space: nowrap;
}
