/* Scroll motion. Scroll moves the camera; time moves the UI.
   - The camera (js/site.js): each window comes in with one small tilt, rotateX only, and lies flat before its story
     starts. site.js writes its transform from a smoothed scroll position and sets exactly `transform: none` at rest, so
     the text is drawn flat and sharp.
   - The beats: when scroll crosses a beat, site.js adds the class b1, b2, ... to the scene; each change below is a CSS
     transition at the app's own speed. Scrolling back removes the class and the transition plays in reverse.
   Without the .m class (reduced motion, ?still, no script) none of these rules apply: every scene shows its end state,
   flat, and nothing is pinned. */
:root {
  --ease-standard: cubic-bezier(.2, 0, 0, 1);
  --ease-emph: cubic-bezier(.2, .8, .2, 1);
}

/* layout is measured with every layer at rest (site.js, on resize only) */
.measuring .shot, .measuring .copy > *, .measuring .cap { transform: none !important; }
/* a forced state (hbMotion.force, a jump on load) lands at once, with no transitions */
.snap *, .snap *::before, .snap *::after { transition: none !important; }

.m .stage { perspective: 2000px; }
.m .moving .shot { will-change: transform, opacity; }

/* the reader for another thread, over the artboard's reader (site.js): it cross-fades in */
.m .rv { transition: opacity .08s var(--ease-out-quart); }
.m .rv.on { transition: opacity .12s var(--ease-out-quart) .08s; }

/* ---------- hero: a new message arrives as the top row, unread; then it is opened ---------- */
.m .hero .view.desk .hb-thread { transition: transform .32s var(--ease-standard), background-color .12s var(--ease-standard); }
.m .hero .view.desk .hb-thread.landing { transition: transform .32s var(--ease-standard) .08s, opacity .24s var(--ease-standard) .08s, background-color .12s var(--ease-standard); }
.m [data-scene="hero"]:not(.b1) .view.desk .hb-thread.landing { opacity: 0; transform: translateY(-8px); }
.m [data-scene="hero"]:not(.b1) .view.desk .hb-thread.after { transform: translateY(calc(-1 * var(--rstep, 0px))); }

/* ---------- triage: J, J, E, Z ---------- */
.m .tri-cur { transition: transform .12s var(--ease-standard); }
.m .s-triage .hb-thread--selected { background: none; }
.m .b1 .tri-cur { transform: translateY(var(--rstep)); }
.m .b2 .tri-cur { transform: translateY(calc(2 * var(--rstep))); }
.m .s-triage .hb-thread.arch { transition: transform .18s var(--ease-standard), opacity .18s var(--ease-standard); }
.m .s-triage .hb-thread.after { transition: transform .24s var(--ease-standard); }
.m .b3:not(.b4) .s-triage .hb-thread.arch { opacity: 0; transform: translateX(-24px); }
.m .b3:not(.b4) .s-triage .hb-thread.after { transform: translateY(calc(-1 * var(--rstep))); transition-delay: .1s; }
.m .shot .toastbox { opacity: 0; transform: translateY(8px); transition: opacity .2s var(--ease-standard), transform .22s var(--ease-standard); }
.m .b3 .s-triage .toastbox { opacity: 1; transform: none; }
/* after Z the toast stays and says what happened; its text changes in place (site.js) */

/* ---------- palette: Ctrl K, "move to trav", Enter; the next thread opens ---------- */
.m .s-pal .pal-dim { opacity: 0; transition: opacity .16s var(--ease-standard); }
.m .s-pal .pal-pop { opacity: 0; transform: scale(.98); transform-origin: 50% 0; transition: opacity .14s var(--ease-standard), transform .14s var(--ease-standard); }
.m .b1:not(.b4) .s-pal :is(.pal-dim, .pal-pop) { opacity: 1; transform: none; transition-duration: .16s; }
/* until the first key the palette shows its suggestions; then the matches for what is typed */
.m .s-pal .pal-pop:not(.typed) .pl-move { display: none; }
.m .s-pal .pal-pop:not(.typed) .pal-def { display: block; }
.m .s-pal .pal-def .hb-palette { display: contents; }
.m .s-pal .pal-def :is(.hb-palette__input, .hb-palette__foot) { display: none; }
.m .s-pal .pl-move .miss { display: none; }
.m .s-pal .hb-thread { transition: background-color .12s var(--ease-standard); }
.m .s-pal .hb-thread.mv { transition: transform .18s var(--ease-standard), opacity .18s var(--ease-standard); }
.m .s-pal .hb-thread.after { transition: transform .24s var(--ease-standard), background-color .12s var(--ease-standard) .2s; }
.m .b4 .s-pal .hb-thread.mv { opacity: 0; transform: translateX(-24px); }
.m .b4 .s-pal .hb-thread.after { transform: translateY(calc(-1 * var(--rstep))); transition-delay: .1s; }
.m .s-pal .rv { transition-delay: 0s; }
.m .b4 .s-pal .rv { transition-delay: .2s; }
.m .b4 .s-pal .toastbox { opacity: 1; transform: none; transition-delay: .16s; }

