/* AEX.RaPhone (automation 06): the client's iPhone in iOS dark mode, Messages and Mail.
   The frame (.phone, .phone-screen, sizes in em) comes from phone.css. Everything here is
   scoped under .ra-ph. The iOS palette is defined on .ra-ph only; the Kestrel rust is the
   avatar and the email button. */

.ra-ph {
  --ios-bg: #000000;
  --ios-bar: #121214;
  --ios-in: #262629;
  --ios-out: #1f7a3d;
  --ios-text: #f5f5f7;
  --ios-muted: #8e8e93;
  --ios-blue: #0a84ff;
  --ios-line: rgba(255, 255, 255, 0.1);
  --ios-field: #1c1c1e;
  --ks-brand: #b85c38;
  --ks-brand-2: #7f3b20;
  --wa-bg: var(--ios-bg);
  --wa-text: var(--ios-text);
}

.ra-ph .ra-ph-screen {
  color: var(--ios-text);
}

[hidden].ra-ph-sms,
.ra-ph [hidden] {
  display: none !important;
}

/* ---------- Status bar (time, island, signal, wifi, battery) ---------- */

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

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

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

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

.ra-ph .ra-ph-icons svg {
  display: block;
  height: 0.75em;
  width: auto;
}

/* ---------- Notification banner (Mail) ---------- */

