/*
 * Makes the IFrame component that shows this banner (any /assets/promo/omega-speedmaster* page) sticky:
 *   tablet/desktop (>= 768px): 432 x 72 tab (416 + 8px fillets each side) centred under the fixed
 *                              header (58px tall below 1025px, 72px from 1025px)
 *   below 768px:               full-width 80px bar fixed to the bottom of the viewport
 * The component leaves the page flow, so it reserves no space where it is placed.
 *
 * 1. Link this file from the page's "Head Scripts" field:
 *      <link rel="stylesheet" href="/assets/promo/omega-speedmaster-v2/layout.css">
 * 2. IFrame "Url": /assets/promo/omega-speedmaster-v2/index.html
 * 3. IFrame "Attributes for Desktop" (Mobile can stay empty; it falls back to Desktop):
 *      scrolling     no
 *      data-date     2026-10-15T09:00:00+05:30    (always with the time-zone offset)
 *      data-title    DP World India Championship in
 *      data-bg       red | white                   (optional, red by default)
 *    No "height" or "sandbox" there: the banner needs same-origin access to the page to read these,
 *    pick its tab/bar look and reveal the component.
 *
 * The component stays invisible until the banner has drawn its first frame and marks it ready
 * (data-banner-ready), so the bar look never flashes before the desktop tab is applied.
 * After the date the banner stays on the page with the countdown at 0 00 00 00.
 * Head Scripts are not rendered in edit mode, so in Pages the component stays inline.
 * z-index 999 keeps it under the header (1000) and its menus.
 * The 768px breakpoint matches TAB_QUERY in script.js.
 */

[data-component="IFrame"]:has(iframe[src*="/assets/promo/omega-speedmaster"]) {
  position: fixed;
  z-index: 999;
  top: auto;
  right: 0;
  bottom: 0;
  left: 0;
  height: 80px;
  margin: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease-out;
}

[data-component="IFrame"][data-banner-ready]:has(iframe[src*="/assets/promo/omega-speedmaster"]) {
  opacity: 1;
  pointer-events: auto;
}

[data-component="IFrame"]:has(iframe[src*="/assets/promo/omega-speedmaster"]) div {
  width: 100%;
  max-width: none;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

[data-component="IFrame"] iframe[src*="/assets/promo/omega-speedmaster"] {
  display: block;
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  [data-component="IFrame"]:has(iframe[src*="/assets/promo/omega-speedmaster"]) {
    top: 58px;
    right: auto;
    bottom: auto;
    left: 50%;
    width: 432px;
    height: 72px;
    transform: translateX(-50%);
  }
}

@media (min-width: 1025px) {
  [data-component="IFrame"]:has(iframe[src*="/assets/promo/omega-speedmaster"]) {
    top: 72px;
  }
}

/* Keep the end of the page (footer) and the "Ask our GPT" launcher clear of the bottom bar */
@media (max-width: 767px) {
  body:has([data-component="IFrame"][data-banner-ready] iframe[src*="/assets/promo/omega-speedmaster"]) {
    padding-bottom: 80px;
  }

  body:has([data-component="IFrame"][data-banner-ready] iframe[src*="/assets/promo/omega-speedmaster"]) #dpw__agent .open-btn {
    bottom: calc(24px + 80px);
  }
}

@media (prefers-reduced-motion: reduce) {
  [data-component="IFrame"]:has(iframe[src*="/assets/promo/omega-speedmaster"]) {
    transition: none;
  }
}
