/* Hero dialogue, "Cinema" style. Everything you may want to tweak is a variable in the first block;
   the blocks at the end adjust it per layout (data-layout on an ancestor: desktop / tablet / mobile).
   Sizes use --u = 1/1920 of the video width, so the layout scales with the video. */
.hero-messages {
  /* where the two columns sit */
  /* Text lives in a thin band at the very top: the tallest visitor's head starts at y≈92 of 1080. */
  --hm-top: 22;            /* distance from the top edge */
  --hm-side: 60;           /* distance from the left / right edge */
  --hm-width: 760;         /* max width of a column: wide enough to keep each message on one line */
  --hm-gap: 12;            /* space between lines in a column */
  --hm-label-gap: 6;       /* space between the speaker label and the message */

  /* type */
  --hm-font-text: Georgia, "Times New Roman", serif;
  --hm-font-ui: FiraGO, Arial, sans-serif;
  --hm-text-size: 32;
  --hm-text-style: italic;
  --hm-label-size: 15;
  --hm-status-size: 17;

  /* colors */
  --hm-text: #f5f5f7;
  --hm-label: #b6bac4;
  --hm-dot-client: #bd9767;    /* warm: people */
  --hm-dot-business: #83aaff;  /* blue: administrator / Zamia AI */
  --hm-won: #54d9a3;
  --hm-lost: #e0907a;
  --hm-muted: #90959f;
  --hm-ai: #83aaff;

  /* motion */
  --hm-in: .3s;
  --hm-out: .4s;

  --u: calc(100cqw / 1920);
  position: absolute; inset: 0; pointer-events: none; container-type: inline-size;
}

/* hidden lines stay in the column, so spacing lives on visible lines only (not flex gap) */
.hero-messages .hm-col { position: absolute; top: calc(var(--u) * (var(--hm-top) - var(--hm-gap))); max-width: calc(var(--u) * var(--hm-width));
  display: flex; flex-direction: column; }
.hero-messages .hm-L { left: calc(var(--u) * var(--hm-side)); }
.hero-messages .hm-R { right: calc(var(--u) * var(--hm-side)); align-items: flex-end; text-align: right; }

/* Text never moves: a line only fades in and out where it stands. Its space appears and disappears instantly
   (no height animation), and the slots are fixed, so neighbours do not slide. */
.hero-messages .hm-line { opacity: 0; max-height: 0; overflow: hidden; transition: opacity var(--hm-in) ease; }
.hero-messages .hm-line.is-on { opacity: 1; max-height: calc(var(--u) * 400); padding-top: calc(var(--u) * var(--hm-gap)); }
.hero-messages .hm-line.is-leaving { opacity: 0; transition: opacity var(--hm-out) ease; }
.hero-messages .hm-line.hm-instant.is-on { transition: none; }
.hero-messages .hm-line.is-held { max-height: calc(var(--u) * 400); padding-top: calc(var(--u) * var(--hm-gap)); opacity: 0; transition: none; }

/* status lines share one spot per side and crossfade (e.g. "AI on" -> "online 24/7") */
.hero-messages .hm-stat { position: relative; min-height: calc(var(--u) * (var(--hm-status-size) * 1.3 + var(--hm-gap))); }
.hero-messages .hm-stat .hm-line { position: absolute; top: 0; white-space: nowrap; max-height: none; }
.hero-messages .hm-L .hm-stat .hm-line { left: 0; }
.hero-messages .hm-stat:empty { min-height: 0; }   /* clients have no status lines */
.hero-messages .hm-R .hm-stat .hm-line { right: 0; }

.hero-messages .hm-label { display: flex; align-items: center; gap: calc(var(--u) * 10); margin-bottom: calc(var(--u) * var(--hm-label-gap));
  font: 400 calc(var(--u) * var(--hm-label-size)) var(--hm-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--hm-label); }