.ra-ph .ra-ph-banner {
  position: absolute;
  top: 0.55em;
  left: 0.55em;
  right: 0.55em;
  z-index: 4;
  display: flex;
  align-items: flex-start;
  gap: 0.6em;
  box-sizing: border-box;
  padding: 0.7em 0.8em;
  border-radius: 1.4em;
  background: rgba(44, 44, 46, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0.6em 1.6em -0.6em rgba(0, 0, 0, 0.7);
  transform: translateY(-120%);
  transition: transform 0.45s var(--ease-out);
  pointer-events: none;
}

.ra-ph .ra-ph-banner.is-on {
  transform: translateY(0);
}

.ra-ph .ra-ph-app {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 0.45em;
  background: var(--ios-blue);
}

.ra-ph .ra-ph-app svg {
  width: 1.1em;
  height: 1.1em;
}

.ra-ph .ra-ph-bt {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.ra-ph .ra-ph-bh {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78em;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b4b4b9;
}

.ra-ph .ra-ph-bh span:last-child {
  text-transform: none;
  letter-spacing: 0;
  font-size: 1.03em;
}

.ra-ph .ra-ph-btitle {
  margin-top: 0.15em;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--ios-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ra-ph .ra-ph-bbody {
  font-size: 0.78em;
  color: var(--ios-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Messages: header, thread, input bar ---------- */

.ra-ph .ra-ph-sms {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.ra-ph .ra-ph-head {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  padding: 0.3em 0.8em 0.6em;
  background: var(--ios-bar);
  border-bottom: 1px solid var(--ios-line);
}

.ra-ph .ra-ph-back {
  position: absolute;
  left: 0.7em;
  top: 1.05em;
  width: 1.35em;
  height: 1.35em;
  color: var(--ios-blue);
}

.ra-ph .ra-ph-back svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ra-ph .ra-ph-avatar {
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--ks-brand), var(--ks-brand-2));
  color: #fff;
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ra-ph .ra-ph-hname {
  display: inline-flex;
  align-items: center;
  gap: 0.25em;
  margin-top: 0.3em;
  font-size: 0.72em;
  line-height: 1.2;
  color: var(--ios-text);
  white-space: nowrap;
}

.ra-ph .ra-ph-chev {
  color: var(--ios-muted);
}

.ra-ph .ra-ph-body {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em);
  mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em);
}

.ra-ph .ra-ph-list {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28em;
  box-sizing: border-box;
  padding: 0.8em 0.75em 0.6em;
}

.ra-ph .ra-ph-stamp {
  margin: 0.5em 0 0.35em;
  text-align: center;
  font-size: 0.68em;
  line-height: 1.35;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-stamp b {
  display: block;
  font-weight: 600;
}

.ra-ph .ra-ph-msg {
  position: relative;
  max-width: 78%;
  box-sizing: border-box;
  padding: 0.5em 0.8em;
  border-radius: 1.15em;
  font-size: 1em;
  line-height: 1.32;
  overflow-wrap: anywhere;
  animation: ra-ph-in 0.3s var(--ease-out) both;
}

.ra-ph .ra-ph-msg--in {
  align-self: flex-start;
  background: var(--ios-in);
  color: var(--ios-text);
}

.ra-ph .ra-ph-msg--out {
  align-self: flex-end;
  background: var(--ios-out);
  color: #fff;
}

/* Runs: consecutive bubbles from one side sit .14em apart, a new run .5em after the last */
.ra-ph .ra-ph-msg.is-cont {
  margin-top: -0.14em;
}

.ra-ph .ra-ph-msg.is-run {
  margin-top: 0.22em;
}

/* The last bubble of a run has its tail corner (nearest its side) squared off */
.ra-ph .ra-ph-msg.is-tail.ra-ph-msg--in {
  border-bottom-left-radius: 0.35em;
}

.ra-ph .ra-ph-msg.is-tail.ra-ph-msg--out {
  border-bottom-right-radius: 0.35em;
}

.ra-ph .ra-ph-msg--typing {
  padding: 0.62em 0.9em;
}

.ra-ph .ra-ph-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  height: 1em;
}

.ra-ph .ra-ph-dots i {
  display: block;
  width: 0.45em;
  height: 0.45em;
  border-radius: 50%;
  background: var(--ios-muted);
  animation: ra-ph-dot 1.2s ease-in-out infinite;
}

.ra-ph .ra-ph-dots i:nth-child(2) {
  animation-delay: 0.15s;
}

.ra-ph .ra-ph-dots i:nth-child(3) {
  animation-delay: 0.3s;
}

.ra-ph .ra-ph-input {
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5em;
  box-sizing: border-box;
  padding: 0.5em 0.7em 1.6em;
  background: var(--ios-bar);
}

.ra-ph .ra-ph-plus {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.9em;
  height: 1.9em;
  border-radius: 50%;
  background: #2c2c2e;
  color: var(--ios-text);
}

.ra-ph .ra-ph-plus svg {
  width: 0.95em;
  height: 0.95em;
}

.ra-ph .ra-ph-field {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 2.1em;
  padding: 0 0.3em 0 0.9em;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-size: 0.9em;
}

.ra-ph .ra-ph-clip {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--ios-text);
}

.ra-ph .ra-ph-typed {
  display: inline;
}

.ra-ph .ra-ph-ph {
  position: absolute;
  left: 0.9em;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ios-muted);
  pointer-events: none;
}

.ra-ph.is-composing .ra-ph-ph {
  display: none;
}

.ra-ph .ra-ph-right {
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-mic {
  display: grid;
  place-items: center;
  width: 1.2em;
  height: 1.2em;
}

.ra-ph .ra-ph-mic svg {
  width: 100%;
  height: 100%;
}

.ra-ph .ra-ph-send {
  display: none;
  place-items: center;
  width: 1.6em;
  height: 1.6em;
  border-radius: 50%;
  background: var(--ios-out);
  color: #fff;
}

.ra-ph .ra-ph-send svg {
  width: 0.85em;
  height: 0.85em;
}

.ra-ph.is-composing .ra-ph-mic {
  display: none;
}

.ra-ph.is-composing .ra-ph-send {
  display: grid;
}

.ra-ph .ra-ph-home {
  position: absolute;
  left: 50%;
  bottom: 0.5em;
  width: 8em;
  height: 0.3em;
  transform: translateX(-50%);
  border-radius: 0.2em;
  background: rgba(255, 255, 255, 0.6);
  z-index: 6;
  pointer-events: none;
}

/* ---------- Mail: nav, reading pane, state card ---------- */

.ra-ph .ra-ph-mail {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
}

.ra-ph .ra-ph-mail[hidden] {
  display: none;
}

.ra-ph .ra-ph-mnav {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-sizing: border-box;
  height: 2.6em;
  padding: 0 0.9em;
  background: var(--ios-bar);
  border-bottom: 1px solid var(--ios-line);
}

.ra-ph .ra-ph-mback {
  display: inline-flex;
  align-items: center;
  gap: 0.1em;
  font-size: 0.9em;
  color: var(--ios-blue);
}

.ra-ph .ra-ph-mback svg {
  width: 1.1em;
  height: 1.1em;
}

.ra-ph .ra-ph-micons {
  display: inline-flex;
  gap: 1.1em;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-micons svg {
  display: block;
  width: 1.05em;
  height: 1.05em;
}

.ra-ph .ra-ph-mbody {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  box-sizing: border-box;
  padding: 1em 1.1em 1.6em;
  transition: opacity 0.35s var(--ease-std), filter 0.35s var(--ease-std);
}

.ra-ph .ra-ph-mail.is-none .ra-ph-mbody {
  display: none;
}

.ra-ph .ra-ph-mail.is-scheduled .ra-ph-mbody,
.ra-ph .ra-ph-mail.is-stopped .ra-ph-mbody {
  opacity: 0.32;
  filter: grayscale(0.4);
}

.ra-ph .ra-ph-mail.is-arrive .ra-ph-mbody {
  animation: ra-ph-arrive 0.45s var(--ease-out) both;
}

.ra-ph .ra-ph-from {
  display: flex;
  align-items: center;
  gap: 0.6em;
}

.ra-ph .ra-ph-av {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--ks-brand), var(--ks-brand-2));
  color: #fff;
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.ra-ph .ra-ph-fromtxt {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.ra-ph .ra-ph-fromtxt b {
  font-size: 0.88em;
  font-weight: 600;
  color: var(--ios-text);
  overflow-wrap: anywhere;
}

.ra-ph .ra-ph-to,
.ra-ph .ra-ph-when {
  font-size: 0.72em;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-when {
  flex: none;
  align-self: flex-start;
  white-space: nowrap;
}

.ra-ph .ra-ph-subject {
  margin: 0.8em 0 0.6em;
  font-size: 1.1em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ios-text);
}

.ra-ph .ra-ph-p {
  margin: 0 0 0.7em;
  font-size: 0.86em;
  line-height: 1.45;
  color: rgba(245, 245, 247, 0.88);
}

.ra-ph .ra-ph-cta {
  display: inline-block;
  margin: 0.4em 0 1em;
  padding: 0.6em 1.2em;
  border-radius: 0.5em;
  background: var(--ks-brand);
  color: #fff;
  font-size: 0.82em;
  font-weight: 600;
  line-height: 1.2;
}

.ra-ph .ra-ph-foot {
  margin: 0;
  font-size: 0.7em;
  line-height: 1.45;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-unsub {
  text-decoration: underline;
}

.ra-ph .ra-ph-mnav {
  order: 0;
}

/* A banner between the nav bar and the dimmed email. It takes its own row, so no text is covered */
.ra-ph .ra-ph-mstate {
  order: 1;
  flex: none;
  box-sizing: border-box;
  width: auto;
  margin: 0.7em 0.9em 0.2em;
}

.ra-ph .ra-ph-mstate:empty {
  display: none;
}

.ra-ph .ra-ph-mbody {
  order: 2;
}

/* No email yet: the empty note fills the pane and is centred */
.ra-ph .ra-ph-mail.is-none .ra-ph-mstate {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 1.2em;
}

.ra-ph .ra-ph-mail.is-sent .ra-ph-mstate {
  display: none;
}

.ra-ph .ra-ph-mstate.is-swap {
  animation: ra-ph-swap 0.35s var(--ease-std) both;
}

.ra-ph .ra-ph-card {
  display: flex;
  flex-direction: column;
  gap: 0.3em;
  box-sizing: border-box;
  padding: 1em 1.1em;
  border-radius: 1em;
  background: rgba(28, 28, 30, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 1em 2em -1em rgba(0, 0, 0, 0.8);
}

.ra-ph .ra-ph-kick {
  font-size: 0.74em;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #a6a6ab;
}

.ra-ph .ra-ph-title {
  font-size: 1em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ios-text);
}

.ra-ph .ra-ph-note {
  font-size: 0.76em;
  line-height: 1.4;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7em;
  text-align: center;
  font-size: 0.82em;
  line-height: 1.4;
  color: var(--ios-muted);
}

.ra-ph .ra-ph-empty svg {
  display: block;
  width: 2.4em;
  height: 2.4em;
}

/* ---------- Motion ---------- */

@keyframes ra-ph-in {
  from {
    opacity: 0;
    transform: translateY(0.35em) scale(0.97);
  }
}

@keyframes ra-ph-dot {
  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  30% {
    opacity: 1;
    transform: translateY(-0.15em);
  }
}

@keyframes ra-ph-arrive {
  from {
    opacity: 0;
    transform: translateY(0.5em);
  }
}

@keyframes ra-ph-swap {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Static (seeked finished state) and reduced motion: nothing animates */
.ra-ph.is-static,
.ra-ph.is-static *,
.ra-ph.is-static *::before,
.ra-ph.is-static *::after {
  transition: none !important;
  animation: none !important;
}

@media (prefers-reduced-motion: reduce) {
  .ra-ph,
  .ra-ph *,
  .ra-ph *::before,
  .ra-ph *::after {
    transition: none !important;
    animation: none !important;
  }
}
