/* cutflux-glassbar.css: the phone bottom tab bar as a floating "liquid glass" capsule (task 416, 2026-11-08).
 * Owner: "the bottom part should be like a liquid glass field, rounded at the edges."
 *
 * One look for both markups (mobile.html uses .tbar/.tbar-item, the other tab pages .cf-tbar/.cf-tbar-item).
 * Loaded LAST on every page that shows the bar, with cutflux-glassbar.js (the gliding lens).
 * It replaces the bar styling in cutflux-tabbar.css, mobile-lyrc.css, cutflux-light.css, cutflux-spacious.css and the
 * page-inline rules; the selectors start with `html:root:is([data-theme], :not([data-theme])) body` so they outrank those layers (several use !important).
 * `display` is never set with !important, so the pages that hide the bar (montage editor, desktop) still can.
 * Revert: remove this <link> and the glassbar.js <script> from a page. */

@media (max-width: 899px) {
  :root {
    --gb-h: 62px;                       /* capsule height */
    --gb-gap: 12px;                     /* inset from the screen edges */
    --gb-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) - 8px)); /* sits just above the home indicator */
    --gb-space: calc(var(--gb-h) + var(--gb-bottom) + 20px); /* room content must leave at the bottom */
    --gb-tint: rgba(30, 30, 36, .56);
    --gb-solid: rgba(24, 24, 29, .97);
    --gb-rim: rgba(255, 255, 255, .16);
    --gb-spec: rgba(255, 255, 255, .22);
    --gb-shadow: 0 12px 32px rgba(0, 0, 0, .42), 0 2px 6px rgba(0, 0, 0, .28);
    --gb-ink: rgba(255, 255, 255, .64);
    --gb-ink-on: #FFFFFF;
    --gb-lens: rgba(255, 255, 255, .13);
    --gb-lens-rim: rgba(255, 255, 255, .20);
    --gb-spring: cubic-bezier(.3, 1.3, .5, 1);
  }
  html[data-theme="light"] {
    --gb-tint: rgba(255, 255, 255, .62);
    --gb-solid: rgba(250, 250, 252, .97);
    --gb-rim: rgba(255, 255, 255, .75);
    --gb-spec: rgba(255, 255, 255, .9);
    --gb-shadow: 0 10px 30px rgba(15, 20, 35, .14), 0 1px 3px rgba(15, 20, 35, .10), 0 0 0 .5px rgba(15, 20, 35, .10);
    --gb-ink: rgba(20, 22, 30, .62);
    --gb-ink-on: #0B0C10;
    --gb-lens: rgba(15, 20, 35, .07);
    --gb-lens-rim: rgba(255, 255, 255, .9);
  }

  /* ---- the capsule ---- */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) {
    position: fixed !important;
    left: max(var(--gb-gap), env(safe-area-inset-left, 0px)) !important;
    right: max(var(--gb-gap), env(safe-area-inset-right, 0px)) !important;
    bottom: var(--gb-bottom) !important;
    top: auto !important;
    width: auto !important; max-width: 440px; margin: 0 auto !important;
    height: var(--gb-h) !important; padding: 4px !important; box-sizing: border-box;
    border: 0 !important; border-radius: 999px !important;
    background: var(--gb-tint) !important;
    -webkit-backdrop-filter: blur(22px) saturate(1.8) !important;
    backdrop-filter: blur(22px) saturate(1.8) !important;
    box-shadow: inset 0 0 0 .5px var(--gb-rim), inset 0 1px 0 var(--gb-spec), var(--gb-shadow) !important;
    z-index: 9500;
    isolation: isolate; overflow: visible;
    transform: translateZ(0);
    -webkit-tap-highlight-color: transparent;
    view-transition-name: cf-tabbar;
  }
  /* specular sheen across the top half of the glass (the bar surface, not a control) */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar)::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, .10) 0%, rgba(255, 255, 255, 0) 52%);
  }
  html[data-theme="light"]:root:root body nav:is(.tbar, .cf-tbar)::before {
    background: linear-gradient(180deg, rgba(255, 255, 255, .55) 0%, rgba(255, 255, 255, 0) 55%);
  }
  @supports not ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
    html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) { background: var(--gb-solid) !important; }
  }

  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) > :is(.tbar-inner, .cf-tbar-inner) {
    position: relative; z-index: 1;
    display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)) !important; gap: 0 !important;
    height: 100%; max-width: none !important; margin: 0 !important; padding: 0 !important;
  }

  /* ---- the tabs ---- */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item) {
    position: relative; z-index: 2;
    display: flex !important; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px !important; min-height: 0 !important; height: 100% !important; min-width: 44px;
    padding: 0 2px !important; margin: 0 !important;
    border: 0 !important; border-radius: 999px !important; background: transparent !important; box-shadow: none !important;
    color: var(--gb-ink) !important; text-decoration: none;
    transition: color .25s ease, transform .2s var(--gb-spring) !important;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
    -webkit-user-select: none; user-select: none;
  }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item):active { transform: scale(.94); }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item) :is(.tbar-ic, .cf-tbar-ic) {
    width: 26px !important; height: 26px !important; padding: 0 !important; margin: 0 !important;
    display: grid !important; place-items: center;
    background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    color: inherit !important;
  }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item) :is(.tbar-ic, .cf-tbar-ic) svg { width: 23px !important; height: 23px !important; stroke-width: 1.9; }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item) :is(.tbar-lbl, .cf-tbar-lbl) {
    font: 600 12px/1 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Inter", "Segoe UI", sans-serif !important;
    letter-spacing: -.005em !important; color: inherit !important; white-space: nowrap;
  }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item).is-on { color: var(--gb-ink-on) !important; }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item).is-on :is(.tbar-ic, .cf-tbar-ic) svg { stroke-width: 2.2; }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item):focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--cf-accent, #3B82F6) !important; }

  /* the old sliding pill from cutflux-kit is replaced by the lens */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) .cfk-tabpill { display: none !important; }

  /* ---- the glass lens behind the active tab ---- */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) .cf-lens {
    position: absolute; z-index: 1; top: 0; left: 0; bottom: 0;
    width: 25%; border-radius: 999px; pointer-events: none;
    background: var(--gb-lens);
    box-shadow: inset 0 0 0 .5px var(--gb-lens-rim), inset 0 1px 0 var(--gb-lens-rim);
    transform: translate3d(calc(var(--lens-i, 0) * 100%), 0, 0);
    will-change: transform;
  }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) .cf-lens[hidden] { display: none; }

  /* ---- content never sits under the bar ---- */
  html:root:is([data-theme], :not([data-theme])) body:has(> nav:is(.tbar, .cf-tbar)) { padding-bottom: var(--gb-space) !important; }
  html:root:is([data-theme], :not([data-theme])) body:has(> nav:is(.tbar, .cf-tbar)) .app { padding-bottom: 0 !important; }
  /* the one-time coach mark that pointed at the old flat bar sits above the capsule */
  html:root:is([data-theme], :not([data-theme])) body .coach-tbar { bottom: calc(var(--gb-space) + 4px) !important; }
}

