/* iPhone running WhatsApp, iOS dark mode. Everything is in em so one variable scales it:
   --phone-fs (16px in the hero, 14px in the demo, 13px on small screens). */

.phone {
  --fs: var(--phone-fs, 16px);
  position: relative;
  font-size: var(--fs);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  width: 20.5em;
  height: 44.4em;
  padding: 0.55em;
  border-radius: 3.6em;
  background: linear-gradient(160deg, #3b3835 0%, #161513 35%, #262320 70%, #3a3733 100%);
  box-shadow:
    0 0 0 1px #4a4640 inset,
    0 0 0 0.12em #0a0908 inset,
    0 40px 90px -36px rgba(0, 0, 0, 0.9),
    0 0 140px -30px rgb(255 255 255 / 0.18);
  user-select: none;
  flex: none;
}

.phone::before,
.phone::after {
  content: "";
  position: absolute;
  width: 0.22em;
  border-radius: 0.1em;
  background: #2a2724;
  box-shadow: 0 0 0 1px #4a4640;
}

.phone::before {
  left: -0.26em;
  top: 9.5em;
  height: 4.2em;
}

.phone::after {
  right: -0.26em;
  top: 11.5em;
  height: 6.2em;
}

.phone-screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 3.1em;
  background: var(--wa-bg);
  color: var(--wa-text);
  overflow: hidden;
}

/* Status bar */

.wa-status {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.3em;
  padding: 0.9em 1.9em 0;
  background: var(--wa-bar);
  font-size: 1em;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wa-time {
  font-size: 0.95em;
  min-width: 3.2em;
}

.wa-island {
  position: absolute;
  left: 50%;
  top: 0.68em;
  width: 7.4em;
  height: 2.1em;
  border-radius: 1.2em;
  background: #000;
  transform: translateX(-50%);
}

.wa-icons {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.wa-icons svg {
  height: 0.75em;
  width: auto;
}

/* Header */

.wa-head {
  display: flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.5em 0.75em 0.6em 0.55em;
  background: var(--wa-bar);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.wa-back {
  width: 1.35em;
  height: 1.35em;
  color: #fff;
  flex: none;
}

.wa-avatar {
  position: relative;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  flex: none;
  background: radial-gradient(120% 120% at 30% 20%, #1c6f6a 0%, #0f3f3d 60%, #0a2b2a 100%);
  display: grid;
  place-items: center;
}

.wa-avatar-mark {
  width: 1.05em;
  height: 1.05em;
  background: #e9edef;
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}

.wa-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  line-height: 1.2;
}

.wa-name {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-size: 0.9em;
  font-weight: 600;
  min-width: 0;
}

.wa-name-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wa-name svg {
  width: 0.95em;
  height: 0.95em;
  flex: none;
}

.wa-sub {
  font-size: 0.72em;
  color: var(--wa-muted);
  transition: color 0.2s;
}

.wa-sub.is-typing {
  color: var(--wa-green);
}

.wa-head-icons {
  display: inline-flex;
  gap: 0.6em;
  color: #fff;
  flex: none;
}

.wa-head-icons svg {
  width: 1.1em;
  height: 1.1em;
}

/* Conversation */

.wa-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.025), transparent 60%),
    var(--wa-bg);
}

.wa-list {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  padding: 0.8em 0.75em 0.6em;
  will-change: transform;
}

.wa-sys {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5em;
  margin-bottom: 0.4em;
}