/* ---------- search: chips and the results, "fly", the server, the next receipt ---------- */
.m .s-search .hb-search .hb-chip { display: none; }
.m .b1 .s-search .hb-search .hb-chip:first-of-type, .m .b1 .s-search .hb-search .hb-chip.c2.typed2 { display: inline-flex; }
@starting-style { .m .b1 .s-search .hb-search .hb-chip { opacity: 0; transform: scale(.94); } }
.m .s-search .hb-search .hb-chip { transition: opacity .16s var(--ease-standard), transform .16s var(--ease-standard); }
.m .s-search .pre { transition: opacity .12s var(--ease-standard); }
.m .b1 .s-search .pre { opacity: 0; }
.m .s-search .cnt { transition: opacity .16s var(--ease-standard); }
.m [data-scene="search"]:not(.b1) .cnt { opacity: 0; }
.m .s-search .win:not(.typed) .hb-listpane__rows .hb-mark { background: none; color: inherit; padding: 0; }
.m .s-search .loc, .m .s-search .srv { opacity: 0; transform: translateY(4px); transition: opacity .18s var(--ease-standard), transform .18s var(--ease-standard); transition-delay: calc(var(--i, 0) * 30ms); }
.m .b1 .s-search .loc, .m .b3 .s-search .srv { opacity: 1; transform: none; }
.m .s-search .hb-thread { transition-property: opacity, transform, background-color; }

/* ---------- calendar: drag, the quick editor, guests, the link, save; the editor closes on the saved event ---------- */
.m .s-cal .event-quick { opacity: 0; transform: translateX(-6px) scale(.98); transform-origin: 0 30%; transition: opacity .14s var(--ease-standard), transform .18s var(--ease-standard); }
.m .b2:not(.b7) .s-cal .event-quick { opacity: 1; transform: none; }
.m .s-cal .event-people .hb-recipient { display: none; transition: opacity .16s var(--ease-standard), transform .16s var(--ease-standard); }
.m .b3 .s-cal .event-people .hb-recipient:first-child, .m .b4 .s-cal .event-people .hb-recipient { display: inline-flex; }
@starting-style { .m .s-cal .event-people .hb-recipient { opacity: 0; transform: scale(.94); } }
.m .s-cal .hb-ev.drag { transform-origin: 50% 0; transition: background-color .2s var(--ease-standard), box-shadow .2s var(--ease-standard); }
.m [data-scene="calendar"]:not(.b7) .hb-ev.drag { --ev-fill: oklch(0.30 0.006 285) !important; --ev-bar: oklch(0.6 0.006 285) !important; --ev-ink: oklch(0.95 0.004 285) !important; }
:root[data-scheme="light"] .m [data-scene="calendar"]:not(.b7) .hb-ev.drag { --ev-fill: oklch(0.90 0.006 285) !important; --ev-bar: oklch(0.5 0.006 285) !important; --ev-ink: oklch(0.2 0.004 285) !important; }

/* ---------- offline: the banner, two sends, back online ---------- */
/* the banner lies over the top of the list and slides down inside its own clip; the rows move down by its height */
.m .s-off .hb-listpane { position: relative; }
.m .s-off .offban { position: absolute; z-index: 2; left: 0; right: 0; top: var(--bt, 0px); height: var(--bh, 0px); overflow: hidden; padding: 0; }
.m .s-off .offban > * { margin: 0 12px; transform: translateY(-110%); transition: transform .2s var(--ease-standard); }
.m .s-off .hb-listpane__rows { transition: transform .2s var(--ease-standard); }
.m .b1:not(.b4) .s-off .offban > * { transform: none; }
.m .b1:not(.b4) .s-off .hb-listpane__rows { transform: translateY(var(--bh, 0px)); }
.measuring .s-off .offban { position: static; height: auto; padding: 0 12px 12px; }
.measuring .s-off .offban > * { margin: 0; }
.m .s-off .q { transition: opacity .2s var(--ease-standard), transform .24s var(--ease-standard); opacity: 0; transform: translateY(-6px); }
.m .b4 .s-off .q { transform: translateX(-24px); transition-delay: calc(var(--i, 0) * 60ms); }
.m .b2:not(.b4) .s-off .q1, .m .b3:not(.b4) .s-off .q2 { opacity: 1; transform: none; }
.m .b4 .s-off .toastbox { opacity: 1; transform: none; }

/* ---------- privacy: "Show images" pressed, then the images load into the digest ---------- */
.m .s-priv .pimg-art { opacity: 0; transition: opacity .24s var(--ease-standard); }
.m .b2 .s-priv .pimg-art { opacity: 1; }
.m .s-priv .hb-banner > *, .m .s-priv .shown-line { transition: opacity .16s var(--ease-standard); }
.m [data-scene="privacy"]:not(.b2) .shown-line { opacity: 0; }
.m .b2 .s-priv .hb-banner > :not(.shown-line) { opacity: 0; }

/* ---------- no pin, no tilt: scroll only moves the page. Each window fades up once when it is in view, then its
   story plays on a timer and loops while it stays in view (site.js). ---------- */
.m .stage .shot { transition: opacity .9s cubic-bezier(.22, 1, .36, 1), transform 1.1s cubic-bezier(.22, 1, .36, 1); }
.m .scene .stage:not(.shown) .shot { opacity: 0; transform: translateY(40px); }
.m .col-layer { transition: opacity .4s var(--ease-standard); }

/* ---------- themed mail: the themed layer fades in over the mail as sent, the whole window at once ---------- */
