/* ---------------------------------------------------------------------
   fx.css — the moving parts.

   send.css turns the volume up; this file makes things move: the chat in
   the hero, the bubbles drifting under it, the guessing game, the rewrite
   cards and the reveal-on-scroll. Everything here is decoration over a page
   that already reads correctly without it — with scripting off or reduced
   motion on, every component sits in its finished state.
   --------------------------------------------------------------------- */

:root {
  --bubble: #0a84ff;
  --bubble-grey: #e9e9eb;
  --bubble-grey-ink: #0a0a0b;
}
:root[data-theme="dark"] { --bubble-grey: #26252a; --bubble-grey-ink: #f2f2f4; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bubble-grey: #26252a; --bubble-grey-ink: #f2f2f4; }
}

/* ── REVEAL ON SCROLL ──────────────────────────────────────────────── */
/* Hidden only once fx.js has said it is there to show them again. */
.js .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1);
  transition-delay: var(--d, 0s);
}
.js .reveal.in { opacity: 1; transform: none; }

/* ── HERO LAYOUT ───────────────────────────────────────────────────── */

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}
.hero-loud .cta-row { margin-top: 30px; }

/* ── BUBBLES (shared) ──────────────────────────────────────────────── */

.bub {
  display: inline-block;
  max-width: 82%;
  padding: 10px 15px;
  border-radius: 20px;
  font-size: 16px;
  line-height: 1.32;
  letter-spacing: -0.01em;
  position: relative;
  word-wrap: break-word;
}
.bub.me { background: var(--bubble); color: #fff; border-bottom-right-radius: 6px; }
.bub.them { background: var(--bubble-grey); color: var(--bubble-grey-ink); border-bottom-left-radius: 6px; }

/* ── THE HERO CHAT ─────────────────────────────────────────────────── */

.chat-demo {
  position: relative;
  width: min(100%, 380px);
  margin-inline: auto;
  aspect-ratio: 380 / 560;
  border-radius: 44px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  box-shadow: 0 40px 90px -30px rgba(35, 64, 255, 0.35), 0 10px 30px -12px rgba(0,0,0,.25);
  overflow: hidden;
  isolation: isolate;
}
.chat-head {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 22px 0 14px;
  border-bottom: 1px solid var(--hairline);
  font-size: 12px; color: var(--ink-2);
}
.chat-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, #ffb37a, #ff6fa1);
}
.chat-name { font-weight: 600; color: var(--ink); font-size: 13px; }
.chat-body {
  position: absolute; left: 0; right: 0; bottom: 74px; top: 96px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 8px;
  padding: 0 16px;
}
.chat-body .row { display: flex; }
.chat-body .row.me { justify-content: flex-end; }
.chat-old { opacity: .55; }
.chat-draft { min-height: 1.3em; transition: opacity .35s, transform .35s; }
.chat-draft .ph { border-radius: 4px; transition: background .4s, box-shadow .4s; }
.chat-demo.judged .chat-draft .ph { background: rgba(206, 50, 50, .9); box-shadow: 0 0 0 2px rgba(206,50,50,.9); }
.caret { display: inline-block; width: 2px; height: 1.05em; background: currentColor; vertical-align: -0.15em; margin-left: 1px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.chat-input {
  position: absolute; left: 14px; right: 14px; bottom: 16px;
  height: 42px; border-radius: 21px; border: 1px solid var(--hairline);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px 0 16px; font-size: 14px; color: var(--ink-3);
}
.chat-send {
  width: 30px; height: 30px; border-radius: 50%; background: var(--bubble);
  display: grid; place-items: center;
}
.chat-send svg { width: 14px; height: 14px; }

.chat-stamp {
  position: absolute; left: 50%; top: 42%;
  transform: translate(-50%, -50%) rotate(-7deg) scale(2.4);
  opacity: 0; z-index: 3; pointer-events: none;
  font-size: 34px;
  transition: none;
}
.chat-stamp.on {
  opacity: 1;
  transform: translate(-50%, -50%) rotate(-7deg) scale(1);
  transition: transform .42s cubic-bezier(.3,1.6,.5,1), opacity .12s;
}
.chat-chip {
  position: absolute; left: 50%; top: calc(42% + 46px); z-index: 3;
  transform: translate(-50%, 10px); opacity: 0;
  background: var(--ink); color: var(--canvas);
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
  transition: opacity .3s .25s, transform .3s .25s;
}
.chat-chip.on { opacity: 1; transform: translate(-50%, 0); }
.chat-demo.shake { animation: shake .4s; }
@keyframes shake {
  20% { transform: translateX(-6px) rotate(-.6deg); }
  40% { transform: translateX(5px) rotate(.5deg); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.chat-reply { opacity: 0; transform: translateY(10px) scale(.96); transform-origin: left bottom; transition: opacity .35s, transform .45s cubic-bezier(.3,1.5,.5,1); }
.chat-reply.on { opacity: 1; transform: none; }
.typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: dot 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.style-tag {
  display: inline-block; margin: 0 0 4px auto;
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand); opacity: 0; transition: opacity .3s;
}
.style-tag.on { opacity: 1; }

/* ── BUBBLE MARQUEE ────────────────────────────────────────────────── */

.marquee {
  overflow: hidden;
  padding: 26px 0 30px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-row {
  display: flex; gap: 14px; width: max-content;
  animation: drift var(--speed, 60s) linear infinite;
  padding: 7px 0;
}
.marquee-row.rev { animation-direction: reverse; }
.marquee:hover .marquee-row { animation-play-state: paused; }
@keyframes drift { to { transform: translateX(-50%); } }
.mq { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.mq .bub { max-width: none; font-size: 15px; }
.mini {
  font-family: var(--display); font-weight: 900; font-stretch: condensed;
  font-size: 13px; letter-spacing: .02em; color: #fff;
  padding: 4px 9px; border-radius: 999px; transform: rotate(-4deg);
  background: var(--dont);
}
.mini.go { background: var(--send); }

/* ── THE STAMP, bigger variants ───────────────────────────────────── */

.stamp.sm { font-size: clamp(22px, 3.6vw, 32px); box-shadow: 0 14px 30px rgba(206, 50, 50, .28); }
.stamp.sm.go { box-shadow: 0 14px 30px rgba(14, 143, 77, .28); }
.stamp.ink { background: var(--ink); color: var(--canvas); box-shadow: 0 14px 30px rgba(0,0,0,.2); }

/* ── GUESS GAME ────────────────────────────────────────────────────── */

.game {
  position: relative;
  max-width: 560px;
  margin: clamp(26px, 4vw, 40px) auto 0;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: 32px;
  padding: clamp(22px, 4vw, 34px);
  overflow: hidden;
}
.game-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--ink-2); margin-bottom: 18px; }
.game-meta b { color: var(--ink); font-weight: 700; }
.game-thread { display: flex; justify-content: flex-end; min-height: 92px; align-items: flex-end; }
.game-thread .bub { font-size: 18px; max-width: 92%; animation: pop .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.94); } }
.game-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 24px; }
.game-btn {
  appearance: none; border: 0; cursor: pointer;
  font-family: var(--display); font-weight: 900; font-stretch: condensed;
  font-size: 24px; letter-spacing: -.01em; color: #fff;
  border-radius: 999px; padding: 15px 10px;
  transition: transform .15s, filter .15s;
}
.game-btn:hover { transform: translateY(-2px); filter: brightness(1.08); }
.game-btn:active { transform: scale(.97); }
.game-btn:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.game-btn.go { background: var(--send); }
.game-btn.no { background: var(--dont); }
.game-result { text-align: center; margin-top: 22px; }
.game-result[hidden] { display: none; }
.game-result .stamp { animation: slam .45s cubic-bezier(.3,1.6,.5,1); }
@keyframes slam { from { transform: rotate(-3deg) scale(2.2); opacity: 0; } }
.game-why { margin: 18px auto 4px; max-width: 42ch; color: var(--ink-2); }
.game-you { font-weight: 700; font-size: 15px; margin: 0 0 14px; }
.game-you.right { color: var(--send); }
.game-you.wrong { color: var(--dont); }
.game-next {
  appearance: none; cursor: pointer; border: 1px solid var(--hairline);
  background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 11px 22px; font: inherit; font-weight: 600; font-size: 15px;
}
.game-next:hover { border-color: var(--ink-2); }
.game-dots { display: flex; gap: 6px; justify-content: center; margin-top: 22px; }
.game-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); transition: background .3s, transform .3s; }
.game-dots i.right { background: var(--send); }
.game-dots i.wrong { background: var(--dont); }
.game-dots i.now { transform: scale(1.4); background: var(--ink-2); }
.game-end { text-align: center; }
.game-end .score {
  font-family: var(--display); font-weight: 900; font-stretch: condensed;
  font-size: clamp(64px, 14vw, 120px); line-height: .9; letter-spacing: -.04em; margin: 4px 0 10px;
}
.game-end .cta-row { justify-content: center; }