@media (max-width: 899px) and (prefers-reduced-motion: reduce) {
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item) { transition: none !important; }
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) :is(.tbar-item, .cf-tbar-item):active { transform: none; }
}

/* page-to-page: the capsule holds still while the page cross-fades */
::view-transition-group(cf-tabbar) { animation-duration: 0s; }
::view-transition-old(cf-tabbar) { display: none; }
::view-transition-new(cf-tabbar) { animation: none; }

/* the bar is a phone thing: hidden on wide screens on every page (pricing has no cutflux-tabbar.css to do it) */
@media (min-width: 900px) { nav.tbar, nav.cf-tbar { display: none !important; } }

/* ---- task 418: drag the lens, and native-feeling page changes ---- */
@media (max-width: 899px) {
  /* the bar owns horizontal drags (no page pan or zoom starts on it); taps still click */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) { touch-action: none; -webkit-user-select: none; user-select: none; }
  /* held: the lens grows a touch and brightens, like iOS */
  html:root:is([data-theme], :not([data-theme])) body nav:is(.tbar, .cf-tbar) .cf-lens { transition: background-color .18s ease, box-shadow .18s ease; }
  html:root:is([data-theme], :not([data-theme])) body nav.cf-gb-held:is(.tbar, .cf-tbar) .cf-lens {
    background: rgba(255, 255, 255, .22);
    box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .42), inset 0 1px 0 rgba(255, 255, 255, .5), 0 4px 14px rgba(0, 0, 0, .25);
  }
  html[data-theme="light"]:root:root body nav.cf-gb-held:is(.tbar, .cf-tbar) .cf-lens {
    background: rgba(15, 20, 35, .11);
    box-shadow: inset 0 0 0 .5px rgba(255, 255, 255, .95), inset 0 1px 0 #fff, 0 4px 14px rgba(15, 20, 35, .14);
  }
}

/* page to page: a short slide + cross-fade in the direction of the tab (cutflux-glassbar.js sets cf-vt-fwd / cf-vt-back
   on the arriving page). 230 ms, decelerating spring curve. Outranks the older 70/200 ms cross-fade rules. */
@keyframes cfVtOutL { to { opacity: 0; transform: translateX(-28px); } }
@keyframes cfVtInR { from { opacity: 0; transform: translateX(28px); } }
@keyframes cfVtOutR { to { opacity: 0; transform: translateX(28px); } }
@keyframes cfVtInL { from { opacity: 0; transform: translateX(-28px); } }
html.cf-vt-fwd::view-transition-old(root) { animation: cfVtOutL 230ms cubic-bezier(.2, .9, .25, 1) both !important; }
html.cf-vt-fwd::view-transition-new(root) { animation: cfVtInR 230ms cubic-bezier(.2, .9, .25, 1) both !important; }
html.cf-vt-back::view-transition-old(root) { animation: cfVtOutR 230ms cubic-bezier(.2, .9, .25, 1) both !important; }
html.cf-vt-back::view-transition-new(root) { animation: cfVtInL 230ms cubic-bezier(.2, .9, .25, 1) both !important; }
@media (prefers-reduced-motion: reduce) {
  html:is(.cf-vt-fwd, .cf-vt-back)::view-transition-old(root),
  html:is(.cf-vt-fwd, .cf-vt-back)::view-transition-new(root) { animation: none !important; }
}
