/* The open beta page's phone: the app in use. The home screen is the walkthrough's screenshot; the
   Guide conversation and the breathing session are drawn here on the app's Light tokens, so they can
   move. Two units, both from the phone's width: --px is one pixel of the 720 px wide screenshots, for
   positions measured off them; 1em is 16 iOS points (the screenshots are 393 pt wide), for type.
   open-beta-phone.js runs the timeline. */

.phone {
  --bezel: var(--ink);
  aspect-ratio: 720 / 1565;
  overflow: hidden;
  container-type: inline-size;
  color-scheme: light;
}
.scr, .tap {
  --px: calc(100cqw / 720);
  font-size: calc(100cqw / 24.5);
}
.scr {
  position: absolute;
  inset: 0;
  font-family: var(--font-text);
  font-weight: 400;
  line-height: 1.4;
  color: var(--ink);
  background: var(--canvas);
  visibility: hidden;
  pointer-events: none;
}
.scr.is-on { visibility: visible; z-index: 1; }
/* A fixed stacking order: home, the sage circle, the Guide, the session. The circle stays under the Guide
   once it is in, ready to be revealed again on the way back. */
.scr-guide.is-on { z-index: 3; }
.scr-breath.is-on { z-index: 4; }

/* ---------------------------------------------------------------- The app's transitions */
/* Home to Guide is the app's orb-expand (RizeTransitionType.orbExpand, 1400 ms): the tapped orb's body,
   painted with the orb's own gradient, grows over the first half until it floods the screen (ease-in-out
   cubic), and the Guide fades in over it from 40% to the end (ease-in-out). Back is the same in reverse
   over 400 ms. The circle starts at the home screenshot's orb: 22% of the width, centred at 50%, 39.7%. */
.orb-expand {
  position: absolute;
  z-index: 2;
  left: 50%; top: 39.7%;
  width: 22%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle closest-side, var(--orb-highlight) 0%, var(--orb) 45%, var(--sage) 100%);
  visibility: hidden;
  pointer-events: none;
}
.orb-expand.is-on { visibility: visible; animation: orb-expand 700ms cubic-bezier(0.65, 0, 0.35, 1) both; }
.orb-expand.is-full { visibility: visible; transform: scale(13.5); }
.orb-expand.collapse { animation: orb-expand 160ms cubic-bezier(0.65, 0, 0.35, 1) reverse both; }
@keyframes orb-expand { from { transform: scale(1); } to { transform: scale(13.5); } }
.scr-guide.materialise { animation: materialise 840ms 560ms ease-in-out both; }
.scr-guide.dematerialise { animation: materialise 240ms ease-in-out reverse both; }
@keyframes materialise { from { opacity: 0; } to { opacity: 1; } }

/* Guide to the session is the app's iOS push (350 ms, ease-in-out cubic): the new screen slides in from the
   right over the one beneath, with a soft shadow on its leading edge; back slides it out again. */
.scr-breath.push-in, .scr-breath.push-out {
  box-shadow: -5px 0 10px color-mix(in srgb, var(--ink) 10%, transparent);
}
.scr-breath.push-in { animation: push 350ms cubic-bezier(0.65, 0, 0.35, 1) both; }
.scr-breath.push-out { animation: push 350ms cubic-bezier(0.65, 0, 0.35, 1) reverse both; }
@keyframes push { from { transform: translateX(100%); } to { transform: translateX(0); } }
img.scr { width: 100%; height: 100%; object-fit: cover; }
.is-off { display: none !important; }
.scr svg { stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* iOS status bar, as the screenshots have it. */
.bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: calc(114 * var(--px));
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 calc(70 * var(--px)) 0 calc(112 * var(--px));
  color: var(--ink);
}
.bar-time { font-size: 1.0625em; font-weight: 500; letter-spacing: -0.01em; }
.bar-icons { display: flex; align-items: center; gap: 0.35em; }
.bar-icons svg { width: 1.25em; height: 1.25em; stroke-width: 2.4; }
.bar-icons .batt { width: 1.8em; }
.bar-icons .batt rect:last-child { fill: currentColor; stroke: none; }

