/* ===================================================================
   THE HERO LOOP
   A short film of the real dashboard, played by js/film.js. The stage is drawn
   at one fixed size and scaled to fit, the way a video would be, except the
   words stay sharp at any size. Below 900px it plays the phone layout instead,
   because a shrunken desktop would be unreadable.

   Colours, sizes and wording follow css/app.css and css/chat.css. If the real
   dashboard changes look, change it here too.
=================================================================== */
.film {
  --fm-ink: #0B0E14;
  --fm-dim: #566072;
  --fm-line: rgba(11, 14, 20, 0.11);
  --fm-tint: #F5F6F8;
  --fm-blue: #0A7CFF;
  --fm-solid: #0B6FFB;
  --fm-agent: #E9E9EB;
  --fm-green: #1FA971;
  --fm-out: cubic-bezier(0.22, 1, 0.36, 1);
  position: relative;
  width: 100%;
  aspect-ratio: 1200 / 720;
  background:
    radial-gradient(58% 62% at 84% 108%, rgba(255, 222, 186, 0.95) 0%, rgba(255, 222, 186, 0) 72%),
    radial-gradient(70% 70% at 6% -6%, #0E3BBE 0%, rgba(14, 59, 190, 0) 72%),
    linear-gradient(158deg, #1548D0 0%, #2C70F0 46%, #86B7FF 80%, #C9DDFF 100%);
}
.film__stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1200px;
  height: 720px;
  transform-origin: 0 0;
  color: var(--fm-ink);
  font-size: 14px;
  line-height: 1.35;
  text-align: left;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}
.film p { margin: 0; }
.film.is-live .fm-hide { display: none; }
.fm-temp { display: none !important; }
.fm-temp.is-on { display: flex !important; }

/* ---------- the window ---------- */
.fm-win {
  position: absolute;
  inset: 34px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 34px 70px -22px rgba(5, 22, 84, 0.62);
}
.fm-bar {
  position: relative;
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  background: #F6F7F9;
  border-bottom: 1px solid var(--fm-line);
}
.fm-bar i { width: 9px; height: 9px; border-radius: 50%; background: #D5D9E1; }
.fm-bar span {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  height: 20px;
  padding: 0 56px;
  border-radius: 7px;
  background: #FFFFFF;
  border: 1px solid var(--fm-line);
  font-size: 11.5px;
  line-height: 18px;
  color: var(--fm-dim);
}
.fm-app {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr) 384px;
}
.fm-dim {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgba(7, 16, 48, 0.2);
  opacity: 0;
  transition: opacity 0.45s;
}
.fm-dim.is-on { opacity: 1; }

/* ---------- the menu ---------- */
.fm-side {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 8px 10px 12px;
  border-right: 1px solid var(--fm-line);
}
.fm-toggle { align-self: flex-end; display: grid; place-items: center; width: 30px; height: 30px; color: var(--fm-dim); }
.fm-toggle svg { width: 17px; height: 17px; }
.fm-brand { display: flex; align-items: center; gap: 9px; padding: 2px 6px 16px; }
.fm-brand img { width: 28px; height: 28px; flex: none; filter: drop-shadow(0 0 7px rgba(10, 124, 255, 0.35)); }
.fm-brand__words { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fm-brand .brand-word { display: block; height: 10.5px; width: auto; max-width: 92px; }
.fm-brand small { font-size: 11px; color: var(--fm-dim); white-space: nowrap; }
.fm-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.fm-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13px;
  color: var(--fm-dim);
  white-space: nowrap;
}
.fm-item svg { width: 17px; height: 17px; flex: none; }
.fm-item--desk {
  color: var(--fm-ink);
  font-weight: 500;
  background: linear-gradient(90deg, rgba(10, 124, 255, 0.2), rgba(10, 124, 255, 0.02));
}
.fm-item--desk svg { color: var(--fm-blue); filter: drop-shadow(0 0 6px rgba(0, 180, 255, 0.5)); }
.fm-item--desk::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--fm-blue);
  box-shadow: 0 0 10px rgba(10, 124, 255, 0.6);
}
.fm-side__foot { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--fm-line); }

