/* Adhesion ad (stickybar).

   A port of toddlerpips-frontend's app/packs/stylesheets/components/_stickybar.scss,
   with the SCSS nesting and the clear-list/clear-button mixins expanded. The same
   creative runs on babypips, MarketMilk and the forums, so this must stay in step
   with that file — port changes across rather than restyling one side.

   The `preview` container queries from the source are omitted: they exist for the
   admin form's resizable preview pane, which lives only in the Rails app. */

#stickybar {
  display: block;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 67px;
  line-height: 1.5;
  container-type: size;
  container-name: stickybar;
  z-index: 2147483645; /* one higher than Google's CMP for CCPA */
  transition: transform 300ms ease-out;
  background: var(--stickybar-background);
  user-select: none;
  box-sizing: border-box;
}

#stickybar * {
  box-sizing: border-box;
}

@media (max-width: 560px) {
  #stickybar {
    height: 50px;
    line-height: 1.3;
  }
}

/* The wrapper must not swallow clicks meant for the Freestar iframe. */
#stickybar[data-third-party] {
  pointer-events: none;
}

#stickybar.hidden {
  transform: translateY(calc(100% + 30px));
}

#stickybar.closed {
  display: none !important;
}

#stickybar,
#stickybar a,
#stickybar a:link,
#stickybar a:visited {
  color: var(--stickybar-text);
  text-decoration: none;
  font-size: 14px;
}

@container stickybar (max-width: 560px) {
  #stickybar,
  #stickybar a,
  #stickybar a:link,
  #stickybar a:visited {
    font-size: 11px;
  }
}

#stickybar a:hover {
  text-decoration: underline;
}

#stickybar p {
  margin: 0;
  padding: 0;
}

#stickybar ul {
  list-style-type: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: space-between;
}

/* With fewer than three items the row reads better centred than spread. */
#stickybar ul:not(:has(> li:nth-child(3))) {
  justify-content: center;
}

#stickybar ul:not(:has(> li:nth-child(3))) > li {
  max-width: initial;
  text-align: center;
}

#stickybar ul:not(:has(> li:nth-child(3))) > li:first-child {
  border-left: none;
}

#stickybar ul:not(:has(> li:nth-child(3))) + .legal {
  text-align: center;
}

#stickybar li {
  display: inline-flex;
  align-items: center;
  max-width: 315px;
  min-width: 0;
  max-height: 42px;
  overflow: hidden;
  padding: 0 16px;
  border-left: 1px solid var(--stickybar-divider);
}

/* Markdown emphasis is a bold highlight here, not an italic. */
#stickybar li em {
  font-weight: bold;
  font-style: normal;
}

/* Backticks render as a badge pill rather than code. */
#stickybar li code {
  display: inline-block;
  padding: 1px 4px;
  font: inherit;
  font-size: 10px;
  line-height: inherit;
  text-transform: uppercase;
  border-radius: 3px;
  font-weight: bold;
  margin-left: 5px;
  text-decoration: none;
  user-select: none;
  background: var(--stickybar-badge);
}

@container stickybar (max-width: 560px) {
  #stickybar li code {
    position: relative;
    top: -2px;
    font-size: 6px;
    padding: 2px 2px 1px;
  }
}

#stickybar .legal,
#stickybar .disclosure {
  font-size: 8px;
  color: var(--stickybar-legal);
}

#stickybar .stickybar--logo {
  display: inline-flex;
  flex-flow: row nowrap;
  flex-grow: 0;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  margin-right: 30px;
}

#stickybar .stickybar--logo > svg {
  max-width: 170px;
  max-height: 67px;
  height: auto;
}

@container stickybar (max-width: 560px) {
  #stickybar .stickybar--logo {
    margin-right: 0;
  }

  #stickybar .stickybar--logo > svg {
    max-width: 92px;
    max-height: 50px;
  }
}

#stickybar .stickybar--cta-wrapper {
  margin: 0 0 0 25px;
}

@container stickybar (max-width: 560px) {
  #stickybar .stickybar--cta-wrapper {
    margin-left: 0;
  }
}

#stickybar .stickybar--cta {
  padding: 14px 13px 12px;
  box-shadow: 0px 5px 7px 0px rgba(0, 0, 0, 0.24);
  border-radius: 3px;
  font-size: 15px;
  line-height: 15px;
  font-weight: bold;
  white-space: nowrap;
}

#stickybar .stickybar--cta,
#stickybar .stickybar--cta:link,
#stickybar .stickybar--cta:visited,
#stickybar .stickybar--cta:hover {
  color: var(--stickybar-cta);
}

#stickybar .stickybar--cta,
#stickybar .stickybar--cta:hover {
  background: var(--stickybar-ctabg);
  text-decoration: none !important;
}

@container stickybar (max-width: 560px) {
  #stickybar .stickybar--cta {
    padding: 10px 7px 9px;
    font-size: 11px;
    line-height: 11px;
  }

  #stickybar ul {
    justify-content: center;
  }

  #stickybar ul li {
    padding: 2px 0;
    border-left: none;
    text-align: center;
  }
}

.stickybar--inner {
  display: flex;
  position: relative;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: space-evenly;
  padding: 13px 9px;
  max-width: 1157px;
  height: inherit;
  margin: 0 auto;
  color: var(--stickybar-text);
}