/* Screen header: a round button each side and the title between. */
.app-head {
  position: absolute;
  top: calc(132 * var(--px)); left: calc(32 * var(--px)); right: calc(32 * var(--px));
  height: calc(56 * var(--px));
  display: grid;
  grid-template-columns: calc(56 * var(--px)) 1fr calc(56 * var(--px));
  align-items: center;
}
.round, .plain {
  width: calc(56 * var(--px)); height: calc(56 * var(--px));
  display: grid; place-items: center;
}
.round {
  border-radius: var(--radius-full);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  color: var(--accent);
}
.round svg { width: 1.1em; height: 1.1em; }
.plain { color: var(--ink); }
.plain svg { width: 1.35em; height: 1.35em; }
.app-title { text-align: center; }
.app-title.wordmark-sm {
  font: 300 1.375em/1 var(--font-display);
  letter-spacing: 0.18em;
  color: var(--sage);
}
.app-title.sans { font-size: 1.0625em; font-weight: 500; color: var(--ink); }

/* ---------------------------------------------------------------- The Guide */
/* Values are the app's own (lib/screens/chat.dart and lib/widgets/chat_suggestion_widget.dart in
   rize-mobile-app), in points, written in em at 16pt: the list's 20pt gutter, the guide bubble's
   14/16 padding, 20pt corners with a 4pt tail, white at 82% over the cream, Cormorant 15/300 at 1.5;
   the user bubble's sage tint, DM Sans 13 at 1.5 (the site ships 400, the app sets 300); the 28pt orb
   10pt before a guide bubble; 6pt between bubbles. */
.kbd {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(590 * var(--px));
  background: url("/demos/rize-app/walkthrough/06-guide.jpg") center bottom / 100% auto no-repeat;
  transition: transform 300ms ease;
}
.scr-guide:not(.kbd-up) .kbd { transform: translateY(100%); }
.scr-guide.kbd-up .compose { bottom: calc(600 * var(--px)); }
.scr-guide.kbd-up .msgs { bottom: calc(720 * var(--px)); }
.msgs {
  position: absolute;
  top: calc(236 * var(--px)); left: 1.25em; right: 1.25em;
  bottom: calc(190 * var(--px));
  display: flex;
  flex-direction: column;
  gap: 0.75em;
  overflow: hidden;
  transition: bottom 300ms ease;
}
.msg {
  position: relative;
  animation: msg-in 360ms var(--ease-reveal) both;
}
.msg-guide {
  max-width: calc(88% - 2.375em);
  margin-left: 2.375em;
  padding: 0.875em 1em;
  border-radius: 1.25em;
  border-bottom-left-radius: 0.25em;
  background: color-mix(in srgb, var(--surface-raised) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--surface-raised) 90%, transparent);
  box-shadow:
    0 2px 16px color-mix(in srgb, var(--sage) 10%, transparent),
    0 1px 2px color-mix(in srgb, var(--ink) 4%, transparent);
  font: 300 0.9375em/1.5 var(--font-display);
  color: var(--ink);
}
.msg-guide::before {
  /* The Guide's orb avatar, 28pt, at the foot of the bubble. */
  content: "";
  position: absolute;
  left: -2.375em;
  bottom: 0;
  width: 1.75em; height: 1.75em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--orb-highlight), var(--orb) 55%, color-mix(in srgb, var(--sage) 60%, var(--orb)) 100%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--sage) 30%, transparent), inset 0 0 0 0.5px color-mix(in srgb, #fff 60%, transparent);
}
.msg-guide::before { font-size: calc(100cqw / 24.5); }
.msg-user {
  align-self: flex-end;
  max-width: 80%;
  padding: 0.75em 1em;
  border-radius: 1.25em;
  border-bottom-right-radius: 0.25em;
  background: color-mix(in srgb, var(--sage) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--sage) 18%, transparent);
  box-shadow: 0 1px 6px color-mix(in srgb, var(--sage) 6%, transparent);
  font: 400 0.8125em/1.5 var(--font-text);
  color: var(--ink);
}
.typing {
  display: flex;
  gap: 0.3em;
  align-items: center;
  width: max-content;
  margin-left: 2.375em;
  padding: 0.875em 1.125em;
  border-radius: 1.25em;
  border-bottom-left-radius: 0.25em;
  background: color-mix(in srgb, var(--surface-raised) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--surface-raised) 90%, transparent);
  box-shadow: 0 2px 16px color-mix(in srgb, var(--sage) 10%, transparent);
  animation: msg-in 360ms var(--ease-reveal) both;
}
.typing span {
  width: 0.375em; height: 0.375em;
  border-radius: 50%;
  background: var(--sage-soft);
  animation: dot 1.1s ease-in-out infinite;
}
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }

