/* The phone floats over the left of the brain slide. At rest the brain is framed in the space to
   its right (brain.js reads the phone's edge); close-ups may pass underneath it. */
.funnel { position: relative; height: min(80vh, 680px); padding: 24px; }
html.is-presenting .funnel { position: absolute; z-index: 2; top: var(--header-height); bottom: clamp(84px, 12vh, 110px); left: var(--gutter); width: min(34%, 400px); height: auto; padding: 24px 0 0; pointer-events: none; }
.phone-fit { position: relative; height: 100%; }

/* The phone is drawn at 300 × 650 and scaled by phone.js to fit, left-aligned in its box. */
.phone {
  --phone-scale: 1;
  position: absolute;
  left: 0;
  top: 50%;
  width: 300px;
  height: 650px;
  padding: 10px;
  border-radius: 52px;
  background: #1a1a1a;
  box-shadow: inset 0 0 0 1.5px #3a3a3a, 0 30px 80px rgba(0, 0, 0, .6);
  /* Scaled from its left edge, so that edge stays on the site's gutter line. */
  transform: translateY(-50%) scale(var(--phone-scale));
  transform-origin: 0 50%;
}
.phone-screen { position: relative; height: 100%; border-radius: 42px; overflow: hidden; background: #050505; }
.phone-island { position: absolute; left: 50%; top: 11px; z-index: 1; width: 92px; height: 28px; border-radius: 20px; background: #000; transform: translateX(-50%); }
.phone-home { position: absolute; left: 50%; bottom: 8px; z-index: 1; width: 110px; height: 4px; border-radius: 3px; background: rgba(244, 244, 244, .7); transform: translateX(-50%); }


/* Buying-mood meter, just outside the phone's top-right corner (scaled with the phone). */
.intent { position: absolute; left: calc(100% + 18px); top: 18px; width: 150px; color: var(--ink); }
/* While the narration explains the meter, it lights up. */
.intent-title, .intent-bar { transition: color .4s ease, box-shadow .4s ease; }
.intent.is-explained .intent-title { color: var(--ink); }
.intent.is-explained .intent-bar { box-shadow: 0 0 0 3px rgba(244, 244, 244, .16); }
.intent-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.intent-value { margin-top: 4px; font-size: 34px; font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; transition: color .4s ease; }
.intent-feeling { margin-top: 4px; font-size: 13px; color: #cfcfcf; transition: color .4s ease; }
.intent[data-mood="drop"] .intent-feeling { color: #ff8a8a; }
.intent[data-mood="fight"] .intent-feeling { color: #f5d276; }
.intent[data-mood="won"] .intent-feeling { color: #5ee08f; }
.intent-bar { margin-top: 10px; height: 4px; border-radius: 2px; background: #262626; overflow: hidden; }
.intent-bar span { display: block; height: 100%; width: 3%; border-radius: inherit; background: var(--ink); transition: background-color .4s ease; }
.intent-ends { display: flex; justify-content: space-between; margin-top: 6px; font-size: 11px; color: var(--muted); }
/* The price lands: a red flash. */
.intent[data-mood="drop"] .intent-value { animation: intent-drop 1.2s ease; }
.intent[data-mood="drop"] .intent-bar span { animation: intent-drop-bar 1.2s ease; }
@keyframes intent-drop { 0%, 40% { color: #ff6b6b; } }
@keyframes intent-drop-bar { 0%, 40% { background: #ff6b6b; } }
/* Buy or leave: tension. */
.intent[data-mood="fight"] .intent-value { color: #f5d276; }
.intent[data-mood="fight"] .intent-bar span { background: #f5d276; }
/* Wanting wins. */
.intent[data-mood="won"] .intent-value, .intent[data-mood="won"] #intent-buy { color: #5ee08f; }
.intent[data-mood="won"] .intent-bar span { background: #5ee08f; box-shadow: 0 0 12px rgba(94, 224, 143, .6); }
.intent[data-mood="won"] .intent-value { animation: intent-win .6s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes intent-win { 50% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .intent .intent-value, .intent .intent-bar span { animation: none !important; }
}

/* Staged entrance of the brain section: phone, then mood meter, then brain and its sources. */
html[data-staging] .phone { animation: stage-rise .7s ease-out both; }
html[data-staging] .intent { animation: stage-rise .6s ease-out .8s both; }
html[data-staging] .brain-stage, html[data-staging] .sources { animation: stage-fade .9s ease-out 1.6s both; }
@keyframes stage-rise { from { opacity: 0; translate: 0 14px; } }
@keyframes stage-fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  html[data-staging] .phone, html[data-staging] .intent, html[data-staging] .brain-stage, html[data-staging] .sources { animation: none; }
}
