/* ============================================================
   hero-sim.css — the homepage hero: a typed headline and the
   focused iOS 26 card beside it that acts out each phrase.
   Loaded after the landing CSS. It fits the square into the blue
   page's two-column hero (.arc-concept .hero-with-phone) in place
   of the phone video, and follows the page's light/dark theme
   (html[data-theme]). Driven by js/hero-sim.js.
   ============================================================ */

/* ---- headline: "Use iMessage to" is the page's h1 type; each use case arrives under it as a sent iMessage
   bubble (blue, iOS tail bottom right) that rises out of an invisible line under the rotator and settles, with
   The previous bubble floats up and away. The hidden sizers are
   the same bubble with the same padding, stacked in the one grid cell, so the cell always holds the tallest
   phrase at the current width and nothing below moves when the phrase changes. Without JS or with reduced
   motion the first phrase rests as a delivered bubble.
   Shape and motion are based on a 60 fps recording of a sent message (3 px per pt, 17 pt
   text, so 1 em = 51 recorded px): corner radius 1.06 em, the tail a 1.1 em x 0.82 em piece that leaves the corner arc, hangs
   0.35 em below the body and ends 0.275 em in from its right edge, and a horizontal blue ramp, lighter on the left
   (#1089f6) and flat from 52 % across (#0059cd). The tail takes the flat end colour, so it joins the body with no seam. */
