/* The two floating buttons in the bottom-right corner (Tu 12/04: they overlapped; "more esthetically
   pleasing"). Linked from every page by build_site.py as /pdh/float-fix.css.

   Who draws what:
   - The teal "Book My Own Appointment" pill is the theme's own footer button, #brxe-scbwox (Bricks:
     position fixed, bottom 20px, right 20px, z-index 11 inside the footer's z-index 1). It's in our
     HTML, so we can move it.
   - The round blue chat bubble is Practice by Numbers' web chat. The "Practice By Numbers Referral
     Tracking" script in every page's <head> loads appcontent.practicenumbers.com/phone_number_replace_*.js,
     which appends iframes to <body> with no id or class, styled only by inline style attributes:
       the bubble    width 100px, height 100px, bottom 0, right 0, z-index 2147483638
                     (its 60px circle is drawn INSIDE the iframe: 31..91px from the right edge,
                     32..92px from the bottom);
       the greeting  width 270px, height 110px, bottom 100px, right 0 ("Hi there, have a question?");
       #pbn-oab-widget-iframe, the booking overlay (hidden until used).
     When the chat opens, the script rewrites the bubble iframe to width/height 100% (the chat window is
     drawn inside it). We can't style anything inside the iframe, and we must not fight the script over
     its open state, so the selectors below match only the inline styles the script writes, and the
     bubble itself is never moved on desktop.

   Layout:
   - 768px and wider: the bubble keeps its corner; the pill sits to its left, 12px from the circle and
     centred on it (circle centre 62px up; the 46px pill's bottom = 62 - 23 = 39px). 103px = 91px to the
     circle's left edge + 12px. Clear of the iframe's whole box too, so every tap on the pill lands.
     (Centred rather than "same bottom offset": the circle is 60px and the pill 46px, so both can't hold.)
   - Phones: the pill can't fit beside the bubble (296px + 103px > 375px), so they stack, right-aligned,
     the bubble 12px above the pill. The pill keeps its place; the bubble iframe moves up 46px and 11px
     right (circle bottom 78px = pill top 66px + 12px; circle right edge 20px = the pill's). Its
     transparent bottom 24px is clipped (clip-path also clips taps) so it can't swallow taps on the
     pill's top edge; the circle and its shadow end above the clip. The greeting moves up with it.

   First paint (Tu 12/04, live): on about half the pages (the homepage among them) FlyingPress put
   content-visibility:auto on the footer (FOOTER#brxe-1eb693, inline style). That skips rendering the
   footer until it nears the screen AND contains fixed descendants, so the pill sat at its spot inside
   the footer, thousands of px down, until a FlyingPress script removed the style once the footer
   had been scrolled to. Every element holding the pill now renders normally (an !important rule
   beats the inline style); the rest of the page keeps its lazy rendering. The footer is also named
   by id in a rule of its own, so browsers without :has() get it too (a selector list with :has()
   would be dropped whole there).

   Degrades to today's layout: without the chat (script blocked or down) the :has() conditions fail and
   the pill keeps its corner; without the pill the bubble keeps its corner; a browser without :has()
   ignores these rules; if Practice by Numbers changes its inline styles, the selectors stop matching.
   Measured by tests/test_e2e_float_fix.py at 375/768/1280/1920/2560px, and at first paint on every
   built page at 1440x900 and 390x844. */

#brxe-1eb693 {
  content-visibility: visible !important;
}
body :has(#brxe-scbwox) {
  content-visibility: visible !important;
}

@media (min-width: 768px) {
  body:has(> iframe:not([id])[style*="right: 0px"][style*="bottom: 0px"][style*="z-index: 2147483638"]) #brxe-scbwox {
    right: 103px;
    bottom: 39px;
  }
}

@media (max-width: 767px) {
  body:has(#brxe-scbwox) > iframe:not([id])[style*="width: 100px"][style*="height: 100px"][style*="right: 0px"][style*="bottom: 0px"][style*="z-index: 2147483638"] {
    bottom: 46px !important;
    right: -11px !important;
    clip-path: inset(0 0 24px 0);
  }
  body:has(#brxe-scbwox) > iframe:not([id])[style*="width: 270px"][style*="bottom: 100px"][style*="right: 0px"] {
    bottom: 146px !important;
  }
}