/* ---------- home ---------- */
.fm-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; padding: 16px 20px 16px; }
.fm-top { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.fm-title { display: block; font-size: 23px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--fm-ink); }
.fm-top small { display: block; margin-top: 2px; font-size: 12.5px; color: var(--fm-dim); }
.fm-top__right { display: flex; gap: 7px; }
.fm-round { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--fm-line); color: var(--fm-ink); }
.fm-round svg { width: 16px; height: 16px; }
.fm-round--me { border: 0; background: #B79A3C; color: #FFFFFF; font-size: 11px; font-weight: 600; }

.fm-cards { flex: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 13px; }
.fm-card {
  min-height: 98px;
  padding: 11px 12px;
  border: 1px solid var(--fm-line);
  border-radius: 14px;
  transition: border-color 0.3s, background-color 0.3s;
}
.fm-card p { font-size: 12px; color: var(--fm-dim); }
.fm-card strong { display: block; margin: 2px 0 1px; font-size: 25px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.fm-card small { display: block; font-size: 11.5px; line-height: 1.3; color: var(--fm-dim); }
.fm-card.is-on { border-color: #A7CBFF; background-color: #F1F7FF; }
[data-num] { display: inline-block; transform-origin: 0 60%; font-variant-numeric: tabular-nums; transition: opacity 0.3s; }

.fm-res-head { flex: none; display: flex; align-items: center; justify-content: space-between; margin-top: 15px; }
.fm-res-head b { display: block; font-size: 14.5px; font-weight: 600; }
.fm-res-head small { display: block; font-size: 11.5px; color: var(--fm-dim); }
.fm-range { display: flex; gap: 2px; font-size: 11.5px; color: var(--fm-dim); }
.fm-range span { padding: 3px 8px; border-radius: 7px; }
.fm-range .is-on { background: var(--fm-tint); color: var(--fm-ink); }
.fm-stats { flex: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 8px; }
.fm-stat { position: relative; padding: 11px 13px; border: 1px solid var(--fm-line); border-radius: 14px; }
.fm-stat p { font-size: 12px; font-weight: 500; }
.fm-stat strong { display: block; margin-top: 2px; font-size: 25px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.fm-viz { position: absolute; right: 13px; bottom: 13px; display: flex; align-items: flex-end; gap: 3px; height: 36px; }
.fm-viz i { display: block; width: 7px; height: calc(var(--h) * 100%); border-radius: 2.5px 2.5px 1px 1px; background: rgba(10, 124, 255, 0.26); transition: height 0.5s var(--fm-out), background-color 0.3s; }
.fm-viz i:last-child { background: var(--fm-blue); }
.fm-viz--ok i { background: rgba(31, 169, 113, 0.28); }
.fm-viz--ok i:last-child { background: var(--fm-green); }

.fm-recent { flex: 1; min-height: 0; display: flex; flex-direction: column; margin-top: 9px; padding: 11px 13px 4px; border: 1px solid var(--fm-line); border-radius: 14px; overflow: hidden; }
.fm-recent > b { flex: none; font-size: 13.5px; font-weight: 600; }
.fm-rows { flex: 1; min-height: 0; margin-top: 4px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 calc(100% - 22px), transparent); mask-image: linear-gradient(#000 calc(100% - 22px), transparent); }
.fm-rows__in { display: flex; flex-direction: column; }
.fm-row { flex: none; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; column-gap: 9px; padding: 6px 0; }
.fm-row + .fm-row { border-top: 1px solid rgba(11, 14, 20, 0.07); }
.fm-row__who { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--fm-tint); color: var(--fm-dim); font-size: 11px; font-weight: 600; }
.fm-row b { display: block; font-size: 13px; font-weight: 500; line-height: 1.3; }
.fm-row small { display: block; font-size: 11.5px; line-height: 1.3; color: var(--fm-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fm-row time { font-size: 11px; color: var(--fm-dim); }
.fm-row--new .fm-row__who { background: #DDF5EA; color: #127A50; }
.fm-row--new small { color: #127A50; }

/* ---------- the chat ---------- */
.fm-chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-left: 1px solid var(--fm-line); background: #FFFFFF; }
.fm-chat__head { flex: none; display: flex; align-items: center; gap: 9px; height: 54px; padding: 0 10px 0 13px; border-bottom: 1px solid var(--fm-line); }
.fm-chat__head img { width: 30px; height: 30px; flex: none; }
.fm-who { flex: 1; min-width: 0; line-height: 1.25; }
.fm-who b { display: block; font-size: 14px; font-weight: 600; }
.fm-who small { display: block; font-size: 11.5px; color: var(--fm-dim); }
.fm-iconbtn { display: grid; place-items: center; width: 30px; height: 30px; color: var(--fm-dim); }
.fm-iconbtn svg { width: 17px; height: 17px; }
.fm-thread { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; padding: 8px 15px 8px; }
.fm-flow { flex: none; display: flex; flex-direction: column; transition: opacity 0.3s; }
.fm-time { align-self: center; margin: 14px 0 4px !important; font-size: 11.5px; color: #6B7280; }
.fm-bub {
  position: relative;
  flex: none;
  max-width: 84%;
  margin-top: 3px;
  padding: 7px 13px;
  border-radius: 19px;
  font-size: 14.5px;
  line-height: 1.34;
}
.fm-bub--it { align-self: flex-start; background: var(--fm-agent); color: #000000; transform-origin: 0 100%; }
.fm-bub--me { align-self: flex-end; background: var(--fm-solid); color: #FFFFFF; transform-origin: 100% 100%; }
.fm-first { margin-top: 10px; }
.fm-last::before,
.fm-last::after { content: ''; position: absolute; bottom: 0; height: 19px; }
.fm-bub--me.fm-last::before { right: -7px; width: 19px; background: inherit; border-bottom-left-radius: 15px; }
.fm-bub--me.fm-last::after { right: -10px; width: 10px; background: #FFFFFF; border-bottom-left-radius: 10px; }
.fm-bub--it.fm-last::before { left: -7px; width: 19px; background: inherit; border-bottom-right-radius: 15px; }
.fm-bub--it.fm-last::after { left: -10px; width: 10px; background: #FFFFFF; border-bottom-right-radius: 10px; }
.fm-choice { align-self: flex-start; gap: 7px; margin-top: 7px; transform-origin: 0 100%; }
.fm-choice span { padding: 6px 19px; border: 1px solid rgba(0, 0, 0, 0.14); border-radius: 999px; font-size: 14px; transition: transform 0.12s, background-color 0.12s; }
.fm-choice .fm-yes { background: var(--fm-solid); border-color: var(--fm-solid); color: #FFFFFF; }
.fm-choice .fm-yes.is-press { background: #0756C7; border-color: #0756C7; transform: scale(0.95); }
.fm-typing { align-self: flex-start; gap: 4px; margin-top: 10px; padding: 12px 13px; border-radius: 19px; background: var(--fm-agent); transform-origin: 0 100%; }
.fm-typing i { width: 7px; height: 7px; border-radius: 50%; background: #6B7280; animation: fm-dot 1.2s infinite; }
.fm-typing i:nth-child(2) { animation-delay: 0.15s; }
.fm-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes fm-dot { 0%, 60%, 100% { opacity: 0.35; } 30% { opacity: 1; } }

.fm-composer { flex: none; display: flex; align-items: flex-end; gap: 7px; padding: 6px 11px 11px; }
.fm-plus { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.14); }
.fm-plus svg { width: 16px; height: 16px; }
.fm-pill {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 34px;
  padding: 0 3px 0 13px;
  border: 1px solid rgba(0, 0, 0, 0.14);
  border-radius: 19px;
  font-size: 14.5px;
  transition: border-color 0.2s;
}
.fm-pill.is-focus { border-color: var(--fm-solid); }
.fm-field { position: relative; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; }
.fm-field__hold { color: #8A8F99; }
.fm-pill.is-focus .fm-field__hold { display: none; }
.fm-caret { display: none; width: 1.5px; height: 16px; margin-left: 1px; vertical-align: -3px; background: var(--fm-solid); animation: fm-caret 1s steps(1) infinite; }
.fm-pill.is-focus .fm-caret { display: inline-block; }
@keyframes fm-caret { 50% { opacity: 0; } }
.fm-send { flex: none; display: grid; place-items: center; width: 27px; height: 27px; border-radius: 50%; background: var(--fm-solid); color: #FFFFFF; opacity: 0; transform: scale(0.6); transition: opacity 0.15s, transform 0.2s var(--fm-out); }
.fm-send svg { width: 14px; height: 14px; }
.fm-pill.has-text .fm-send { opacity: 1; transform: none; }
.fm-send.is-press { transform: scale(0.86) !important; }

/* ---------- the live call ---------- */
.fm-call {
  position: absolute;
  z-index: 6;
  top: 16px;
  left: 50%;
  width: 322px;
  padding: 9px 13px 9px 9px;
  border-radius: 26px;
  color: #FFFFFF;
  background: rgba(11, 18, 42, 0.88);
  -webkit-backdrop-filter: blur(22px) saturate(170%);
  backdrop-filter: blur(22px) saturate(170%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 26px 60px -16px rgba(4, 12, 48, 0.72);
  opacity: 0;
  transform: translate(-50%, -135%);
  transition: transform 0.6s var(--fm-out), opacity 0.25s, width 0.55s var(--fm-out);
}
.fm-call.is-in { opacity: 1; transform: translate(-50%, 0); }
.fm-call.is-open { width: 516px; }
.fm-call__top { display: flex; align-items: center; gap: 10px; }
.fm-call__icon { position: relative; flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--fm-green); transition: background-color 0.25s; }
.fm-call__icon > * { grid-area: 1 / 1; transition: opacity 0.2s, transform 0.3s var(--fm-out); }
.fm-call__icon svg { width: 17px; height: 17px; }
.fm-call__icon img { width: 34px; height: 34px; opacity: 0; transform: scale(0.7); }
.fm-ic-check { opacity: 0; transform: scale(0.7); }
.fm-call.is-ring .fm-call__icon { animation: fm-ring 1.1s infinite; }
@keyframes fm-ring {
  0% { box-shadow: 0 0 0 0 rgba(31, 169, 113, 0.6); }
  100% { box-shadow: 0 0 0 13px rgba(31, 169, 113, 0); }
}
.fm-call.is-talk .fm-call__icon { background: transparent; }
.fm-call.is-talk .fm-ic-phone { opacity: 0; transform: scale(0.7); }
.fm-call.is-talk .fm-call__icon img { opacity: 1; transform: none; }
.fm-call.is-done .fm-call__icon { background: var(--fm-green); }
.fm-call.is-done .fm-ic-phone,
.fm-call.is-done .fm-call__icon img { opacity: 0; transform: scale(0.7); }
.fm-call.is-done .fm-ic-check { opacity: 1; transform: none; }
.fm-call__words { flex: 1; min-width: 0; line-height: 1.25; }
.fm-call__words b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; }
.fm-call__words small { display: block; font-size: 12px; color: rgba(255, 255, 255, 0.66); white-space: nowrap; }
.fm-wave { flex: none; display: none; align-items: center; gap: 3px; height: 20px; }
.fm-call.is-talk .fm-wave { display: flex; }
.fm-wave i { width: 3px; height: 100%; border-radius: 2px; background: #6CC0FF; transform: scaleY(0.25); animation: fm-wave 0.9s ease-in-out infinite; }
.fm-wave i:nth-child(2) { animation-delay: 0.12s; }
.fm-wave i:nth-child(3) { animation-delay: 0.26s; }
.fm-wave i:nth-child(4) { animation-delay: 0.08s; }
.fm-wave i:nth-child(5) { animation-delay: 0.2s; }
@keyframes fm-wave { 0%, 100% { transform: scaleY(0.22); } 50% { transform: scaleY(1); } }
.fm-call__time { flex: none; display: none; min-width: 30px; text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, 0.76); }
.fm-call.is-talk .fm-call__time { display: block; }
.fm-call__log { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.55s var(--fm-out); }
.fm-call.is-open .fm-call__log { grid-template-rows: 1fr; }
.fm-call__clip { min-height: 0; overflow: hidden; }
.fm-call__lines { width: 490px; padding: 3px 0 8px 5px; }
.fm-line { display: grid; grid-template-columns: 62px minmax(0, 1fr); column-gap: 8px; margin-top: 10px !important; font-size: 14px; line-height: 1.38; opacity: 0; transition: opacity 0.2s; }
.fm-line.is-on { opacity: 1; }
.fm-line.is-past { opacity: 0.6; }
.fm-line b { font-size: 12.5px; line-height: 19px; font-weight: 500; color: rgba(255, 255, 255, 0.6); }
.fm-line--it b { color: #7CC4FF; }
.fm-line i { font-style: normal; opacity: 0; transition: opacity 0.16s; }
.fm-line.is-on i { opacity: 1; transition-delay: calc(var(--w) * 42ms); }

/* ---------- the pointer ---------- */
.fm-cursor { position: absolute; left: 0; top: 0; z-index: 7; width: 21px; height: 25px; transform: translate(470px, 610px); transition: transform 0.8s cubic-bezier(0.3, 0.75, 0.2, 1), opacity 0.2s; }
.fm-cursor svg { display: block; width: 100%; height: 100%; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.3)); transition: transform 0.12s; transform-origin: 20% 12%; }
.fm-cursor.is-press svg { transform: scale(0.84); }
.fm-tap { display: none; }
.film:not(.is-live) .fm-cursor { display: none; }

/* Words and numbers go soft for a moment when the loop starts over. */
.film__stage.is-fading .fm-flow,
.film__stage.is-fading .fm-rows__in,
.film__stage.is-fading [data-num] { opacity: 0; }
.film.is-paused .film__stage * { animation-play-state: paused !important; }

.film-toggle { padding: 4px 6px; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.film-toggle:hover { color: var(--ink); }
.film-toggle[hidden] { display: none; }

/* ---------- on a phone, the phone layout ---------- */
@media (max-width: 899px) {
  .film { aspect-ratio: 390 / 660; background-position: center; }
  .film__stage { width: 390px; height: 660px; font-size: 15px; }
  .fm-win { inset: 0; border-radius: 0; box-shadow: none; }
  .film.is-framed .fm-win { border-radius: 30px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28), 0 34px 70px -22px rgba(5, 22, 84, 0.62); }
  .fm-bar, .fm-main, .fm-toggle, .fm-brand, .fm-side__foot { display: none; }
  .fm-app { grid-template-columns: minmax(0, 1fr); }
  .fm-chat { border-left: 0; padding-bottom: 76px; }
  .fm-side {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 10px;
    z-index: 3;
    display: block;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 32px;
    background: rgba(248, 248, 250, 0.82);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.65);
  }
  .fm-nav { flex-direction: row; gap: 0; }
  .fm-item {
    flex: 1 1 0;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    height: 54px;
    min-width: 0;
    padding: 0;
    border-radius: 27px;
    background: none;
    color: rgba(11, 14, 20, 0.84);
    font-weight: 400;
  }
  .fm-item svg { width: 24px; height: 24px; color: inherit; filter: none; }
  .fm-item span { font-size: 10.5px; font-weight: 500; line-height: 1.15; letter-spacing: -0.01em; }
  .fm-item span[data-short] { font-size: 0; }
  .fm-item span[data-short]::after { content: attr(data-short); font-size: 10.5px; }
  .fm-item::before { display: none; }
  .fm-item--phone { background: rgba(11, 14, 20, 0.07); color: #0A5FCC; }
  .fm-item--phone svg > :first-child { fill: currentColor; fill-opacity: 0.2; }

  .fm-chat__head { height: 58px; }
  .fm-chat__head img { width: 32px; height: 32px; }
  .fm-who b { font-size: 15px; }
  .fm-who small { font-size: 12.5px; }
  .fm-thread { padding: 8px 16px; }
  .fm-bub { max-width: 86%; font-size: 16px; line-height: 1.32; padding: 7px 14px; border-radius: 20px; }
  .fm-choice span { font-size: 15px; }
  .fm-pill { font-size: 16px; }

  .fm-call { top: 10px; width: 300px; }
  .fm-call.is-open { width: 368px; }
  .fm-call__lines { width: 346px; }
  .fm-line { grid-template-columns: 58px minmax(0, 1fr); font-size: 14.5px; }

  .fm-cursor { display: none; }
  .fm-tap {
    display: block;
    position: absolute;
    left: 0;
    top: 0;
    z-index: 7;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(11, 14, 20, 0.2);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
    opacity: 0;
  }
}