.imsg-hero .hero-rotator {
  --bubble: linear-gradient(90deg, #1089f6 6%, #007ef6 15%, #006de2 25%, #0061d5 34%, #005ace 43%, #0059cd 52%);
  --send-lag: .08s; --bubble-end: #0059cd; --bf: clamp(21px, 2.3vw, 32px);
  display: grid; padding-top: calc(var(--bf) * .55); font-size: var(--bf); line-height: 1.22; letter-spacing: -.012em; font-weight: 400;
}
.imsg-hero .hero-rotator > * { grid-area: 1 / 1; align-self: start; justify-self: start; max-width: 100%; }
.imsg-hero .hero-keep { white-space: nowrap; }
/* The gap above the rotator is padding, not margin: the rotator is a block inside the h1's inline content, and WebKit
   re-lays a margin there out as if it also collapsed through the h1's top (the h1 and everything below dropped by it,
   whenever a glyph's weight changed in the Bloom). Padding cannot collapse. */
/* the line clips only at its bottom edge, .4em under the bubble (the tail hangs .35em): a new bubble rises out of it and never shows below it */
.imsg-hero .hero-line { position: relative; display: grid; justify-items: end; width: fit-content; padding-bottom: .4em; clip-path: inset(-100vh -100vw 0 -100vw); }
.imsg-hero :is(.hero-bubble, .hero-sizer) {
  position: relative; box-sizing: border-box; padding: .46em .85em .5em; border-radius: 1.06em;
  background: var(--bubble); color: #fff; transform-origin: 0 100%;
  font-family: system-ui, -apple-system, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, sans-serif;   /* variable on Apple and Windows 11: the Bloom swells the weight */
}
.imsg-hero .hero-bubble::after {          /* the tail */
  content: ""; position: absolute; right: .275em; bottom: -.35em; width: 1.1em; height: .82em; background: var(--bubble-end);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 42'%3E%3Cpath d='M0 24C18 24 32 32 43 39.5Q47.5 42.2 48.3 39C48.3 33 44 28 44 23C44 17 49.4 13 54.4 8L50 0H0Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 56 42'%3E%3Cpath d='M0 24C18 24 32 32 43 39.5Q47.5 42.2 48.3 39C48.3 33 44 28 44 23C44 17 49.4 13 54.4 8L50 0H0Z'/%3E%3C/svg%3E") center/100% 100% no-repeat;
}
.imsg-hero .hero-sizer { visibility: hidden; margin-bottom: .4em; padding-right: 1.35em; }   /* room for the tail, as the line has; .5em more than the bubble's, so the Bloom's heavier text never wraps */
/* a send: js/hero-sim.js sets data-state="sent" on the live line (clearing it first restarts this). --send-lag
   holds the new bubble below the line while the old one is already floating away. */
.imsg-hero .hero-line[data-state="sent"] .hero-bubble { animation: hero-send .616s linear var(--send-lag) both; }
.imsg-hero .hero-ghost { pointer-events: none; animation: hero-away .24s cubic-bezier(.4, 0, 1, 1) forwards, hero-fade .16s linear forwards; }
/* the bubble's translateY (% of its own height) from the recording, one stop per frame early and per two frames
   later, then a 4 % scale-up, pinned at its left edge (the bubble is left-aligned in the hero). It stays at opacity 0
   until a third of it is above the line, so the rounded top never shows as a sliver. */
@keyframes hero-send {
  0.0% { translate: 0 158.0%; scale: 0.960; opacity: 0; }
  2.7% { translate: 0 147.0%; scale: 0.962; opacity: 0; }
  5.4% { translate: 0 136.0%; scale: 0.963; opacity: 0; }
  8.1% { translate: 0 125.0%; scale: 0.965; opacity: 0; }
  10.8% { translate: 0 114.0%; scale: 0.966; opacity: 0; }
  13.5% { translate: 0 102.0%; scale: 0.968; opacity: 0; }
  16.2% { translate: 0 90.0%; scale: 0.970; opacity: 0; }
  18.9% { translate: 0 79.0%; scale: 0.971; opacity: 0.6; }
  21.6% { translate: 0 68.0%; scale: 0.973; opacity: 1; }
  24.3% { translate: 0 57.0%; scale: 0.974; opacity: 1; }
  29.7% { translate: 0 39.0%; scale: 0.978; opacity: 1; }
  35.1% { translate: 0 22.0%; scale: 0.981; opacity: 1; }
  40.5% { translate: 0 11.0%; scale: 0.984; opacity: 1; }
  45.9% { translate: 0 4.0%; scale: 0.987; opacity: 1; }
  51.4% { translate: 0 -2.0%; scale: 0.990; opacity: 1; }
  56.8% { translate: 0 -4.0%; scale: 0.994; opacity: 1; }
  62.2% { translate: 0 -6.0%; scale: 0.997; opacity: 1; }
  67.6% { translate: 0 -6.0%; scale: 1.000; opacity: 1; }
  73.0% { translate: 0 -5.0%; scale: 1.000; opacity: 1; }
  78.4% { translate: 0 -4.3%; scale: 1.000; opacity: 1; }
  83.8% { translate: 0 -3.5%; scale: 1.000; opacity: 1; }
  89.2% { translate: 0 -2.5%; scale: 1.000; opacity: 1; }
  94.6% { translate: 0 -1.3%; scale: 1.000; opacity: 1; }
  100% { translate: none; scale: none; opacity: 1; }
}
@keyframes hero-away { to { translate: 0 -.8em; } }
@keyframes hero-fade { to { opacity: 0; } }
/* Bloom (js/hero-sim.js): a wave crosses the bubble's text, then the headline's "iMessage", left to right. Each
   glyph is its own span; the script swells its weight and size (the bubble) or lifts and lightens it (the word) as the wave
   passes. A word never breaks across lines, so the spans cannot change where the text wraps. */
.imsg-hero .hero-ch { display: inline-block; transform-origin: 50% 100%; }
.imsg-hero .hero-w { white-space: nowrap; }
.imsg-hero .hero-imsg .hero-ch { color: color-mix(in srgb, currentColor, #fff calc(var(--b, 0) * 38%)); }
/* small phones: a smaller headline, so "Use iMessage to" stays on one line above the bubble */
@media (max-width: 400px) { .arc-concept .hero-with-sim h1 { font-size: clamp(32px, 10.6vw, 38px); } }

/* ---- fit: the square takes the phone's place. Desktop: copy and square side by side, vertically
   centred (the blue grid's align-items): 360 px up to 1125 px wide, then 32vw to 480 px; just above the
   breakpoint it gives way (to 300 px) so the phone field keeps 200 px. At the blue page's 900 px
   breakpoint the copy centres and the square sits close under the form, its content keeping to its
   top edge (the notifications stack down from the card's side inset; js/hero-sim.js keeps a card's
   top there), so the story starts right under the form; on phones it reaches into the hero's side
   padding so the card spans the form. */
@media not all and (max-width: 900px) {
  .arc-concept .hero-with-sim .imsg-container {
    grid-template-columns: minmax(0, 1fr) clamp(300px, max(32vw, min(360px, 100vw - 640px)), 480px);
    column-gap: clamp(40px, 100vw - 860px, 56px);
  }
  .arc-concept .hero-with-sim .hero-sim { width: 100%; margin: 0; }
  .arc-concept .hero-with-sim .hero-sub { text-wrap: pretty; }                   /* the narrower column: no lone last word */
}
@media (max-width: 900px) {
  .arc-concept .hero-with-sim .imsg-container { gap: 12px; }
  .arc-concept .hero-with-sim .hero-sim { width: min(100%, 400px); margin: 0 auto; }
}
@media (max-width: 480px) {
  .arc-concept .hero-with-sim .hero-sim { width: min(100% + 32px, 400px); margin-inline: calc((100% - min(100% + 32px, 400px)) / 2); }
}

/* ---- the square: an iOS 26 Messages thread that acts out each headline phrase -----------------------
   One square stage, clear over the hero's wash. In it a card holds one conversation with one app (its photo and name on top):
   the phrase's messages arrive in order, and the thread fades when the headline sends its next phrase. Every iOS size is in pt:
   calc(N * var(--kT)). Without JS or with reduced motion it rests on the first phrase's finished conversation. */
.imsg-hero .hero-sim {
  --kT: calc(90cqw / 320);
  --ios-bg: #FFFFFF; --ios-in: #E9E9EB; --ios-in-ink: #000000; --ios-meta: rgba(60, 60, 67, .6);
  --ios-dot: #B6B5B9; --ios-dot-hi: #9E9DA0; --blue-top: #5AABFF; --blue-bot: #0088FF;
  --edge: 0 0 0 1px rgba(16, 20, 32, .08), 0 2px 6px rgba(16, 20, 32, .06);       /* hairline + contact, */
  --plate: var(--edge), 0 30px 70px -20px rgba(16, 20, 32, .28);                    /* + the soft lift: neutral on the blue-to-cream wash */
  position: relative; width: min(100%, 480px); aspect-ratio: 1 / 1; margin: 0 auto; justify-self: center;
  container-type: inline-size;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Helvetica Neue", Arial, sans-serif;
  font-synthesis: none; letter-spacing: normal; text-align: left;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  -webkit-user-select: none; user-select: none;
}
/* phones: the card takes a little more of the square */
@media (max-width: 560px) { .imsg-hero .hero-sim { --kT: calc(94cqw / 320); } }
/* no container units (Safari < 16, Firefox < 110): approximate the stage; JS sets the exact values */
@supports not (width: 1cqw) {
  .imsg-hero .hero-sim { --kT: calc(clamp(300px, max(32vw, min(360px, 100vw - 640px)), 480px) * .9 / 320); }
  @media (max-width: 900px) { .imsg-hero .hero-sim { --kT: calc(min(100vw - 96px, 400px) * .9 / 320); } }
  @media (max-width: 560px) { .imsg-hero .hero-sim { --kT: calc(min(100vw - 72px, 400px) * .94 / 320); } }
  @media (max-width: 480px) { .imsg-hero .hero-sim { --kT: calc(min(100vw - 40px, 400px) * .94 / 320); } }
}
/* iOS dark mode: the thread is black with #262629 received bubbles and the dark balloon blues. Shadows
   vanish on dark, so every edge is a hairline. */
[data-theme="dark"] .imsg-hero .hero-sim {
  --ios-bg: #000000; --ios-in: #262629; --ios-in-ink: #FFFFFF; --ios-meta: #8D8D92;
  --ios-dot: #5E5E63; --ios-dot-hi: #98989D; --blue-top: #409CFF; --blue-bot: #0091FF;
  --edge: 0 0 0 1px rgba(255, 255, 255, .14), 0 2px 6px rgba(0, 0, 0, .35);
  --plate: var(--edge), 0 28px 64px -12px rgba(0, 0, 0, .7);
}

/* the card: 320 pt wide, nearly the square's height, clipping its rows (a sent message rises from below its edge). Its shadow is
   the plate's, a still layer behind it: a shadow on the clipping, animated card was cut to the card's layer in Safari, and the
   area under the card flickered between lit and shadowed whenever a row's animation started or stopped. */
.hero-sim .hs-screen { position: absolute; inset: 0; isolation: isolate; }
.hero-sim :is(.hs-plate, .hs-chat) {
  position: absolute; left: 50%; top: calc(2 * var(--kT)); bottom: calc(2 * var(--kT)); width: calc(320 * var(--kT)); margin-left: calc(-160 * var(--kT));
  border-radius: calc(32 * var(--kT));
}
.hero-sim .hs-plate { box-shadow: var(--plate); }
.hero-sim .hs-chat { overflow: hidden; background: var(--ios-bg); color: var(--ios-in-ink); }
/* the thread under the header, as iOS lays it out: it starts under the header while it fits, and a thread taller than the card
   ends at the card's bottom edge with its top passing under the header (the header's fade covers it). Line breaks differ with
   the stage's width and the visitor's font, so no fixed card height holds every conversation; the layout must allow for it. */
.hero-sim .hs-chat { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.hero-sim .hs-chat > .hs-msgs { align-self: end; min-height: 100%; }
/* the thread's header is css/thread-head.css (.th-head), sized here: the iOS 26 pt value times .656, in --kT units, so the header scales
   with the card. .656 is the scenes' .74 at their 342 px panel, relative to this card's 320 pt width. */
.hero-sim .hs-chat { --hs-s: .656; --th-u: calc(var(--hs-s) * var(--kT)); --th-ink: var(--ios-in-ink); }

/* thread: the 320 pt Messages transcript under the header. Text keeps the 17 pt optical size (SF Text, not SF
   Display) at any stage size; JS sets --hs-track so lines break where they would at 17 pt. */
.hero-sim .hs-msgs {
  position: relative; isolation: isolate; box-sizing: border-box; width: 100%;
  padding: calc(32 * var(--th-u)) calc(16 * var(--kT)) calc(16 * var(--kT)) calc(15.83 * var(--kT));   /* the header's clearance (css/thread-head.css) */
  display: flex; flex-direction: column;
  font-size: calc(17 * var(--kT)); line-height: calc(20 * var(--kT)); font-weight: 400;
  font-variation-settings: "opsz" 17;
}
.hero-sim .hs-msgs > * { flex: none; margin: 0; }
.hero-sim .hs-msgs > * + * { margin-top: calc(10 * var(--kT)); }                 /* sender change, after a receipt */
.hero-sim .hs-msgs .chat-in + .chat-in, .hero-sim .hs-msgs .chat-out + .chat-out { margin-top: calc(4 * var(--kT)); }
.hero-sim .hs-msgs .hs-stamp + * { margin-top: 0; }
.hero-sim .hs-msgs .hs-receipt { margin-top: calc(6.1 * var(--kT)); }            /* cap-top 9 pt below the bubble */
.hero-sim .hs-stamp, .hero-sim .hs-receipt {                                     /* 11 / 13 pt, never under 9.5 px */
  font-size: max(9.5px, calc(11 * var(--kT))); line-height: max(11.2px, calc(13 * var(--kT))); color: var(--ios-meta);
  font-variation-settings: "opsz" 11; letter-spacing: var(--hs-track-meta, normal);  /* the caption's cut and spacing (JS) */
}
.hero-sim .hs-stamp { align-self: center; margin-bottom: calc(7.5 * var(--kT)); text-align: center; }
.hero-sim .hs-stamp b, .hero-sim .hs-receipt b { font-weight: 600; }
.hero-sim .hs-receipt { align-self: flex-end; margin-right: calc(21.2 * var(--kT)); }
.hero-sim .hs-msgs .chat-bubble {                                                 /* overrides the page's generic .chat-bubble */
  position: relative; z-index: 1; box-sizing: border-box;                            /* over any stamp or receipt it glides past */
  max-width: calc(223.4 * var(--kT));                                               /* 69.8 % of 320 pt */
  padding: calc(10.15 * var(--kT)) calc(13.5 * var(--kT)); border: 0; border-radius: calc(20.5 * var(--kT));
  font-size: inherit; line-height: inherit; letter-spacing: var(--hs-track, normal); box-shadow: none; overflow-wrap: break-word;
  text-wrap: pretty;                                                                /* no one-word last line in a wider fallback font */
}
.hero-sim .hs-msgs .chat-in { align-self: flex-start; background: var(--ios-in); color: var(--ios-in-ink); transform-origin: 0 100%; }
.hero-sim .hs-msgs .chat-out { align-self: flex-end; background: var(--fill, #0A8CFE); color: #fff; }
/* the iOS 26 hook tail is css/bubble-tail.css: one pt is --kT, and JS marks the last bubble of a run with .has-tail (data-bt="manual") */
.hero-sim .hs-msgs { --bt-u: var(--kT); }
/* typing indicator: css/typing.css owns the shape; the hero sets its size (35 pt) and where it sits */
.hero-sim .hs-msgs { --ty-size: calc(35 * var(--kT)); --ty-fill: var(--ios-in); --ty-dot: var(--ios-dot); --ty-dot-hi: var(--ios-dot-hi); }
.hero-sim .hs-msgs .chat-in + .ty { margin-top: calc(4 * var(--kT)); }
.hero-sim .hs-msgs > .ty { margin-bottom: calc(10 * var(--ty-u)); }                  /* the small circle's hang (the row reset above zeroes the margin) */
.hero-sim .hs-msgs .ty.is-ghost { position: absolute; z-index: -1; left: calc(15.83 * var(--kT)); margin: 0; }   /* out of flow and last in the thread, so no `* + X` margin rule ever sees it; under the message (the thread isolates) so its dots never print over the text */
.hero-sim .ty.is-ghost i { visibility: hidden; }                                  /* its dots never share a frame with the text */
/* tapback (css/tapback.css): the 34 pt badge, its room above the bubble 38 pt, measured in reactions.jpg */
.hero-sim .hs-msgs { --tb-size: calc(34 * var(--kT)); --tb-ring: var(--ios-bg); --tb-theirs: var(--ios-in); }

/* Phones and tablets: the headline (and its YC pill), then the phone-number form, then the square.
   The copy column dissolves into the hero's grid so its children can be ordered around it. */
@media (max-width: 900px) {
  .arc-concept .hero-with-sim .hero-copy { display: contents; }
  .arc-concept .hero-with-sim h1 { order: 1; }
  .arc-concept .hero-with-sim .demo-card { order: 2; margin-top: 0; }
  .imsg-hero .hero-rotator > * { justify-self: center; }
  .arc-concept .hero-with-sim .hero-sim { order: 3; }
}

/* Business hero (index.html, data-hero="business"): the inline script after the hero swaps the AI phrase and thread for the business ones before first paint; until it has, the two parts it changes stay hidden. */
html[data-hero="business"] .imsg-hero:not([data-hero-applied]) :is(.hero-copy h1, .hero-sim) { visibility: hidden; }
