/*
 * Live Optics site-wide info banner.
 *
 * This site is a static export of a Next.js app. Navigating between pages is
 * handled client-side: only the contents of #__next are replaced, the <head>
 * of the new page is never fetched and the JSS class suffixes (nav-0-2-19,
 * wrapper-0-2-1, ...) are regenerated at runtime. Per-page <style> blocks and
 * hard-coded class suffixes therefore cannot be used for the banner - this one
 * stylesheet is shared by every page and is scoped by the data attributes that
 * /assets/js/info-banner.js keeps up to date on every route change:
 *
 *   <html data-banner="on|off">          banner shown on this route?
 *   <html data-banner-nav="fixed|none">  does this route have the fixed navbar?
 *   <html data-banner-variant="...">     per-page copy and styling
 */

#info-banner-container {
  box-sizing: border-box;
  width: calc(100% - 118px);
  max-width: 1400px;
  /* Default: clear the fixed navbar. */
  margin: 122px auto 0 auto;
  position: relative;
  z-index: 1;
}

/* Routes without the fixed navbar (e.g. /signup) only need a small gap. */
html[data-banner-nav='none'] #info-banner-container {
  margin-top: 20px;
}

/* Routes that opt out of the banner (e.g. /shell). */
html[data-banner='off'] #info-banner-container {
  display: none;
}

@media (max-width: 767px) {
  #info-banner-container {
    width: calc(100% - 24px);
    margin-top: 114px;
  }

  html[data-banner-nav='none'] #info-banner-container {
    margin-top: 20px;
  }
}

/*
 * The cloud calculator's banner runs edge to edge instead of lining up with
 * the site's content width.
 */
html[data-banner-variant='cloud-calculator'] #info-banner-container {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

html[data-banner-variant='cloud-calculator'] #info-banner {
  border-radius: 0;
}

#info-banner {
  display: flex;
  flex-direction: row;
  align-items: center;
  box-sizing: border-box;
  width: 100%;
  min-height: 52px;
  padding: 0.5rem 1rem;
  color: #ffffff;
  background-color: #57a8e6;
  border-radius: 4px;
  font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#info-banner:after {
  content: '';
  min-height: inherit;
  font-size: 0;
}

#info-banner svg {
  flex: 0 0 1.5rem;
  width: 24px;
  height: 24px;
}

#info-banner svg path {
  fill: #ffffff;
}

#info-banner p {
  font-size: 0.875rem;
  line-height: 1.25em;
  margin: 0;
  margin-left: 1rem;
  font-weight: 600;
  color: #ffffff;
}

#info-banner p a {
  color: #ffffff;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
}

#info-banner p a:hover {
  text-decoration: none;
  opacity: 0.9;
}

/*
 * Page chrome adjustments, applied only while the banner is on screen.
 * The class suffixes are generated per page load, so these selectors match on
 * the class-name prefix instead of the full name.
 */
html[data-banner='on'] [class^='navWithoutNotification-'],
html[data-banner='on'] [class*=' navWithoutNotification-'] {
  top: 0 !important;
}

/*
 * The banner sits in normal flow above the page content and already pushes it
 * clear of the fixed navbar, so the wrapper's own navbar offset is not needed.
 */
html[data-banner='on'] [class^='wrapper-0-2-'],
html[data-banner='on'] [class*=' wrapper-0-2-'] {
  padding-top: 1.25rem !important;
}

/*
 * The cloud calculator's iframe is sized to the full viewport height, so it
 * has to give back the space taken by everything above it - otherwise the
 * banner just pushes the bottom of the calculator off screen.
 * --cloud-iframe-offset is kept up to date by /assets/js/info-banner.js.
 */
html[data-banner='on'] [class^='cloudCalculatorIFrame-'],
html[data-banner='on'] [class*=' cloudCalculatorIFrame-'] {
  height: calc(100vh - var(--cloud-iframe-offset, 211px));
  /* 100vw includes the vertical scrollbar and overflows sideways. */
  width: 100%;
  /* inline by default, which leaves a few pixels of line box underneath */
  display: block;
}

/*
 * The calculator page's wrapper is a full viewport tall on top of an in-flow
 * header, which leaves a strip of empty page to scroll past the iframe.
 */
html[data-banner-variant='cloud-calculator'] [class^='wrapper-0-2-'],
html[data-banner-variant='cloud-calculator'] [class*=' wrapper-0-2-'] {
  min-height: 0;
}

/*
 * The header and notification strip on that page are sized with 100vw, which
 * is wider than the content area whenever a vertical scrollbar is showing and
 * leaves the page scrolling sideways next to the full-width banner.
 */
html[data-banner-variant='cloud-calculator'] [class^='nav-0-2-'],
html[data-banner-variant='cloud-calculator'] [class*=' nav-0-2-'],
html[data-banner-variant='cloud-calculator'] [class^='notification-0-2-'],
html[data-banner-variant='cloud-calculator'] [class*=' notification-0-2-'] {
  width: 100%;
}
