/* Home page motion. Transform and opacity only. Every start state is scoped to html.js and to
   playing scenes (.is-play), so with JS off or reduced motion the final frame simply shows. */

/* ---------- Living backdrop ---------- */
@keyframes hm-drift-a { to { transform: translate3d(90px, 60px, 0) scale(1.08); } }
@keyframes hm-drift-b { to { transform: translate3d(-80px, 70px, 0) scale(.94); } }
@keyframes hm-drift-c { to { transform: translate3d(-60px, -40px, 0) scale(1.1); } }
@keyframes hm-drift-d { to { transform: translate3d(70px, -50px, 0); } }
@keyframes hm-dots { to { transform: translate3d(0, -26px, 0); } }
.hm-sky__a { animation: hm-drift-a 34s ease-in-out infinite alternate; }
.hm-sky__b { animation: hm-drift-b 40s ease-in-out infinite alternate; }
.hm-sky__c { animation: hm-drift-c 46s ease-in-out infinite alternate; }
.hm-sky__d { animation: hm-drift-d 38s ease-in-out infinite alternate; }
.hm-sky__dots { animation: hm-dots 14s linear infinite; }

/* ---------- Hero entrance ---------- */
@keyframes hm-word { from { opacity: 0; transform: translateY(.45em); } }
@keyframes hm-fade-up { from { opacity: 0; transform: translateY(16px); } }
@keyframes hm-bloom { from { opacity: 0; transform: scale(.85); } }
/* Hero never sits empty: words start at once, everything is in place by about 900 ms. */
.hm-hero__title.is-split .hm-word { display: inline-block; animation: hm-word .5s var(--b2-ease) both; animation-delay: calc(var(--i) * 34ms); }
.js .hm-hero__lede { animation: hm-fade-up .5s var(--b2-ease) .2s both; }
.js .hm-askwrap { animation: hm-fade-up .55s var(--b2-ease) .3s both; }
.js .hm-askwrap::before { animation: hm-bloom 1.2s var(--b2-ease) .45s both; }
.js .hm-chips { animation: hm-fade-up .5s var(--b2-ease) .4s both; }
.is-instant .hm-word, .is-instant .hm-hero__lede, .is-instant .hm-askwrap, .is-instant .hm-askwrap::before, .is-instant .hm-chips { animation: none !important; }

/* Language popover drops down softly */
.hm-lang { transition: opacity .25s var(--b2-ease), transform .35s var(--b2-ease); }
.hm-lang__opt { transition: opacity .3s var(--b2-ease), transform .35s var(--b2-ease), background-color .2s; }
@starting-style {
  .hm-lang:popover-open { opacity: 0; transform: translateY(-8px) scale(.98); }
  .hm-lang:popover-open .hm-lang__opt { opacity: 0; transform: translateY(-4px); }
}
.hm-lang__opt:nth-of-type(2) { transition-delay: 40ms; } .hm-lang__opt:nth-of-type(3) { transition-delay: 80ms; }