.wa-chip {
  padding: 0.3em 0.7em;
  border-radius: 0.5em;
  background: var(--wa-chip);
  color: var(--wa-muted);
  font-size: 0.7em;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.wa-notice {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.35em;
  max-width: 88%;
  padding: 0.45em 0.7em;
  border-radius: 0.6em;
  background: var(--wa-chip);
  color: #ffd279;
  font-size: 0.68em;
  line-height: 1.35;
  text-align: center;
}

.wa-notice svg {
  width: 1em;
  height: 1em;
  flex: none;
  margin-top: 0.1em;
}

.wa-msg {
  display: flex;
  flex-direction: column;
  max-width: 82%;
  animation: wa-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.wa-msg--in {
  align-self: flex-start;
  align-items: flex-start;
  transform-origin: bottom left;
}

.wa-msg--out {
  align-self: flex-end;
  align-items: flex-end;
  transform-origin: bottom right;
}

.wa-msg--cont {
  margin-top: -0.15em;
}

.wa-bubble {
  position: relative;
  display: block;
  padding: 0.42em 0.6em 0.3em;
  border-radius: 0.65em;
  background: var(--wa-in);
  font-size: 0.875em;
  line-height: 1.36;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.3);
}

.wa-msg--in .wa-bubble {
  border-top-left-radius: 0.2em;
}

.wa-msg--out .wa-bubble {
  background: var(--wa-out);
  border-top-right-radius: 0.2em;
}

.wa-msg--cont.wa-msg--in .wa-bubble {
  border-top-left-radius: 0.65em;
}

.wa-msg--cont.wa-msg--out .wa-bubble {
  border-top-right-radius: 0.65em;
}

.wa-text {
  display: inline;
  word-wrap: break-word;
}

.wa-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  float: right;
  margin: 0.55em -0.15em -0.1em 0.6em;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72em;
  line-height: 1;
}

.wa-ticks {
  display: inline-flex;
  width: 1.1em;
  color: rgba(255, 255, 255, 0.55);
  transition: color 0.3s;
}

.wa-ticks svg {
  width: 100%;
  height: auto;
}

.wa-msg.is-read .wa-ticks {
  color: var(--wa-tick);
}

/* Typing indicator */

.wa-msg--typing .wa-bubble {
  display: inline-flex;
  gap: 0.28em;
  padding: 0.7em 0.75em;
}

.wa-msg--typing i {
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: #8696a0;
  animation: wa-dot 1.1s infinite ease-in-out;
}

.wa-msg--typing i:nth-child(2) {
  animation-delay: 0.15s;
}

.wa-msg--typing i:nth-child(3) {
  animation-delay: 0.3s;
}

/* Quick-reply buttons rendered under a bot message */

.wa-btns {
  display: flex;
  flex-direction: column;
  gap: 0.2em;
  width: 100%;
  margin-top: 0.2em;
}

.wa-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
  padding: 0.55em 0.6em;
  border-radius: 0.65em;
  background: var(--wa-in);
  color: var(--wa-link);
  font-size: 0.85em;
  font-weight: 500;
  box-shadow: 0 1px 0.5px rgba(0, 0, 0, 0.3);
  transition: background-color 0.18s, color 0.3s, opacity 0.3s;
}

.wa-btn svg {
  width: 1em;
  height: 1em;
  opacity: 0.8;
}

.wa-btn.is-pressed {
  background: #2a3942;
}

.wa-btns.is-used .wa-btn {
  color: rgba(83, 189, 235, 0.45);
}

.wa-btns.is-used .wa-btn.is-pressed {
  color: var(--wa-link);
}

/* Annotation: which tool the assistant used (not part of WhatsApp, part of the demo) */

.wa-note {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  margin: 0.45em 0 0.15em 0.1em;
  padding: 0.2em 0.5em 0.2em 0.35em;
  border-radius: 0.3em;
  font-family: var(--font-mono);
  font-size: 0.58em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0;
  transform: translateY(0.3em);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out), background-color 0.6s;
}

.wa-note i {
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 rgb(255 255 255 / 0.5);
}

.wa-note.is-on {
  opacity: 0.85;
  transform: none;
  animation: wa-note-flash 1.2s ease-out;
}

.wa-note.is-on i {
  animation: wa-note-ring 1.2s ease-out;
}

/* Time jump divider */

.wa-jump {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  margin: 0.5em 0 0.35em;
  animation: wa-in 0.34s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.wa-jump::before,
.wa-jump::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.wa-jump-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3em 0.75em;
  border-radius: 0.5em;
  background: var(--wa-chip);
  color: var(--wa-muted);
  font-size: 0.72em;
  font-weight: 500;
}

.wa-jump-chip svg {
  width: 1.2em;
  height: 1.2em;
  color: var(--accent);
}

