/* ============================================================
   Slowfeed — hero phone mockup motion
   Three calm modes, driven by [data-anim] on .phone:
     off        — static calm feed (resting state)
     caughtup   — "The feed that ends": posts scroll up, ease to a
                  natural stop, "You're all caught up" fades in.
     filtered   — "The hooks filtered out": real posts stay; algorithmic
                  injections surface between them, then fade and the gap
                  closes, leaving only genuine posts.
   The BASE (non-animated) styles always describe a CALM, STATIC feed,
   so prefers-reduced-motion simply shows that with no motion.
   ============================================================ */

/* ---- screen body ---- */
.screen-body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.scroller {
  display: flex;
  flex-direction: column;
  padding: 16px 16px 0;
  will-change: transform;
}
.scroller > .post { margin-bottom: 18px; flex: none; }

/* ---- algorithmic injections (only animate in "filtered") ---- */
/* collapsed + invisible by default → absent from the calm feed */
.inj-wrap { overflow: hidden; max-height: 0; flex: none; }
.inj { opacity: 0; padding-bottom: 18px; }
.inj-reels { --ih: 84px; }
.inj-sug   { --ih: 116px; }
.inj-exp   { --ih: 200px; }

/* a faint "promoted" tag so injections read as not-your-posts */
.inj-tag {
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-bottom: 8px;
}

/* reels-style rings */
.rings { display: flex; gap: 11px; }
.ring {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  background: var(--bg-tint);
  border: 2px solid color-mix(in srgb, var(--accent) 42%, var(--divider));
}

/* "Suggested for you" card */
.sug-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px;
  border: 1px solid var(--divider);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 5%, var(--card));
}
.sug-thumb { width: 44px; height: 44px; border-radius: 10px; background: var(--bg-tint); border: 1px solid var(--divider); flex: none; }
.sug-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sug-line { height: 7px; border-radius: 4px; background: var(--divider); }
.sug-line--short { width: 52%; }
.sug-pill { width: 46px; height: 22px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 22%, var(--bg-tint)); flex: none; }

/* explore-style grid */
.explore { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.tile { aspect-ratio: 1; border-radius: 6px; background: var(--bg-tint); border: 1px solid var(--divider); }
.tile:nth-child(even) { background: color-mix(in srgb, var(--accent) 8%, var(--bg-tint)); }

/* ---- "You're all caught up" end marker (only shown in caughtup) ---- */
.caughtup {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 34px 16px 40px;
  text-align: center;
}
.cu-divider { width: 34px; height: 1px; background: var(--divider); }
.cu-check {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
}
.cu-check svg { width: 15px; height: 15px; }
.cu-text { color: var(--ink-2); font-size: 12px; letter-spacing: 0.01em; }
.cu-sub  { color: var(--ink-3); font-size: 10.5px; margin-top: -8px; }

[data-anim="caughtup"] .caughtup { display: flex; }

/* ---- bottom tab bar + post action icons (only in "tabs" mode) ---- */
.phone__screen { position: relative; }
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: none;
  align-items: center;
  height: 56px;
  padding: 0 30px;
  background: color-mix(in srgb, var(--card) 90%, transparent);
  border-top: 1px solid var(--divider);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transform-origin: center center;
  z-index: 5;
}
[data-anim="tabs"] .tabbar { display: flex; }
.tab {
  flex: 1 1 0; min-width: 0; overflow: hidden;
  display: grid; place-items: center;
  color: var(--ink-2);
}
.tab svg { width: 23px; height: 23px; }
/* calm end state: Explore + Reels are gone */
.tab--explore, .tab--reels { flex-grow: 0; opacity: 0; }

.post__actions { display: none; gap: 16px; margin-top: 5px; color: var(--ink-3); }
.post__actions svg { width: 19px; height: 19px; }
[data-anim="tabs"] .post__actions { display: flex; }