/* Hero window rises and scales up as it scrolls in (scroll linked where supported). */
@keyframes hm-win-in { from { opacity: .4; transform: translateY(70px) scale(.93); } to { opacity: 1; transform: none; } }
@keyframes hm-float-y { from { transform: translateY(var(--hm-d)); } to { transform: translateY(calc(var(--hm-d) * -1)); } }
.hm-float--rem { --hm-d: 60px; } .hm-float--src { --hm-d: 30px; } .hm-float--voice { --hm-d: 90px; }
@supports (animation-timeline: view()) {
  .js .hm-stage.hm-scrollin { animation: hm-win-in linear both; animation-timeline: view(); animation-range: entry 0% cover 35%; }
  .js .hm-float { animation: hm-float-y linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
}
@supports not (animation-timeline: view()) {
  .hm-scrollin { transition: opacity 1s var(--b2-ease), transform 1.2s var(--b2-ease); }
  .js .hm-scrollin:not(.is-in) { opacity: 0; transform: translateY(60px) scale(.95); }
}

/* Headline underline draws itself in on reveal. */
.hm-mark__line path { stroke-dasharray: 1 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1s var(--b2-ease) .45s; }
.js .b2-rise:not(.is-in) .hm-mark__line path { stroke-dashoffset: 1; }

/* ---------- Scenes ---------- */
.hm-sc [data-s] { transition: opacity .5s var(--b2-ease), transform .6s var(--b2-ease); }
.hm-sc.is-play [data-s]:not([data-s="tick"]):not(.is-on) { opacity: 0; transform: translateY(10px); }
.hm-sc.is-play .hm-m--you[data-s]:not(.is-on) { transform: translateY(46px) scale(.97); }
.hm-sc.is-play .hm-src[data-s]:not(.is-on) { transform: translateX(-14px); }
.hm-sc.is-play .hm-rem[data-s]:not(.is-on) { transform: translateY(-22px) scale(.96); }
.hm-sc.is-play .hm-rem.is-on { transition: opacity .4s, transform .7s cubic-bezier(.3, 1.5, .5, 1); }
.hm-sc.is-play .hm-canvas[data-s]:not(.is-on) { transform: translateX(40px); }
.hm-sc.is-play .hm-bill[data-s]:not(.is-on) { transform: translateY(16px) rotate(-4deg); }
.hm-sc.is-play [data-s="stream"] .hm-w { transition: opacity .35s ease; }
.hm-sc.is-play [data-s="stream"] .hm-w:not(.is-on) { opacity: 0; }
.hm-sc.is-play [data-s="rows"] > tbody > tr, .hm-sc.is-play [data-s="rows"] > li { transition: opacity .45s var(--b2-ease), transform .5s var(--b2-ease); }
.hm-sc.is-play [data-s="rows"] > tbody > tr:not(.is-on), .hm-sc.is-play [data-s="rows"] > li:not(.is-on) { opacity: 0; transform: translateY(8px); }
.hm-sc.is-play .hm-tick[data-s] { transition: background-color .3s, border-color .3s, transform .4s cubic-bezier(.3, 1.6, .5, 1); }
.hm-sc.is-play .hm-tick[data-s]:not(.is-on) { background: transparent; border-color: var(--b2-line-strong); }
.hm-sc.is-play .hm-tick[data-s]:not(.is-on)::after { opacity: 0; }
.hm-sc.is-play .hm-tick[data-s].is-on { transform: scale(1.15); }
.hm-sc.is-fade [data-s].is-on { opacity: 0; transition: opacity .4s; }
.hm-sc.is-play .hm-bill:not(.is-done) .hm-bill__bad { background: transparent; }
.hm-bill__bad { transition: background-color .5s; }

/* Thinking dots */
@keyframes hm-pulse { 0%, 100% { transform: translateY(0); opacity: .45; } 40% { transform: translateY(-3px); opacity: 1; } }
.hm-think.is-on { opacity: 1; transform: none; }
.hm-think.is-on i { animation: hm-pulse 1s ease-in-out infinite; }
.hm-think.is-on i:nth-child(2) { animation-delay: .15s; }
.hm-think.is-on i:nth-child(3) { animation-delay: .3s; }

/* Composer typing and send press */
@keyframes hm-caret { 50% { opacity: 0; } }
.hm-cmp__t.is-typing { color: var(--b2-ink); }
.hm-cmp__t.is-typing::after { content: ""; display: inline-block; width: 1.5px; height: 1.1em; margin-left: 1px; vertical-align: -.2em; background: var(--b2-berry); animation: hm-caret 1s steps(1) infinite; }
.hm-cmp__send { transition: transform .15s var(--b2-ease); }
.hm-cmp__send.is-press { transform: scale(.82); }

/* Voice note playing: the coloured bars sweep across, the plain ones bounce */
@keyframes hm-bar { 50% { transform: scaleY(.45); } }
.hm-wave__on { transform: translateX(0); }
.hm-wave__on > span { transform: translateX(0); }
.hm-sc.is-play [data-s="voice"]:not(.is-done) .hm-wave__on { transform: translateX(-100%); }
.hm-sc.is-play [data-s="voice"]:not(.is-done) .hm-wave__on > span { transform: translateX(100%); }
.hm-sc.is-play [data-s="voice"].is-on .hm-wave__on, .hm-sc.is-play [data-s="voice"].is-on .hm-wave__on > span { transform: translateX(0); transition: transform 1.9s linear; }
.hm-sc.is-play [data-s="voice"].is-on:not(.is-done) .hm-wave i { animation: hm-bar .5s ease-in-out infinite; }
.hm-sc.is-play [data-s="voice"].is-on:not(.is-done) .hm-wave i:nth-child(2n) { animation-delay: .12s; }
.hm-sc.is-play [data-s="voice"].is-on:not(.is-done) .hm-wave i:nth-child(3n) { animation-delay: .25s; }

/* Bill scan: a light line sweeps down */
@keyframes hm-scan { 0% { opacity: 0; transform: translateY(-100%); } 12% { opacity: 1; } 88% { opacity: 1; } 100% { opacity: 0; transform: translateY(0); } }
.hm-sc.is-play .hm-bill.is-on:not(.is-done) .hm-bill__beam { animation: hm-scan 1.8s ease-in-out .15s both; }

/* Story stage cross fade */
.hm-story.is-pinned .hm-story__stage > .hm-sc { opacity: 0; transform: scale(.975) translateY(12px); transition: opacity .6s var(--b2-ease), transform .8s var(--b2-ease); pointer-events: none; }
.hm-story.is-pinned .hm-story__stage > .hm-sc.is-shown { opacity: 1; transform: none; }
.hm-story.is-pinned .hm-step__copy { transition: opacity .5s var(--b2-ease), transform .6s var(--b2-ease); }
.hm-story.is-pinned .hm-step:not(.is-active) .hm-step__copy { opacity: .32; transform: translateX(6px); }

/* Work tabs progress line */
@keyframes hm-fill { to { transform: scaleX(1); } }
.hm-work.is-tabbed .hm-tab[aria-selected="true"] .hm-tab__fill { animation: hm-fill 11s linear forwards; }
.hm-work:hover .hm-tab__fill, .hm-work:focus-within .hm-tab__fill, .hm-work.is-off .hm-tab__fill { animation-play-state: paused; }
.hm-panel:not([hidden]) .hm-sc { animation: hm-fade-up .5s var(--b2-ease) both; }

/* Modes: the fruit gives a small spring bounce on hover */
@keyframes hm-boing { 0% { transform: none; } 30% { transform: translateY(-8px) scale(1.06, .95); } 55% { transform: translateY(0) scale(.96, 1.05); } 75% { transform: translateY(-3px); } 100% { transform: none; } }
.hm-mode:hover .hm-fruit { animation: hm-boing .7s cubic-bezier(.3, 1.4, .5, 1); }

/* Helpers marquee */
@keyframes hm-marq { to { transform: translateX(-50%); } }
.hm-marq__track { animation: hm-marq 80s linear infinite; }
.hm-marq__row--rev .hm-marq__track { animation-direction: reverse; animation-duration: 95s; }
.hm-marq:hover .hm-marq__track { animation-play-state: paused; }

/* Privacy icons draw in */
.hm-ico__draw { stroke-dasharray: 1 1; stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s var(--b2-ease) .2s; }
.hm-ico__drop, .hm-ico__dot, .hm-ico__shackle, .hm-ico__eraser { transition: transform .9s cubic-bezier(.3, 1.4, .5, 1) .5s, opacity .5s .5s; }
.hm-ico__ink { stroke-dasharray: 1 1; stroke-dashoffset: -.62; transition: stroke-dashoffset 1.4s var(--b2-ease) .5s; }
.hm-ico__eraser { transform: translateX(30px); transition-duration: 1.4s; transition-timing-function: var(--b2-ease); }
.js .hm-trust .b2-rise:not(.is-in) .hm-ico__draw, .js .hm-trust .b2-rise:not(.is-in) .hm-ico__draw { stroke-dashoffset: 1; }
.js .hm-trust .b2-rise:not(.is-in) .hm-ico__drop { transform: translateY(-16px); opacity: 0; }
.js .hm-trust .b2-rise:not(.is-in) .hm-ico__shackle { transform: translateY(-7px); }
.js .hm-trust .b2-rise:not(.is-in) .hm-ico__ink { stroke-dashoffset: 0; }
.js .hm-trust .b2-rise:not(.is-in) .hm-ico__eraser { transform: translateX(-4px); }

/* Mobile menu sheet slides down, links stagger in */
.hm-menu { transition: transform .35s var(--b2-ease), opacity .3s; }
.hm-menu a { transition: transform .4s var(--b2-ease), opacity .4s; }
@starting-style {
  .hm-menu:popover-open { transform: translateY(-12px); opacity: 0; }
  .hm-menu:popover-open a { transform: translateY(-8px); opacity: 0; }
}
.hm-menu a:nth-child(2) { transition-delay: 30ms; } .hm-menu a:nth-child(3) { transition-delay: 60ms; }
.hm-menu a:nth-child(4) { transition-delay: 90ms; } .hm-menu a:nth-child(5) { transition-delay: 120ms; }
.hm-menu a:nth-child(6) { transition-delay: 150ms; }

/* ---------- Reduced motion and ?still: everything static, final frames ---------- */
@media (prefers-reduced-motion: reduce) {
  .hm-sky i, .hm-marq__track, .hm-think i, .hm-fruit, .hm-panel .hm-sc, .js .hm-hero__lede, .js .hm-askwrap, .js .hm-askwrap::before, .js .hm-chips, .js .hm-stage, .js .hm-float { animation: none !important; }
  .hm-sc [data-s], .hm-story.is-pinned .hm-story__stage > .hm-sc, .hm-story.is-pinned .hm-step__copy, .hm-mark__line path, .hm-ico__draw, .hm-ico__drop, .hm-ico__dot, .hm-ico__shackle, .hm-ico__eraser, .hm-ico__ink, .hm-menu, .hm-menu a, .hm-lang, .hm-lang__opt, .hm-story__rail i { transition: none !important; }
  .hm-story.is-pinned .hm-step:not(.is-active) .hm-step__copy { transform: none; }
  .hm-tab__fill { display: none; }
}
.is-still .hm-sky i, .is-still .hm-marq__track, .is-still .js .hm-hero__lede, .is-still .hm-panel .hm-sc { animation: none !important; }
.is-still .hm-hero__lede, .is-still .hm-askwrap, .is-still .hm-askwrap::before, .is-still .hm-chips, .is-still .hm-stage, .is-still .hm-float { animation: none !important; }
.is-still .hm-tab__fill { display: none; }