.wa-jump-chip .wa-clock-hand {
  transform-origin: 12px 12px;
  animation: wa-clock 1.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Input bar */

.wa-input {
  display: flex;
  align-items: center;
  gap: 0.55em;
  padding: 0.45em 0.7em 0.35em;
  background: var(--wa-bar);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.wa-plus,
.wa-cam,
.wa-mic,
.wa-send {
  display: inline-flex;
  width: 1.5em;
  height: 1.5em;
  color: #aebac1;
  flex: none;
}

.wa-plus {
  color: #d1d7db;
}

.wa-field {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  min-height: 2.15em;
  padding: 0.35em 2.2em 0.35em 0.8em;
  border-radius: 1.1em;
  background: var(--wa-in);
  font-size: 0.92em;
  line-height: 1.3;
  color: var(--wa-text);
}

.wa-typed-clip {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.wa-typed {
  display: inline-block;
  white-space: nowrap;
}

.wa-typed:not(:empty)::after {
  content: "";
  display: inline-block;
  width: 1.5px;
  height: 1.05em;
  margin-left: 1px;
  vertical-align: -0.15em;
  background: var(--wa-green);
  animation: wa-caret 1s steps(2) infinite;
}

.wa-placeholder {
  color: var(--wa-muted);
}

.is-composing .wa-placeholder {
  display: none;
}

.wa-sticker {
  position: absolute;
  right: 0.65em;
  top: 50%;
  width: 1.25em;
  height: 1.25em;
  transform: translateY(-50%);
  color: #aebac1;
}

.wa-right {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
}

.wa-send {
  display: none;
  width: 2.15em;
  height: 2.15em;
  border-radius: 50%;
  background: var(--wa-green);
  color: #0b141a;
  padding: 0.5em 0.42em 0.5em 0.55em;
}

.is-composing .wa-cam,
.is-composing .wa-mic {
  display: none;
}

.is-composing .wa-send {
  display: inline-flex;
}

.wa-home {
  position: relative;
  height: 1.5em;
  background: var(--wa-bar);
}

.wa-home::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0.5em;
  width: 7.6em;
  height: 0.3em;
  border-radius: 0.3em;
  background: rgba(255, 255, 255, 0.38);
  transform: translateX(-50%);
}

/* Static mode (seeked states, reduced motion): nothing animates */

.phone.is-static .wa-msg,
.phone.is-static .wa-jump,
.phone.is-static .wa-note,
.phone.is-static .wa-clock-hand,
.phone.is-static .wa-msg--typing i,
.phone.is-static .wa-typed::after {
  animation: none !important;
  transition: none !important;
}

@keyframes wa-in {
  from {
    opacity: 0;
    transform: translateY(0.5em) scale(0.94);
  }
}

@keyframes wa-dot {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  30% {
    transform: translateY(-0.2em);
    opacity: 1;
  }
}

@keyframes wa-caret {
  to {
    visibility: hidden;
  }
}

@keyframes wa-note-flash {
  0% {
    background: rgb(255 255 255 / 0.28);
  }
  100% {
    background: transparent;
  }
}

@keyframes wa-note-ring {
  0% {
    box-shadow: 0 0 0 0 rgb(255 255 255 / 0.6);
  }
  100% {
    box-shadow: 0 0 0 0.8em rgb(255 255 255 / 0);
  }
}

@keyframes wa-clock {
  0% {
    transform: rotate(-720deg);
  }
  100% {
    transform: rotate(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wa-msg,
  .wa-jump,
  .wa-note,
  .wa-clock-hand,
  .wa-msg--typing i,
  .wa-typed::after {
    animation: none !important;
    transition: none !important;
  }

  .wa-note {
    opacity: 0.85;
    transform: none;
  }
}

/* ---------- Review fixes ---------- */

/* Messages fade out under the chat header instead of being cut mid-line */
.wa-body {
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 2.2em);
  mask-image: linear-gradient(to bottom, transparent 0, #000 2.2em);
}

/* Readable annotations and timestamps */
.wa-note {
  font-size: 0.64em;
}

.wa-meta {
  color: rgba(255, 255, 255, 0.7);
}