/* Once the conversation outgrows the list, it sits on its foot like a chat scrolled to the latest line. */
.msgs.is-scrolled { justify-content: flex-end; }

/* The completion card the app posts to the chat after a session (ActivityCompletionChatWidget): a
   compact card across the list, the activity as a sage eyebrow with its icon and the time on the right,
   the title in the serif, the facts under it. */
.done {
  padding: 0.875em 1em;
  border: 1px solid color-mix(in srgb, var(--sage) 18%, transparent);
  border-radius: 1.125em;
  background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
  box-shadow: 0 2px 16px color-mix(in srgb, var(--sage) 10%, transparent);
  display: grid;
  gap: 0.25em;
  animation: msg-in 360ms var(--ease-reveal) both;
}
.done-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5em; }
.done-eyebrow { display: flex; align-items: center; gap: 0.5em; font-size: 0.5625em; font-weight: 400; letter-spacing: 0.18em; line-height: 1.4; text-transform: uppercase; color: var(--sage); }
.done-eyebrow svg { width: 1.55em; height: 1.55em; stroke-width: 2; }
.done-time { font-size: 0.625em; color: var(--ink-muted); }
.done-title { margin-top: 0.25em; font: 300 1.125em/1.25 var(--font-display); color: var(--ink); }
.done-sub { font-size: 0.75em; line-height: 1.55; color: var(--ink-muted); }

/* The suggested practice, as the app's _SageActionCard draws it inside the guide bubble: white at
   78% with a sage hairline, 18pt corners, 16/14 padding; a 14pt sage icon and a 9pt sage eyebrow;
   the title in Cormorant 18/300; 12pt rows with sage icons; the sage gradient pill, 24pt corners. */
.sug {
  margin: 0.5em 0 0;
  padding: 0.875em 1em;
  border: 1px solid color-mix(in srgb, var(--sage) 18%, transparent);
  border-radius: 1.125em;
  background: color-mix(in srgb, var(--surface-raised) 78%, transparent);
  box-shadow: 0 2px 16px color-mix(in srgb, var(--sage) 10%, transparent);
  font: 400 1em/1.55 var(--font-text);
  color: var(--ink);
  display: grid;
  gap: 0;
}
.sug-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.5625em;
  font-weight: 400;
  letter-spacing: 0.18em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--sage);
}
.sug-eyebrow svg { width: 1.55em; height: 1.55em; stroke-width: 2; }
.sug-title { margin-top: 0.5em; font: 300 1.125em/1.25 var(--font-display); color: var(--ink); }
.sug-params { list-style: none; margin-top: 0.75em; display: grid; gap: 0.375em; font-size: 0.75em; line-height: 1.55; color: var(--ink-muted); }
.sug-params li { display: flex; align-items: center; gap: 0.5em; white-space: nowrap; }
.sug-params svg { width: 1.1667em; height: 1.1667em; color: var(--sage); stroke-width: 1.75; }
.sug-params b { font-weight: 400; color: var(--ink); margin-left: -0.1em; }
.sug-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  margin-top: 0.875em;
  padding: 0.75em 1em;
  border-radius: 1.5em;
  background: linear-gradient(135deg, var(--sage), color-mix(in srgb, var(--sage) 55%, var(--accent)));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--sage) 32%, transparent);
  color: #fff;
  font-size: 0.8125em;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.2;
}
.sug-cta svg { width: 1.23em; height: 1.23em; fill: currentColor; stroke: none; }

/* The composer: a sage-filled 46pt voice button, the white pill with a sage hairline and 18/12
   padding, and a 46pt white send button, 10pt apart, inside the 20pt gutter. */
