/* The landing page's phone: a true-to-life device showing the app's chat.
   The screen is laid out at the app's real 390x844 size and the whole device
   is scaled with --phone-scale, so the conversation renders as it does in the
   app. Colors are the app's own (Flutter's SanctuaryColors), not the page's:
   the phone depicts the app. */

.phone {
  --phone-scale: 0.72;
  --app-paper: #f7f5f1;
  --app-surface: #fff;
  --app-ink: #2a2438;
  --app-ink-soft: #6e657b;
  --app-ink-faint: #746b80;
  --app-line: #e6e4ea;
  --app-hairline: #f3f2f5;
  --app-primary: #4a2d6b;
  --app-on-primary: #fff;
  --app-veil: #f4f0f8;
  --app-veil-deep: #e5dded;
  --app-gold: #d4a24c;
  --app-gold-ink: #9a712c;
  --app-card: #faf6ef;
  --app-card-line: #e3d9cb;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  font-family: "Assistant", system-ui, sans-serif;
  text-align: start;
}

.phone [hidden] { display: none; }

/* The body reserves the scaled device's footprint; the device inside keeps
   its natural size and is scaled from the corner. */
.phone-body {
  position: relative;
  flex: none;
  width: calc(426px * var(--phone-scale));
  height: calc(880px * var(--phone-scale));
}

.phone-device {
  position: absolute;
  top: 0;
  left: 0;
  width: 426px;
  height: 880px;
  transform: scale(var(--phone-scale));
  transform-origin: 0 0;
  border-radius: 70px;
  line-height: 1.5;
  background: linear-gradient(140deg, #e4e4e0 0%, #9a9b97 18%, #d9dad6 36%, #7d7e7a 58%, #c9cac6 78%, #8a8b87 100%);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 28%),
    inset 0 0 0 1px rgb(255 255 255 / 35%),
    0 50px 70px -40px rgb(42 36 56 / 55%),
    0 24px 40px -24px rgb(0 0 0 / 35%);
}

.phone-device::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 66px;
  background: #0a0a0b;
  box-shadow: inset 0 0 0 1.5px #1d1d1f;
}

.phone-key {
  position: absolute;
  width: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, #6f706c, #d2d3cf 50%, #7d7e7a);
}
.phone-key--action { left: -3px; top: 150px; height: 34px; }
.phone-key--up { left: -3px; top: 212px; height: 64px; }
.phone-key--down { left: -3px; top: 290px; height: 64px; }
.phone-key--power { right: -3px; top: 250px; height: 104px; }

.phone-screen {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  isolation: isolate;
  border-radius: 52px;
  background: var(--app-paper);
  color: var(--app-ink);
}

.phone-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(118deg, rgb(255 255 255 / 16%) 0%, rgb(255 255 255 / 0%) 32%);
}

.phone-island {
  position: absolute;
  top: 11px;
  left: 50%;
  z-index: 10;
  width: 124px;
  height: 36px;
  border-radius: 20px;
  background: #000;
  transform: translateX(-50%);
}

.phone-status {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 6px 34px 0 40px;
  background: var(--app-surface);
  color: #111;
  font: 600 16.5px/1 -apple-system, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
}
.phone-status-icons { display: flex; gap: 6px; align-items: center; }
.phone-status svg { display: block; }

.phone-appbar {
  position: relative;
  z-index: 2;
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  height: 58px;
  padding-block: 0;
  padding-inline: 14px 10px;
  border-bottom: 1px solid var(--app-line);
  background: var(--app-surface);
}
.phone-back,
.phone-more { display: grid; place-items: center; width: 34px; height: 34px; }
.phone-back { color: var(--app-ink); }
.phone-more { color: var(--app-ink-soft); }
html[dir="rtl"] .phone-back svg { transform: scaleX(-1); }
.phone-title { display: flex; flex: 1; flex-direction: column; min-width: 0; line-height: 1.2; }
.phone-title b { font-size: 17px; font-weight: 700; }
.phone-title > span { color: var(--app-ink-faint); font-size: 12.5px; }

.phone-avatar {
  display: grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--app-veil), var(--app-veil-deep));
  color: var(--app-primary);
}
/* As the app's ZigmiAvatar: the mark at half the circle. */
.phone-avatar svg { width: 50%; height: 50%; }
.phone-appbar .phone-avatar { width: 32px; height: 32px; }

.phone-thread {
  position: relative;
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 18px 16px 6px;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: none;
}
.phone-thread::-webkit-scrollbar { display: none; }
.phone-thread:focus-visible { outline: 3px solid var(--app-primary); outline-offset: -3px; }

.phone-day { margin: 0 0 16px; color: var(--app-ink-faint); font-size: 12.5px; text-align: center; }
.phone-msg p,
.phone-card p { margin: 0; }
.phone-msg time { display: block; margin: 5px 0 16px; color: var(--app-ink-faint); font-size: 11.5px; }

/* Your lines: the one solid bubble, sharp corner on the end side. */
.phone-msg[data-speaker="me"] { display: flex; flex-direction: column; align-items: flex-end; }
.phone-msg[data-speaker="me"] p {
  max-width: 84%;
  padding: 11px 16px;
  border-radius: 18px;
  border-end-end-radius: 6px;
  background: var(--app-primary);
  color: var(--app-on-primary);
  font-size: 16px;
  line-height: 1.55;
}
.phone-msg[data-speaker="me"] time { margin-inline-end: 2px; }