/* in tabs mode the feed is just a quiet backdrop; leave room for the bar */
[data-anim="tabs"] .scroller { padding-bottom: 60px; }

/* ============================================================
   Motion — only when the visitor hasn't asked to reduce it
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {

  /* ---------- THE FEED THAT ENDS ---------- */
  [data-anim="caughtup"] .scroller {
    /* unhurried scroll, smooth deceleration to a full stop — no bounce */
    animation: feedScroll 6.5s cubic-bezier(0.22, 1, 0.32, 1) 0.5s both;
  }
  @keyframes feedScroll {
    from { transform: translateY(0); }
    to   { transform: translateY(-700px); }
  }
  [data-anim="caughtup"] .caughtup {
    animation: caughtIn 1.3s var(--ease) 6.1s both;
  }
  @keyframes caughtIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* ---------- THE HOOKS FILTERED OUT ---------- */
  /* each injection: gap opens, it fades in, holds briefly, fades out,
     gap closes — looping, staggered so one surfaces at a time */
  [data-anim="filtered"] .inj-wrap { animation: injRows 12s var(--ease) infinite; }
  [data-anim="filtered"] .inj      { animation: injFade 12s var(--ease) infinite; }

  [data-anim="filtered"] .inj-sug      { animation-delay: -4s; }
  [data-anim="filtered"] .inj-sug .inj { animation-delay: -4s; }
  [data-anim="filtered"] .inj-exp      { animation-delay: -8s; }
  [data-anim="filtered"] .inj-exp .inj { animation-delay: -8s; }

  @keyframes injRows {
    0%   { max-height: 0; }
    5%   { max-height: var(--ih); }
    28%  { max-height: var(--ih); }
    34%  { max-height: 0; }
    100% { max-height: 0; }
  }
  @keyframes injFade {
    0%   { opacity: 0; }
    7%   { opacity: 0; }
    13%  { opacity: 1; }
    25%  { opacity: 1; }
    32%  { opacity: 0; }
    100% { opacity: 0; }
  }

  /* ---------- TWO BUTTONS REMOVED ---------- */
  /* auto-plays on load; zoom-in/reposition ease in/out, zoom-out decelerates */
  [data-anim="tabs"] .tabbar       { animation: tabZoom 4.5s 2s both; }
  [data-anim="tabs"] .scroller     { animation: feedRecede 4.5s 2s both; }
  [data-anim="tabs"] .tab--explore { animation: removeExplore 4.5s 2s both; }
  [data-anim="tabs"] .tab--reels   { animation: removeReels 4.5s 2s both; }

  @keyframes tabZoom {
    0%   { transform: translateY(0) scale(1);           animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
    32%  { transform: translateY(-228px) scale(1.34);   animation-timing-function: linear; }
    60%  { transform: translateY(-228px) scale(1.34);   animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
    88%  { transform: translateY(0) scale(1); }
    100% { transform: translateY(0) scale(1); }
  }
  @keyframes feedRecede {
    0%   { filter: blur(0px); opacity: 1;     animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
    32%  { filter: blur(7px); opacity: 0.4;   animation-timing-function: linear; }
    60%  { filter: blur(7px); opacity: 0.4;   animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1); }
    88%  { filter: blur(0px); opacity: 1; }
    100% { filter: blur(0px); opacity: 1; }
  }
  /* the two icons leave in a gentle cascade, each easing smoothly out */
  @keyframes removeExplore {
    0%        { flex-grow: 1; opacity: 1; }
    34%       { flex-grow: 1; opacity: 1; animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
    54%, 100% { flex-grow: 0; opacity: 0; }
  }
  @keyframes removeReels {
    0%        { flex-grow: 1; opacity: 1; }
    40%       { flex-grow: 1; opacity: 1; animation-timing-function: cubic-bezier(0.76, 0, 0.24, 1); }
    60%, 100% { flex-grow: 0; opacity: 0; }
  }
}
}