/* ── REWRITE CARDS ─────────────────────────────────────────────────── */

.rw-stack { display: grid; gap: 10px; max-width: 380px; margin-inline: auto; width: 100%; }
.rw-card {
  background: var(--canvas); border: 1px solid var(--hairline); border-radius: 20px;
  padding: 14px 16px; transition: border-color .35s, box-shadow .35s, transform .35s;
}
.section-muted .rw-card { background: var(--canvas); }
.rw-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rw-pill {
  background: var(--brand); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding: 4px 9px;
}
.rw-copy { margin-left: auto; font-size: 13px; font-weight: 600; color: var(--brand); }
.rw-text { font-size: 16px; line-height: 1.35; }
.rw-card.hot { border-color: var(--brand); box-shadow: 0 16px 36px -14px rgba(35,64,255,.45); transform: scale(1.025); }
.rw-card.hot .rw-copy::after { content: " ✓"; }

/* ── SHARE MODES ───────────────────────────────────────────────────── */

.share-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(14px, 2.4vw, 24px); }
@media (max-width: 820px) { .share-grid { grid-template-columns: 1fr; } }
.share-card { background: var(--canvas); border: 1px solid var(--hairline); border-radius: 28px; padding: 18px 18px 22px; }
.share-card h3 { margin: 16px 0 6px; }
.share-card p { color: var(--ink-2); margin: 0; font-size: 15px; }
.share-vis {
  position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden;
  display: grid; place-items: center; text-align: center;
  background: linear-gradient(160deg, #3d5bff, #1a2fd6);
  color: #fff;
}
.share-vis .q { font-size: 15px; opacity: .9; margin-bottom: 12px; padding: 0 18px; }
.share-vis .stamp { font-size: 26px; }
.share-vis.guess { background: linear-gradient(160deg, #101013, #2a2a33); }
.share-vis.guess .stamp { animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) scale(1.04); } }
.share-vis.selfie { background: radial-gradient(60% 60% at 50% 38%, #ffd2a8, #e7807a 60%, #6c3a7c); }
.share-vis.selfie .face { font-size: 76px; line-height: 1; filter: drop-shadow(0 8px 14px rgba(0,0,0,.25)); }
.share-vis.selfie .stamp { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%) rotate(-5deg); font-size: 22px; }

.from-messages {
  margin-top: clamp(22px, 3vw, 30px);
  display: flex; gap: 14px; align-items: center;
  border: 1px dashed var(--hairline); border-radius: 22px; padding: 16px 18px;
  color: var(--ink-2); font-size: 15px;
}
.from-messages b { color: var(--ink); }
.from-messages .ico { font-size: 26px; }

/* ── TYPES: a little life ──────────────────────────────────────────── */

@media (prefers-reduced-motion: no-preference) {
  .types .pin { animation: bob 5s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -0.37s); }
  .type:hover .pin { animation-play-state: paused; }
}
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -6px; } }
.unlock-note {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(124, 58, 237, .12); color: var(--accent-cell);
  border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px;
}

/* ── CLOSE ─────────────────────────────────────────────────────────── */

.section-close .stamp { margin-bottom: 26px; }
.badge img { height: 52px; }

@media (prefers-reduced-motion: reduce) {
  .marquee-row { animation: none; }
  .js .reveal { opacity: 1; transform: none; }
}

/* Beside the chat the headline has half the width it was sized for. */
@media (min-width: 901px) {
  .hero-grid h1 { font-size: clamp(64px, 8.4vw, 116px); }
}
.loud { text-wrap: balance; }
.share-vis .q { opacity: 1; font-weight: 600; }
.share-card .share-vis .q { color: #fff; }
@media (max-width: 900px) { .chat-demo { aspect-ratio: 380 / 470; } }

/* ── HISTORY MOCK ──────────────────────────────────────────────────── */
.share-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 820px) { .share-grid { grid-template-columns: 1fr; } }
.history-mock {
  background: var(--canvas); border: 1px solid var(--hairline); border-radius: 22px;
  padding: 14px 18px 18px; max-width: 380px; width: 100%; margin-inline: auto;
}
.hm-day { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin: 10px 0 6px; }
.hm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 15px; }
.hm-row:last-child { border-bottom: 0; }
.hm-row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-row .mini { flex: none; transform: none; }