/* The assistant's lines: text on the canvas, signed by the mark once per run. */
.phone-msg[data-speaker="assistant"] { display: grid; grid-template-columns: 26px minmax(0, 1fr); column-gap: 8px; }
.phone-msg[data-speaker="assistant"] .phone-avatar { margin-top: 1px; }
.phone-msg--run .phone-avatar { visibility: hidden; }
.phone-msg[data-speaker="assistant"] p { padding: 2px 0; font-size: 16px; line-height: 1.55; }
.phone-msg[data-speaker="assistant"] time { grid-column: 2; }

.phone-typing .phone-dots { display: inline-flex; gap: 5px; padding: 9px 0 18px; }
.phone-typing .phone-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--app-ink-faint); opacity: 0.35; animation: phone-dot 1.1s infinite ease-in-out; }
.phone-typing .phone-dots i:nth-child(2) { animation-delay: 0.15s; }
.phone-typing .phone-dots i:nth-child(3) { animation-delay: 0.3s; }

.phone-card { margin: 4px 0 18px; }

/* The app's simulation card. */
.phone-sim { overflow: hidden; border: 1px solid var(--app-card-line); border-radius: 24px; background: var(--app-card); }
.phone-sim-portrait { position: relative; height: 245px; }
.phone-sim-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.phone-fictional {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgb(255 255 255 / 92%);
  color: var(--app-ink);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.2;
}
.phone-fictional::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--app-gold); }
.phone-sim-body { padding: 20px 22px; }
.phone-sim-name { color: var(--app-ink); font-size: 25px; font-weight: 700; line-height: 1.2; }
.phone-sim-meta { margin-top: 4px; color: var(--app-ink-soft); font-size: 13.5px; }
.phone-sim .phone-sim-opening { margin: 14px 0; font-size: 16.5px; font-weight: 600; line-height: 1.5; }
.phone-sim-open { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: 700; }

/* An introduction with its reason. */
.phone-intro { padding: 16px 18px; border: 1px solid var(--app-line); border-radius: 16px; background: var(--app-surface); }
.phone-intro-caption { margin-bottom: 6px; color: var(--app-ink-faint); font-size: 12.5px; }
.phone-intro p { font-size: 15.5px; line-height: 1.55; }
.phone-intro-action { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; color: var(--app-primary); font-size: 15px; font-weight: 700; }

html[dir="rtl"] .phone-forward { transform: scaleX(-1); }

.phone-sim-cta {
  display: flex;
  flex: none;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin: 6px 16px 8px;
  padding: 7px 10px;
  border: 1.5px solid var(--app-gold);
  border-radius: 12px;
  background: var(--app-surface);
}
.phone-sim-cta svg { width: 17px; height: 17px; color: var(--app-gold); }
.phone-sim-cta b { display: block; color: var(--app-gold-ink); font-size: 15px; line-height: 1.25; }
.phone-sim-cta small { display: block; color: var(--app-ink-soft); font-size: 12px; line-height: 1.3; }

.phone-composer { flex: none; padding: 9px 12px 0; border-top: 1px solid var(--app-hairline); background: var(--app-surface); }
.phone-field {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 5px;
  padding-inline-start: 16px;
  border: 1px solid var(--app-line);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgb(42 36 56 / 5%);
}
.phone-field > span:first-child { flex: 1; color: var(--app-ink-faint); font-size: 16px; }
.phone-send {
  display: grid;
  flex: none;
  place-items: center;
  align-self: flex-end;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #e8e6e1;
  color: #a9a69f;
  transition: background 200ms ease, color 200ms ease;
}
.phone-send.is-ready { background: var(--app-primary); color: var(--app-on-primary); }
/* Your next line, typed into the field: up to three lines, the latest in view. */
.phone-draft {
  display: none;
  flex: 1;
  max-height: calc(3 * 1.5em);
  overflow: hidden;
  color: var(--app-ink);
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.phone-field.is-drafting .phone-draft { display: block; }
.phone-field.is-drafting > span:first-child { display: none; }
.phone-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-inline-start: 1px;
  vertical-align: text-bottom;
  background: var(--app-primary);
  animation: phone-caret 1s steps(1) infinite;
}

.phone-home { position: relative; flex: none; height: 34px; background: var(--app-surface); }
.phone-home::after {
  content: "";
  position: absolute;
  bottom: 9px;
  left: 50%;
  width: 136px;
  height: 5px;
  border-radius: 3px;
  background: #111;
  transform: translateX(-50%);
}

/* A short phone shows only the top of the device: the moment's few messages. */
.phone--short { --phone-visible: 540px; }
.phone--short .phone-body {
  height: calc(var(--phone-visible) * var(--phone-scale));
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent);
  mask-image: linear-gradient(to bottom, #000 80%, transparent);
}
.phone--short .phone-thread { overflow: hidden; }

.phone-motion {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--app-line);
  border-radius: 50%;
  background: var(--app-surface);
  color: var(--app-ink);
  cursor: pointer;
}
.phone-motion:focus-visible { outline: 3px solid var(--app-primary); outline-offset: 2px; }
.phone-motion .phone-motion-play,
.phone-motion.is-paused .phone-motion-pause { display: none; }
.phone-motion.is-paused .phone-motion-play { display: block; }

.phone-msg.is-new,
.phone-card.is-new { animation: phone-message-in 320ms ease both; }
.phone.is-switching .phone-thread { animation: phone-chat-swap 450ms ease; }

@keyframes phone-dot {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 0.9; transform: translateY(-3px); }
}
@keyframes phone-caret { 50% { opacity: 0; } }
@keyframes phone-message-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes phone-chat-swap { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .phone-msg.is-new,
  .phone-card.is-new,
  .phone.is-switching .phone-thread,
  .phone-caret { animation: none; }
}
