/*
 * Back to top (approved by Ariel, 12 November 2026: option A, the arrow alone) on the long pages: home, /product-demos
 * and /about. A 40 px round glass button, fixed at the bottom right on the page's gutter.
 * - The glass, rim, shadow and hover are the header's Menu pill (home.css .menu-btn); over a part of the page marked
 *   data-header-tone="dark" (.on-dark, the header's own rule) it takes the pill's dark tone (header.css).
 * - The button is in the HTML with `hidden`, so without JavaScript it never shows. btt.js removes `hidden` and only
 *   toggles classes: .is-on once the page is 1.5 screens down, .on-dark over a dark part. No inline styles.
 * - While out (no .is-on) it is visibility: hidden, so it is neither in the tab order nor in the accessibility tree.
 * - Home's pause button is left as it is: it scrolls away with the hero, long before the arrow comes.
 */

.btt {
  --btt-right: var(--gut, 48px); /* the page's gutter (page.css): 48 px, 16 px on phones */
  --btt-bottom: 32px;
  position: fixed;
  z-index: 50; /* under the sticky bar (55), the detail cards (60), their scrim (65) and the dialogs */
  right: max(var(--btt-right), env(safe-area-inset-right));
  bottom: calc(var(--btt-bottom) + env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 6px 18px -10px rgba(40, 50, 30, 0.4);
  color: var(--ink);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition:
    opacity 0.32s var(--ease),
    transform 0.32s var(--ease),
    visibility 0s linear 0.32s,
    background-color 0.25s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

/* No script, no button (the `hidden` attribute stays). */
.btt[hidden] {
  display: none;
}

/* Home has no --gut: its gutter is the header's (home.css --bar-gut), 22 x --p, or 48 x --u on the wide layout. */
.btt-home {
  --btt-right: calc(22 * var(--p));
}

@media (min-width: 960px) and (min-aspect-ratio: 6/5) and (min-height: 560px) {
  .btt-home {
    --btt-right: calc(48 * var(--u));
  }
}

/* The touch area: 44 px on wide screens, round like the button. */
.btt::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
}

/* Phones and portrait tablets (page.css's stacked layout): 16 px from the bottom, a 48 px touch area. */
@media (max-width: 859px) {
  .btt {
    --btt-bottom: 16px;
  }

  .btt::after {
    inset: -4px;
  }
}

.btt svg {
  width: 16px;
  height: 16px;
}

.btt.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition:
    opacity 0.32s var(--ease),
    transform 0.32s var(--ease),
    visibility 0s,
    background-color 0.25s ease,
    border-color 0.3s ease,
    color 0.3s ease;
}

.btt:hover {
  background: rgba(255, 255, 255, 0.74);
}

.btt:active {
  transform: scale(0.94);
}

/* The Menu pill's ring (the site's :focus-visible). */
.btt:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Over a dark part of the page (data-header-tone="dark"): the Menu pill's dark glass with light text. */
.btt.on-dark {
  color: #fbfaf7;
  background: rgba(20, 32, 26, 0.3);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 18px -10px rgba(0, 0, 0, 0.5);
}

.btt.on-dark:hover {
  background: rgba(20, 32, 26, 0.45);
}

.btt.on-dark:focus-visible {
  outline-color: #fbfaf7;
}

/* ---------------------------------------------------------------- preferences */

/* Reduced motion: no fade and no rise; the button simply appears and goes. */
@media (prefers-reduced-motion: reduce) {
  .btt,
  .btt.is-on,
  .btt:active {
    transition: none;
    transform: none;
  }
}

/* No glass: solid, as the pause button and the bar. */
@media (prefers-reduced-transparency: reduce) {
  .btt {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #fbf8f2;
  }

  .btt.on-dark {
    background: rgba(20, 32, 26, 0.96);
  }
}

@media print {
  .btt {
    display: none;
  }
}