.hero-messages .hm-R .hm-label { justify-content: flex-end; }
.hero-messages .hm-label::before { content: ""; width: calc(var(--u) * 7); height: calc(var(--u) * 7); border-radius: 50%; background: var(--hm-dot-client); }
.hero-messages .hm-R .hm-label::before { background: var(--hm-dot-business); }

.hero-messages .hm-text { font: var(--hm-text-style) calc(var(--u) * var(--hm-text-size)) / 1.25 var(--hm-font-text);
  color: var(--hm-text); text-shadow: 0 2px 12px rgba(0,0,0,.8); }

.hero-messages .hm-status { font: 600 calc(var(--u) * var(--hm-status-size)) var(--hm-font-ui); letter-spacing: .06em;
  text-transform: uppercase; color: var(--hm-muted); }
.hero-messages .hm-status[data-tone="won"] { color: var(--hm-won); }
.hero-messages .hm-status[data-tone="won"]::before { content: "✓ "; }
.hero-messages .hm-status[data-tone="lost"] { color: var(--hm-lost); }
.hero-messages .hm-status[data-tone="lost"]::before { content: "× "; }
.hero-messages .hm-status[data-tone="ai"] { color: var(--hm-ai); }
.hero-messages .hm-status[data-tone="ai"]::before, .hero-messages .hm-status[data-tone="muted"]::before { content: "● "; }

.hero-messages .hm-dots { display: inline-flex; gap: calc(var(--u) * 8); padding: calc(var(--u) * 10) 0; color: var(--hm-label); }
.hero-messages .hm-dots i { width: calc(var(--u) * 9); height: calc(var(--u) * 9); border-radius: 50%; background: currentColor; animation: hm-dot 1s infinite; }
.hero-messages .hm-dots i:nth-child(2) { animation-delay: .15s; }
.hero-messages .hm-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes hm-dot { 0%, 100% { opacity: .25; } 40% { opacity: .9; } }

/* Tablet: 4:3 crop, 1440 source pixels wide. Same top band, narrower columns. */
[data-layout="tablet"] .hero-messages { --u: calc(100cqw / 1440); --hm-width: 640; }

/* Mobile: the text sits in the dark zone above the video (not over it), as a chat that grows upward.
   Units are 1/1080 of the screen width. */
[data-layout="mobile"] .hero-messages {
  --u: calc(100cqw / 1080);
  --hm-text-size: 40; --hm-label-size: 22; --hm-status-size: 22;
  --hm-side: 64; --hm-gap: 16; --hm-label-gap: 8;
  /* fixed places, measured from the bottom of the zone (just above the video), so nothing jumps:
     business replies + status at the bottom, client messages above them */
  --hm-floor: 24;                       /* gap above the video */
  --hm-reply-box: 170;                  /* label + up to two lines of reply (needs ~146) */
  --hm-client-box: 200;                 /* up to two short client messages (needs ~192) */
  position: relative; inset: auto; flex: 1; display: block;
}
[data-layout="mobile"] .hero-messages .hm-col { position: absolute; left: calc(var(--u) * var(--hm-side)); right: calc(var(--u) * var(--hm-side));
  top: auto; max-width: none; }
[data-layout="mobile"] .hero-messages .hm-R { bottom: calc(var(--u) * var(--hm-floor)); }
[data-layout="mobile"] .hero-messages .hm-R .hm-msgs { height: calc(var(--u) * var(--hm-reply-box)); }
[data-layout="mobile"] .hero-messages .hm-L { bottom: calc(var(--u) * (var(--hm-floor) + var(--hm-reply-box) + var(--hm-status-size) * 1.3 + var(--hm-gap) + 10)); }
[data-layout="mobile"] .hero-messages .hm-L .hm-msgs { height: calc(var(--u) * var(--hm-client-box)); }

@media (prefers-reduced-motion: reduce) {
  .hero-messages .hm-line { transition: opacity .2s linear; transform: none; }
  .hero-messages .hm-dots i { animation: none; opacity: .6; }
}