@container stickybar (max-width: 560px) {
  .stickybar--inner {
    max-width: 345px;
    padding: 10px 2px;
  }
}

.stickybar--inner-copy {
  display: grid;
  grid-template-rows: fit-content;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  position: relative;
  flex-basis: 100%;
  flex-grow: 1;
  flex-shrink: 1;
  min-width: 0;
}

.stickybar--inner-copy > ul {
  grid-row: 1;
  grid-column: 1 / 3;
}

.stickybar--inner-copy > .disclosure {
  grid-row: 2;
  grid-column: 1;
  justify-self: flex-start;
  padding-left: 0;
}

.stickybar--inner-copy > .legal {
  grid-row: 2;
  grid-column: 1 / 3;
}

.stickybar--inner-copy > .disclosure + .legal {
  grid-column: 2;
  justify-self: flex-end;
  text-align: right;
}

.stickybar--cta-wrapper {
  display: flex;
  flex-flow: column;
  align-items: center;
}

.stickybar--cta {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  flex-grow: 0;
  flex-shrink: 0;
}

#stickybar.stickybar--lb .stickybar--inner-copy > .legal {
  max-height: 11px;
  max-width: calc(100cqw - 370px);
  overflow: hidden;
  text-overflow: ellipsis;
}

#stickybar.stickybar--lb .stickybar--inner-copy > .disclosure,
#stickybar.stickybar--lbcta .stickybar--inner-copy > .disclosure {
  padding: 0 0 0 16px;
}

#stickybar.stickybar--lb .stickybar--inner-copy > .legal,
#stickybar.stickybar--lbcta .stickybar--inner-copy > .legal {
  padding: 0 16px;
}

@container stickybar (max-width: 560px) {
  #stickybar.stickybar--lb .stickybar--inner,
  #stickybar.stickybar--lbcta .stickybar--inner {
    padding-top: 2px;
  }

  #stickybar.stickybar--lb .stickybar--inner-copy > .legal,
  #stickybar.stickybar--lbcta .stickybar--inner-copy > .legal {
    position: absolute;
    bottom: -12px;
    left: 50%;
    padding: 0;
    transform: translateX(-50%);
    white-space: nowrap;
    max-width: calc(100cqw - 10px);
    max-height: initial;
  }
}

#stickybar.stickybar--lbcta .stickybar--inner-copy > .legal {
  display: none;
}

#stickybar.stickybar--lbcta .stickybar--cta-wrapper > .legal {
  margin: 2px auto 0;
  max-height: 11px;
  overflow: hidden;
}

@container stickybar (max-width: 560px) {
  #stickybar.stickybar--lbcta .stickybar--inner-copy > .legal {
    display: block;
  }

  #stickybar.stickybar--lbcta .stickybar--cta-wrapper > .legal {
    display: none;
  }
}

#stickybar.stickybar--lrcta {
  height: 67px;
}

@media (max-width: 730px) {
  #stickybar.stickybar--lrcta {
    height: 90px;
  }
}

#stickybar.stickybar--lrcta .stickybar--inner > .legal {
  flex-basis: 255px;
  flex-grow: 0;
  flex-shrink: 0;
  font-size: 10px;
  line-height: 11px;
  max-height: 56px;
  overflow: hidden;
  margin: 0 0 0 16px;
}

#stickybar.stickybar--lrcta .stickybar--inner > .stickybar--inner-copy > .disclosure {
  grid-column: 1 / 3;
}

@container stickybar (max-width: 730px) {
  #stickybar.stickybar--lrcta .stickybar--inner {
    flex-wrap: wrap;
  }

  #stickybar.stickybar--lrcta .stickybar--inner > .stickybar--inner-copy {
    max-width: 124px;
    min-width: 0;
  }

  #stickybar.stickybar--lrcta .stickybar--inner > .legal {
    flex-basis: 100%;
    font-size: 9px;
    line-height: 10px;
    max-height: 32px;
    margin: 8px 0 0;
  }
}

/* The legal block takes the room the last two copy items would have used. */
#stickybar.stickybar--lrcta ul li:nth-child(5),
#stickybar.stickybar--lrcta ul li:nth-child(4) {
  display: none;
}

@container stickybar (max-width: 900px) {
  #stickybar.stickybar--lrcta ul {
    justify-content: center;
  }

  #stickybar.stickybar--lrcta ul li {
    padding: 2px 0;
    border-left: none;
    justify-self: center;
    text-align: center;
  }
}

.stickybar--close {
  display: block;
  position: absolute;
  right: 0;
  top: -24px;
  width: 30px;
  height: 25px;
  margin: 0;
  cursor: pointer;
  border: none;
  overflow: visible;
  line-height: normal;
  box-shadow: none;
  text-shadow: none;
  border-radius: 4px 4px 0 0;
  padding: 2px 0;
}

.stickybar--close,
.stickybar--close:hover {
  background: var(--stickybar-closebg) !important;
}

.stickybar--close:active {
  box-shadow: none !important;
}

.stickybar--close[type="button"] {
  -webkit-font-smoothing: inherit;
  -moz-osx-font-smoothing: inherit;
}

.stickybar--close > svg {
  fill: var(--stickybar-close);
}
