/* The sticky strip under the site header (inc/ad-strip.php, js/ribbon.js).
   It sits inside the fixed <header>, after .sol-header, so it stays on screen
   while the page scrolls. Keep ad words out of this file's name and class
   names: ad blockers hide them. */

/* Content clears the fixed header with padding on the first element after it
   (styles/header.css); the strip adds its own height. */
body.has-sn-ribbon > div:first-of-type {
  padding-top: calc(44px + 96px + 44px);
}

/* Mega panels and the drawer hang off .sol-header and must cover the strip. */
body.has-sn-ribbon .sol-header {
  z-index: 2;
}

.sn-ribbon {
  --sn-ribbon-h: 44px;
  position: relative;
  z-index: 1;
  background: var(--sn-ribbon-bg, #162D54);
  color: var(--sn-ribbon-fg, #fff);
  font-family: 'Mona Sans', 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  line-height: 1.25;
  text-align: left;
}

.sn-ribbon__link,
.sn-ribbon__link:hover,
.sn-ribbon__link:focus {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--sn-ribbon-h);
  padding: 0 32px;
  box-sizing: border-box;
  color: inherit;
  text-decoration: none;
}

.sn-ribbon__link:focus-visible {
  outline: 2px solid #fff;
  outline-offset: -4px;
}

.sn-ribbon__logo {
  flex: none;
  display: block;
  width: auto;
  height: 28px;
}

/* Label and messages: side by side here, stacked on phones. */
.sn-ribbon__text {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  align-self: stretch;
  gap: 16px;
  min-width: 0;
}

.sn-ribbon__label {
  flex: none;
  padding-left: 16px;
  border-left: 1px solid rgba(255, 255, 255, .4);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: .88;
}

/* The messages share one slot; the current one fades and slides in. */
.sn-ribbon__messages {
  position: relative;
  flex: 1 1 auto;
  align-self: stretch;
  min-width: 0;
}

.sn-ribbon__message {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
  opacity: 0;
  visibility: hidden;
  transform: translateY(calc(-50% + 10px));
  transition: opacity .35s ease, transform .35s ease, visibility 0s linear .35s;
}

.sn-ribbon__message.is-current {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%);
  transition: opacity .35s ease, transform .35s ease, visibility 0s;
}

.sn-ribbon__button {
  flex: none;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--sn-ribbon-btn, #F15C30);
  color: var(--sn-ribbon-btn-fg, #fff);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: filter .15s ease;
}

.sn-ribbon__link:hover .sn-ribbon__button {
  filter: brightness(1.1);
}

.sn-ribbon__chevron {
  display: none;
}

/* A sponsor's full-width image (energymatters.com.au style): desktop only.
   It scales with the window up to its own 2000px width, so it's 1/20 of the
   window tall, at most 100px; the background fills either side beyond that. */
.sn-ribbon__image {
  display: none;
}

@media (min-width: 1024px) {
  body.has-sn-ribbon-image > div:first-of-type {
    padding-top: calc(44px + 96px + min(5vw, 100px));
  }

  .sn-ribbon--image .sn-ribbon__link,
  .sn-ribbon--image .sn-ribbon__link:hover,
  .sn-ribbon--image .sn-ribbon__link:focus {
    display: block;
    height: auto;
    padding: 0;
  }

  .sn-ribbon--image .sn-ribbon__image {
    display: block;
    width: 100%;
    max-width: 2000px;
    height: auto;
    margin: 0 auto;
  }

  .sn-ribbon--image .sn-ribbon__logo,
  .sn-ribbon--image .sn-ribbon__text,
  .sn-ribbon--image .sn-ribbon__button {
    display: none;
  }
}

/* Phones and tablets: the header row is 72px and there's no utility strip.
   The strip grows to 52px: the label goes on a small line of its own, the
   message below it can wrap to two lines, the button gives way to a chevron,
   and the whole bar is still the link. */
@media (max-width: 1023.98px) {
  body.has-sn-ribbon > div:first-of-type {
    padding-top: calc(72px + 52px);
  }

  .sn-ribbon {
    --sn-ribbon-h: 52px;
  }

  .sn-ribbon__link,
  .sn-ribbon__link:hover,
  .sn-ribbon__link:focus {
    gap: 12px;
    padding: 0 24px;
  }

  .sn-ribbon__logo {
    height: 22px;
  }

  .sn-ribbon__button {
    display: none;
  }

  .sn-ribbon__text {
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    gap: 2px;
  }

  .sn-ribbon__label {
    padding-left: 0;
    border-left: 0;
    font-size: 10px;
    line-height: 12px;
  }

  .sn-ribbon__messages {
    flex: none;
    align-self: auto;
    height: 32px;
  }

  /* Without a label the message centres in the bar. */
  .sn-ribbon__label + .sn-ribbon__messages .sn-ribbon__message {
    top: 0;
    transform: translateY(8px);
  }

  .sn-ribbon__label + .sn-ribbon__messages .sn-ribbon__message.is-current {
    transform: none;
  }

  .sn-ribbon__message {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    font-size: 13px;
    line-height: 16px;
    white-space: normal;
  }

  .sn-ribbon__chevron {
    display: block;
    flex: none;
    width: 8px;
    height: 8px;
    border-top: 2px solid currentColor;
    border-right: 2px solid currentColor;
    transform: rotate(45deg);
  }
}

@media (max-width: 359.98px) {
  .sn-ribbon__link,
  .sn-ribbon__link:hover,
  .sn-ribbon__link:focus {
    padding: 0 16px;
  }

  .sn-ribbon__logo {
    height: 18px;
  }
}

/* Laptop widths: the label goes first, so the message keeps its room. */
@media (min-width: 1024px) and (max-width: 1279.98px) {
  .sn-ribbon__label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sn-ribbon__message,
  .sn-ribbon__message.is-current,
  .sn-ribbon__button {
    transition: none;
  }
}

@media print {
  .sn-ribbon {
    display: none;
  }
}
