/* hero — "Imagine having 7 conversations with one person. At the same time."
   The count rolls 1 → 7; each step names a thread in the phone's naming field
   and that thread springs out of it. Then all seven keep talking. */

.hero {
  position: relative;
  display: flex; flex-direction: column;
  padding: calc(var(--menubar-h) + clamp(40px, 7vh, 80px)) 0 0;
  text-align: center;
  overflow: hidden;
  --hw: clamp(236px, min(24vw, 39vh), 340px);   /* the phone's width */
}
/* wide: words, then the phone. Narrow: the headline, the phone, then the words. */
.hero-copy { order: 1; }
.hero-foot { order: 2; position: relative; z-index: 5; padding: 0 var(--gutter); }
.hero-stage { order: 3; }

/* ---------- copy ---------- */
.hero-copy { position: relative; z-index: 5; padding: 0 var(--gutter); }
.hero-kicker {
  font-size: clamp(19px, 1.75vw, 24px);
  font-weight: 600; letter-spacing: -0.016em; color: var(--ink);
  margin-bottom: clamp(6px, 1vh, 12px);
}
.hero-title {
  font-size: clamp(40px, min(5.4vw, 9.2vh), 88px);
  line-height: 1.04;
  letter-spacing: -0.028em;
  margin-bottom: clamp(14px, 2.4vh, 24px);
}
.hero-vis { display: block; }
.hero-line1, .hero-line2 { display: block; }
.hero-line2 { color: var(--coral); }
.hero-br { display: none; }
.hero-sr {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* the odometer: one tabular slot, a column of digits rolling through it */
.hero-n {
  position: relative; display: inline-block;
  font-variant-numeric: tabular-nums;
  clip-path: inset(0 -0.2em);
}
.hero-n-size { visibility: hidden; }
.hero-n-col {
  position: absolute; left: 0; right: 0; top: 0;
  display: flex; flex-direction: column; align-items: center;
  will-change: transform;
}
.hero-n-col > span { display: block; height: 1.04em; }
.hero-s { display: inline-block; transform-origin: 30% 85%; }
.hero-rest { display: inline-block; }

.hero-lede { max-width: 62ch; margin: 0 auto clamp(20px, 3.2vh, 32px); font-size: clamp(18px, 1.55vw, 22px); }
.hero-cta { display: flex; gap: 22px; justify-content: center; align-items: center; font-size: 17px; }
.hero-cta .soon { color: var(--muted); }
.hero-cta a.more { color: var(--coral); font-weight: 500; }
.hero-cta a.more::after { content: " ›"; }
.hero-cta a.more:hover { text-decoration: underline; text-underline-offset: 3px; }

/* the pre-count state, set in markup so the first paint is already "1" */
.hero-s, .hero-line2 { opacity: 0; }

/* ---------- stage: the phone and the threads around it ---------- */
.hero-stage {
  position: relative;
  display: flex; justify-content: center;
  margin-top: clamp(26px, 4vh, 44px);
  padding-bottom: clamp(48px, 9vh, 100px);
}
.hero .hero-phone .phone { --phone-w: var(--hw); }
.hero-phone { position: relative; z-index: 2; will-change: transform; }
.hero-threads { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

/* phone over white: the glass reads as white, so skip the backdrop filter */
.hero-phone .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255, 255, 255, 0.94); }