.compose {
  position: absolute;
  left: 1.25em; right: 1.25em; bottom: calc(64 * var(--px));
  display: grid;
  grid-template-columns: 2.875em 1fr 2.875em;
  gap: 0.625em;
  align-items: end;
  transition: bottom 300ms ease;
}
.mic, .send {
  width: 2.875em; height: 2.875em;
  display: grid; place-items: center;
  border-radius: 50%;
}
.mic { background: var(--orb); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--sage) 25%, transparent); }
.mic svg { width: 1.25em; height: 1.25em; }
.field {
  min-height: 2.875em;
  display: flex;
  align-items: center;
  padding: 0.75em 1.125em;
  border: 1px solid color-mix(in srgb, var(--sage) 18%, transparent);
  border-radius: 1.5em;
  background: color-mix(in srgb, var(--surface-raised) 75%, transparent);
  font-size: 0.875em;
  line-height: 1.45;
  color: color-mix(in srgb, var(--sage) 70%, var(--ink-muted));
  overflow-wrap: anywhere;
}
.field.is-live { color: var(--ink); }
.field-text:empty::before { content: attr(data-placeholder); }
.field.is-live .field-text::after {
  content: "";
  display: inline-block;
  width: 1px; height: 1.15em;
  margin-left: 0.1em;
  vertical-align: -0.2em;
  background: var(--sage);
  animation: caret 1s steps(2) infinite;
}
.send {
  border: 1px solid color-mix(in srgb, var(--sage) 22%, transparent);
  background: color-mix(in srgb, var(--surface-raised) 80%, transparent);
  color: var(--sage);
}
.send svg { width: 1.125em; height: 1.125em; fill: currentColor; stroke: none; }
.home-bar {
  position: absolute;
  left: 50%; bottom: calc(16 * var(--px));
  width: calc(280 * var(--px)); height: calc(10 * var(--px));
  translate: -50% 0;
  border-radius: var(--radius-full);
  background: var(--ink);
}

/* ---------------------------------------------------------------- Breathing */
.scr-breath { text-align: center; }
.timer {
  position: absolute;
  top: calc(222 * var(--px)); left: 0; right: 0;
  font: 300 2.75em/1 var(--font-display);
  font-variant-numeric: tabular-nums lining-nums;
  color: var(--ink);
}
.breath-orb {
  position: absolute;
  left: 50%; top: calc(780 * var(--px));
  width: calc(445 * var(--px)); height: calc(445 * var(--px));
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--orb-highlight), var(--orb) 45%, var(--sage) 100%);
  box-shadow: 0 0 calc(70 * var(--px)) calc(24 * var(--px)) color-mix(in srgb, var(--orb) 40%, transparent);
  transform: scale(0.86);
  transition: transform 4s cubic-bezier(0.45, 0.05, 0.55, 0.95);
}
.breath-orb.is-full { transform: scale(1.06); }
.cue {
  position: absolute;
  /* Under the orb, rather than at the foot of the screen as in the app, so the band's crop never hides it. */
  top: calc(1100 * var(--px)); left: 0; right: 0;
  font: italic 300 1.875em/1.2 var(--font-display);
  color: var(--accent);
  transition: opacity 300ms ease;
}
/* The skip ahead: the clock and the cue blur into a soft smudge, the later time is set while they are
   blurred, and they sharpen again, so it reads as time passing rather than a cut. They never go away. */
.cue, .timer { transition: filter 700ms ease, opacity 700ms ease; }
.cue.is-dim, .timer.is-dim { filter: blur(6px); opacity: 0.7; }

/* ---------------------------------------------------------------- The tap */
.tap {
  position: absolute;
  z-index: 3;
  width: 2.75em; height: 2.75em;
  margin: -1.375em 0 0 -1.375em;
  border-radius: 50%;
  border: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  opacity: 0;
  pointer-events: none;
}
.tap.is-on { animation: tap 560ms ease-out both; }

@keyframes msg-in { from { opacity: 0; transform: translateY(0.6em); } }
@keyframes dot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-0.25em); opacity: 1; } }
@keyframes caret { to { visibility: hidden; } }
@keyframes tap {
  0% { opacity: 0; transform: scale(0.5); }
  30% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}

@media (prefers-reduced-motion: reduce) {
  /* Fades only: the circle does not grow and the session does not slide. */
  .orb-expand.is-on, .orb-expand.is-full, .orb-expand.collapse { visibility: hidden; animation: none; }
  .scr-guide.materialise { animation: materialise 420ms ease both; }
  .scr-guide.dematerialise { animation: materialise 300ms ease reverse both; }
  .scr-breath.push-in { animation: materialise 350ms ease both; box-shadow: none; }
  .scr-breath.push-out { animation: materialise 350ms ease reverse both; box-shadow: none; }
  .msg, .typing, .done { animation: none; }
  .typing span { animation: none; opacity: 0.7; }
  .breath-orb { transition: none; transform: none; }
  .breath-orb.is-full { transform: none; }
  .kbd, .msgs, .compose { transition: none; }
  .tap.is-on { animation: tap-fade 560ms ease-out both; }
  @keyframes tap-fade { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
}
