/* =========================================================
   Motion shared by every page — driven by assets/js/motion.js
   1. Scroll reveal: blocks below the screen wait (.mo-wait) and rise
      into place (.mo-in) the first time they scroll into view.
   2. Slot-machine figures: while a figure rolls, each digit is a
      column (.mo-dg) with a 0-9 strip inside. At rest it is plain text.
   ========================================================= */

/* ---------- 1. Page entrance and scroll reveal ----------
   The list of blocks lives in includes/motion-head.php, which also hides them until motion.js
   is ready. "translate" (not "transform") so tilted cards keep their own rotation. */
.mo-wait { opacity: 0; }
.mo-in { animation: moRise .8s cubic-bezier(.22, 1, .36, 1) var(--mo-delay, 0ms) both; }
@keyframes moRise {
    from { opacity: 0; translate: 0 32px; }
    to   { opacity: 1; translate: 0 0; }
}

/* ---------- 2. Slot-machine figures ----------
   --mo-dg-h:  the figure's line height (the room it takes in the layout)
   --mo-dg-pad: how far the digits' ink reaches outside the line box (+2px); the column shows
                that much extra above and below without taking any more room in the layout
   --mo-row-h: one digit row = line height + 2 x pad */
.mo-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.mo-roll { display: inline-flex; vertical-align: baseline; }
.mo-roll__probe { position: absolute; visibility: hidden; white-space: nowrap; pointer-events: none; }
.mo-dg {
    display: block;
    height: var(--mo-dg-h);
    clip-path: inset(calc(var(--mo-dg-pad, 0px) * -1) -1em);
}
.mo-dg__strip { display: block; margin-top: calc(var(--mo-dg-pad, 0px) * -1); }
.mo-dg__strip > span { display: block; height: var(--mo-row-h); line-height: var(--mo-row-h); white-space: nowrap; }
.mo-dg-sep { display: block; height: var(--mo-dg-h); line-height: var(--mo-dg-h); white-space: nowrap; }

/* ---------- 3. Header on scroll ----------
   Same behaviour as the Dashstash header: the header sticks to the top, and once the page has
   scrolled (.is-scrolled, set by motion.js) the full-width bar turns into a floating pill.
   Only the bar's shape changes; the logo, links and button keep each page's own styles.
   The header keeps its height (pill + top and bottom space = the bar), so the page never jumps.
   Pill width fits each header's contents: logo + links + button. */
html { scroll-padding-top: 88px; }   /* anchor links (#price...) land below the header */

.site-header, .bl-header, .pt-header, .st-header {
    --mo-pill-w: 960px;
    --mo-ease: cubic-bezier(.23, 1, .32, 1);
    display: flow-root;   /* keeps the pill's top space inside the header instead of collapsing above it */
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color .5s ease;
}
.pt-header { --mo-pill-w: 1024px; } /* the "Partners" tag makes the logo wider */

.header-inner, .bl-header__inner, .pt-header__inner, .st-header__inner {
    border-radius: 100px;
    background-color: rgba(255, 255, 255, 0);
    box-shadow: 0 0 0 1px rgba(25, 27, 26, 0), 0 14px 34px rgba(25, 27, 26, 0), 0 2px 6px rgba(25, 27, 26, 0);
    transition: max-width .6s var(--mo-ease), height .6s var(--mo-ease), margin .6s var(--mo-ease),
                padding .6s var(--mo-ease), background-color .5s ease, box-shadow .5s ease,
                -webkit-backdrop-filter .5s ease, backdrop-filter .5s ease;
}

/* Scrolled: the bar becomes a see-through frame, the inside becomes the pill */
.is-scrolled:is(.site-header, .bl-header, .pt-header, .st-header) {
    background-color: transparent;
    pointer-events: none; /* clicks around the pill reach the page */
}
.is-scrolled :is(.header-inner, .bl-header__inner, .pt-header__inner, .st-header__inner) {
    pointer-events: auto;
    max-width: min(var(--mo-pill-w), calc(100% - 32px));
    height: 62px;
    margin: 14px auto;            /* 14 + 62 + 14 = the bar's 90px */
    padding: 0 7px 0 16px;
    background-color: rgba(255, 255, 255, .8);
    box-shadow: 0 0 0 1px rgba(25, 27, 26, .09), 0 14px 34px rgba(25, 27, 26, .1), 0 2px 6px rgba(25, 27, 26, .04);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .is-scrolled :is(.header-inner, .bl-header__inner, .pt-header__inner, .st-header__inner) { background-color: rgba(255, 255, 255, .97); }
}

/* Desktop: the links move in next to the logo inside the pill */
@media (min-width: 1081px) {
    .main-nav, .bl-menu, .pt-menu, .st-menu { transition: margin .6s var(--mo-ease); }
    .is-scrolled .main-nav, .is-scrolled .bl-menu, .is-scrolled .st-menu { margin-left: 8px; } /* + the row's 32px gap */
    .is-scrolled .pt-menu { margin-left: 40px; }
}

/* Phones: the bar is 72px, so a slimmer pill (9 + 54 + 9) */
@media (max-width: 760px) {
    html { scroll-padding-top: 72px; }
    .is-scrolled :is(.header-inner, .bl-header__inner, .pt-header__inner, .st-header__inner) {
        max-width: calc(100% - 24px);
        height: 54px;
        margin: 9px auto;
        padding: 0 5px 0 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mo-wait { opacity: 1; }
    .mo-in { animation: none; }
    .mo-dg, .mo-dg__strip { transition: none !important; }
    .site-header, .bl-header, .pt-header, .st-header,
    .header-inner, .bl-header__inner, .pt-header__inner, .st-header__inner,
    .main-nav, .bl-menu, .pt-menu, .st-menu { transition-duration: 0s !important; }
}

/* Printed pages show everything */
@media print {
    .mo-wait { opacity: 1 !important; }
    .mo-in { animation: none !important; }
}