/* ---------- the real landing screen ---------- */
.landing-hero {
  position: absolute; left: 0; right: 0; top: calc(178 * var(--pt));
  display: flex; flex-direction: column; align-items: center;
}
.avatar {
  width: calc(108 * var(--pt)); height: calc(108 * var(--pt)); border-radius: 50%;
  background: linear-gradient(160deg, var(--coral), color-mix(in srgb, var(--coral) 72%, #fff));
  color: #fff; font-weight: 600; font-size: calc(50 * var(--pt));
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.12);
}
.landing-name {
  font-family: var(--serif); font-weight: 700; font-size: calc(40 * var(--pt));
  letter-spacing: -0.02em; margin: calc(10 * var(--pt)) 0 calc(18 * var(--pt));
}
.strip { display: flex; gap: calc(26 * var(--pt)); margin-bottom: calc(26 * var(--pt)); }
.strip-p { position: relative; display: flex; flex-direction: column; align-items: center; gap: calc(6 * var(--pt)); }
.strip-p i {
  width: calc(56 * var(--pt)); height: calc(56 * var(--pt)); border-radius: 50%;
  display: grid; place-items: center; font-style: normal; font-weight: 600; font-size: calc(24 * var(--pt));
  background: linear-gradient(160deg, var(--coral), color-mix(in srgb, var(--coral) 72%, #fff)); color: #fff;
}
.strip-p.add i { background: rgba(255, 255, 255, 0.7); color: #000; font-weight: 400; font-size: calc(30 * var(--pt)); }
.strip-p em { font-style: normal; font-size: calc(13 * var(--pt)); font-weight: 500; }
.strip-p b {
  position: absolute; top: calc(-4 * var(--pt)); right: calc(-6 * var(--pt));
  min-width: calc(22 * var(--pt)); height: calc(22 * var(--pt)); border-radius: 999px;
  background: #ff3b30; color: #fff; font-size: calc(13 * var(--pt)); display: grid; place-items: center;
  box-shadow: 0 0 0 calc(2 * var(--pt)) #fff;
}
.landing-field {
  width: calc(100% - 40 * var(--pt));
  height: calc(64 * var(--pt)); border-radius: 999px;
  display: flex; align-items: center; gap: calc(8 * var(--pt));
  padding: 0 calc(8 * var(--pt)) 0 calc(24 * var(--pt));
}
.landing-field .ph {
  flex: 1; position: relative; min-width: 0;
  font-family: var(--serif); font-size: calc(19 * var(--pt)); color: #b4b4b8;
  white-space: nowrap; overflow: hidden;
}
.landing-field .ph::before {
  content: ""; position: absolute; left: 0; top: 12%; bottom: 12%;
  width: calc(2.5 * var(--pt)); background: var(--coral); border-radius: 2px;
  animation: caret 1.1s steps(1) infinite;
}
.ph-t, .hero-fname { display: block; }
.hero-fname {
  position: absolute; left: 0; top: 0; color: #000;
  opacity: 0;
}
.landing-field.hero-naming .ph::before { opacity: 0; animation: none; }
.landing-field.hero-naming .ph-t { opacity: 0; }
.landing-field.hero-naming .hero-fname { opacity: 1; }
.landing-field .bolt, .landing-field .go {
  width: calc(42 * var(--pt)); height: calc(42 * var(--pt)); border-radius: 50%;
  display: grid; place-items: center; flex: none;
}
.landing-field .bolt { background: rgba(0, 0, 0, 0.06); }
.landing-field .go { background: #d1d1d6; transition: background-color 0.18s; }
.landing-field.hero-naming .go { background: var(--coral); }
.landing-field svg { width: 48%; height: 48%; }

/* ---------- a thread card ----------
   Sized by --k (set by hero.js from the window: 1 on a laptop, down to 0.8). */
.hero {
  --k: 1;
  --card-w: calc(252px * var(--k));
  --rh: calc(36px * var(--k));   /* one bubble row */
  --rg: calc(4px * var(--k));    /* between rows */
  --rows: 2;
}
.hero-th {
  position: absolute; left: 0; top: 0;
  width: var(--card-w);
  will-change: transform, opacity;
}
.hero-card {
  --pt: calc(0.86px * var(--k));
  background: #fff;
  border-radius: calc(24px * var(--k));
  padding: calc(12px * var(--k));
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.07),
    0 2px 6px rgba(0, 0, 0, 0.04),
    0 14px 36px rgba(0, 0, 0, 0.10);
  text-align: left;
  opacity: 0;
  will-change: transform, opacity;
}
.hero-card.on { opacity: 1; }
.hero-head {
  display: flex; align-items: center; gap: calc(8px * var(--k));
  margin: 0 calc(2px * var(--k)) calc(10px * var(--k));
  font-size: calc(15px * var(--k)); font-weight: 600; letter-spacing: -0.012em; line-height: calc(22px * var(--k));
  white-space: nowrap;
}
.hero-av {
  flex: none; width: calc(22px * var(--k)); height: calc(22px * var(--k)); border-radius: 50%;
  display: grid; place-items: center;
  background: var(--coral);
  color: #fff; font-size: calc(11px * var(--k)); font-weight: 600;
}
.hero-head b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.hero-badge {
  margin-left: auto; flex: none;
  min-width: calc(20px * var(--k)); height: calc(20px * var(--k)); padding: 0 calc(6px * var(--k)); border-radius: 999px;
  background: #ff3b30; color: #fff;
  font-size: calc(12px * var(--k)); font-weight: 600; line-height: calc(20px * var(--k)); text-align: center;
  font-variant-numeric: tabular-nums;
  transform: scale(0); opacity: 0;
  transition: transform 0.45s var(--spring), opacity 0.2s;
}
.hero-badge.on { transform: none; opacity: 1; }
.hero-win {
  position: relative;
  height: calc(var(--rows) * var(--rh) + (var(--rows) - 1) * var(--rg));
  overflow: hidden;
  margin: 0 calc(-12px * var(--k)); padding: 0 calc(12px * var(--k));   /* room for the hooks */
}
.hero-stack {
  position: absolute; left: calc(12px * var(--k)); right: calc(12px * var(--k)); bottom: 0;
  display: flex; flex-direction: column; gap: var(--rg);
  will-change: transform;
}
.hero-row { position: relative; height: var(--rh); flex: none; display: flex; align-items: flex-end; }
.hero-row.me { justify-content: flex-end; }
.hero-card .bub {
  height: var(--rh);
  max-width: 94%;
  font-size: calc(15px * var(--k)); line-height: calc(20px * var(--k)); letter-spacing: -0.012em;
  padding: calc(7px * var(--k)) calc(12px * var(--k)) calc(9px * var(--k));
  border-radius: calc(18px * var(--k));
  will-change: transform, opacity;
}
.hero-card .bub.them { border-bottom-left-radius: calc(5px * var(--k)); }
.hero-card .bub.me { border-bottom-right-radius: calc(5px * var(--k)); }
.hero-card .bub.nohook.them { border-bottom-left-radius: calc(18px * var(--k)); }
.hero-card .bub.nohook.me { border-bottom-right-radius: calc(18px * var(--k)); }
.hero-t { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-row.me .bub { transform-origin: 100% 100%; }
.hero-row.them .bub { transform-origin: 0 100%; }

/* typing */
.hero-dots { display: flex; align-items: center; gap: calc(4px * var(--k)); padding-left: calc(14px * var(--k)); padding-right: calc(14px * var(--k)); }
.hero-dots i {
  width: calc(7px * var(--k)); height: calc(7px * var(--k)); border-radius: 50%; background: #8e8e93;
  animation: hero-dot 1.2s ease-in-out infinite;
}
.hero-dots i:nth-child(2) { animation-delay: 0.16s; }
.hero-dots i:nth-child(3) { animation-delay: 0.32s; }
@keyframes hero-dot {
  0%, 60%, 100% { opacity: 0.35; transform: none; }
  30% { opacity: 1; transform: translateY(-2px); }
}

/* invisible ink: the words are not in the page at all, only the dust */
.hero-ink { width: calc(156px * var(--k)); position: relative; }
.hero-dust { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; }
.hero-dust::before, .hero-dust::after {
  content: ""; position: absolute; left: -100px; top: -52px; right: 0; bottom: 0;
  background: var(--dust) 0 0 / 96px 48px;
  animation: hero-dust-a 7s linear infinite;
}
.hero-dust::after {
  left: 0; top: 0; right: -76px; bottom: -40px;
  background-size: 72px 36px; background-position: 31px 17px;
  opacity: 0.75;
  animation-name: hero-dust-b; animation-duration: 5.5s;
}
/* whole-tile moves, so the loop has no seam */
@keyframes hero-dust-a { to { transform: translate(96px, 48px); } }
@keyframes hero-dust-b { to { transform: translate(-72px, -36px); } }

.hero-paused .hero-dots i,
.hero-paused .hero-dust::before,
.hero-paused .hero-dust::after,
.hero-paused .landing-field .ph::before { animation-play-state: paused; }

/* ---------- compact cards (phones, narrow windows) ---------- */
.hero.hero-compact {
  --card-w: 156px;
  --rh: 28px;
  --rg: 3px;
  --rows: 2;
}
.hero-compact .hero-card { --pt: 0.7px; border-radius: 18px; padding: 9px 9px 9px; }
.hero-compact .hero-head { font-size: 12.5px; line-height: 18px; gap: 6px; margin: 0 1px 7px; }
.hero-compact .hero-av { width: 18px; height: 18px; font-size: 9px; }
.hero-compact .hero-badge { min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; padding: 0 4px; }
.hero-compact .hero-win { margin: 0 -9px; padding: 0 9px; }
.hero-compact .hero-stack { left: 9px; right: 9px; }
.hero-compact .hero-card .bub { font-size: 12.5px; line-height: 16px; padding: 5px 10px 7px; border-radius: 14px; }
.hero-compact .hero-card .bub.them { border-bottom-left-radius: 4px; }
.hero-compact .hero-card .bub.me { border-bottom-right-radius: 4px; }
.hero-compact .hero-card .bub.nohook.them { border-bottom-left-radius: 14px; }
.hero-compact .hero-card .bub.nohook.me { border-bottom-right-radius: 14px; }
.hero-compact .hero-dots { gap: 3px; padding-left: 11px; padding-right: 11px; }
.hero-compact .hero-dots i { width: 5.5px; height: 5.5px; }
.hero-compact .hero-ink { width: 104px; }

/* ---------- entrance (the app's landing entrance: bouncy, things expand from nothing) ---------- */
.hero-kicker, .hero-title, .hero-lede, .hero-cta { animation: hero-up 1.1s var(--out) both; }
.hero-title { animation-delay: 0.06s; }
.hero-lede { animation-delay: 0.16s; }
.hero-cta { animation-delay: 0.24s; }
.hero-phone { animation: hero-up 1.25s var(--out) 0.22s both; }
.landing .topbar { animation: hero-drop 0.8s var(--out) 0.7s both; }
.landing .avatar { animation: hero-pop 0.8s var(--spring) 0.62s both; }
.landing .landing-name { animation: hero-up 0.8s var(--out) 0.74s both; }
.landing .strip { animation: hero-up 0.8s var(--out) 0.8s both; }
.landing .landing-field { animation: hero-up 0.9s var(--spring) 0.86s both; }
@keyframes hero-up { from { opacity: 0; transform: translateY(26px); } }
@keyframes hero-pop { from { opacity: 0; transform: scale(0.2); } }
@keyframes hero-drop { from { opacity: 0; transform: translateY(-14px); } }

/* ---------- narrow: the headline breaks after "conversations" ---------- */
@media (max-width: 640px) {
  .hero-br { display: inline; }
  .hero-title { font-size: clamp(34px, 10.2vw, 56px); margin-bottom: 0; }
  .hero-cta { flex-direction: column; gap: 8px; }
  .hero-lede { font-size: 18px; }
  /* the stage's height and the crop line (--crop) are set by hero.js under the last thread */
  .hero-stage { order: 2; margin-top: 30px; padding-bottom: 0; height: calc(var(--hw) * 2.0541 * 0.8); }
  .hero-foot { order: 3; padding-bottom: 56px; }
  /* the empty lower screen is cropped away, fading into the page */
  .hero-phone { --crop: 80%; clip-path: inset(-20px -20px calc(100% - var(--crop)) -20px); }
  .hero-phone::after {
    content: ""; position: absolute; left: -20px; right: -20px; top: calc(var(--crop) - 96px); height: 96px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), var(--page) 90%);
    z-index: 4; pointer-events: none;
  }
}

/* ---------- the end state, for reduced motion and if the script never ran ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero *, .hero-phone, .landing * { animation: none !important; }
  .hero-s, .hero-line2 { opacity: 1; }
  .hero-n-col { transform: translateY(-6.24em); }
}
.hero[data-failed] .hero-s, .hero[data-failed] .hero-line2 { opacity: 1; }
.hero[data-failed] .hero-n-col { transform: translateY(-6.24em); }
