/*
  CookieHub banner and settings dialog.

  Based on CookieHub's own stylesheet (cookiehub.net/c2/css/2.9.2.css),
  trimmed to the markup the GTM container's CookieHub setup renders (overlay
  banner, light style, settings with the cookie declaration tab) and restyled
  with the site's tokens. The root layout renders it as <link data-ch2css>,
  which stops CookieHub from loading its own.

  Colors: --theme-cookie-* and the --btn-* / --text-btn-* sets on .ch2
  (styles/theme.scss). Served as-is, so the nesting is native CSS; every
  nested selector starts with & for older engines.
*/

/* Base */
.ch2 {
  padding: 0 !important;

  & button {
    height: auto;
    line-height: 1;
  }
}

.ch2-container {
  font-family: var(--font-mark-pro), sans-serif;
  font-size: var(--type-p5);
  line-height: 1;
  text-align: left;
  text-transform: none;

  & * {
    box-sizing: content-box !important;
  }

  & p {
    padding: 0;
  }

  & a {
    transition: all 0.15s ease;
  }
}

.ch2-container {
  @media (max-height: 600px) {
    overflow-y: auto;
  }
}

.ch2-scale {
  transform: scale(1) !important;
}

/* Banner */
.ch2-dialog {
  background: var(--theme-cookie-surface);
  border-radius: 24px;
  bottom: 16px;
  box-shadow: var(--btn-shadow);
  display: none;
  left: 16px;
  max-height: 90dvh;
  outline: none;
  padding: 28px;
  position: fixed;
  width: min(600px, 100vw - 88px);
  z-index: 700001;

  &.ch2-visible {
    /* Waits for the page's entrance animation; hidden and inert meanwhile */
    animation: ch2-banner-in 0.4s ease-in 2.5s backwards;
    display: block;

    @media (prefers-reduced-motion: reduce) {
      animation-delay: 0s;
    }
  }

  /* The popup as designed, scaled down from its corner */
  @media (min-width: 720px) {
    scale: 0.87;
    transform-origin: bottom left;
  }

  /* Bottom sheet */
  @media (max-width: 719px) {
    border-radius: 24px 24px 0 0;
    bottom: 0;
    left: 0;
    padding: 20px 16px;
    right: 0;
    width: calc(100% - 32px);
  }

  @media (max-width: 600px) {
    &.ch2-visible {
      display: flex !important;
      flex-direction: column;
    }
  }

  & #ch2-dialog-title {
    font-size: var(--type-b1);
    font-weight: 700;
    line-height: 1;

    @media (max-width: 719px) {
      font-size: var(--type-b3);
    }
  }
}

.ch2-dialog-content {
  max-height: 65dvh;
  overflow-y: auto;
  scrollbar-color: var(--theme-cookie-divider) transparent;

  @media (max-width: 600px) {
    flex: 1 1 auto !important;
    min-height: 0;
    width: 100%;
  }

  & p {
    color: var(--theme-cookie-muted);
    font-size: var(--type-p6);
    line-height: 20px;
    margin: 0 0 4px;

    &:first-child {
      margin-bottom: 8px;
    }

    &:last-child {
      margin-bottom: 16px;
    }

    @media (max-width: 600px) {
      font-size: 13px;
      line-height: 18px;

      &:last-child {
        margin-bottom: 12px;
      }
    }

    & strong {
      color: var(--theme-cookie-text);
      font-weight: 700;
    }
  }

  & a {
    border-bottom: 1px solid var(--theme-cookie-divider);
    color: var(--theme-cookie-text);
    cursor: pointer;
    font-size: 13px;

    &:hover {
      border-bottom-color: var(--theme-cookie-text);
    }
  }
}

.ch2-dialog-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-end;

  .ch2 & .ch2-btn-text {
    flex-shrink: 0;
    font-size: var(--type-b4);
    margin-right: auto;
  }

  /* Phones: the two choices share a row, the settings link sits under them */
  @media (max-width: 719px) {
    justify-content: center;

    .ch2 & .ch2-btn:not(.ch2-btn-text) {
      flex: 1 1 auto;
      padding: 0 16px;

      &::after {
        left: 16px;
      }
    }

    .ch2 & .ch2-btn-text {
      margin-right: 0;
      order: 1;
    }
  }

  @media (max-width: 600px) {
    width: 100% !important;
  }
}

/* Close button, if enabled in CookieHub */
.ch2-dialog-close a {
  background: var(--theme-cookie-surface);
  border: 1px solid var(--theme-cookie-divider);
  border-radius: 100%;
  display: block;
  height: 32px;
  margin-top: -53px;
  position: absolute;
  right: 27px;
  width: 31px;

  &::before,
  &::after {
    border-bottom: 2px solid var(--theme-cookie-muted);
    content: "";
    display: block;
    left: 8px;
    position: relative;
    transition: all 0.3s ease;
    width: 16px;
  }

  &::before {
    top: 16px;
    transform: rotate(-45deg);
  }

  &::after {
    top: 14px;
    transform: rotate(45deg);
  }

  &:hover::before,
  &:hover::after {
    border-bottom-color: var(--theme-cookie-text);
  }
}

/* Buttons: size "xs" of components/button/Button (.ch2 beats ".ch2 button") */
.ch2 .ch2-btn {
  align-items: center;
  border: 0;
  border-radius: 100px;
  box-shadow: var(--btn-shadow);
  cursor: pointer;
  display: inline-flex;
  font-size: var(--type-b4);
  font-weight: 700;
  gap: 8px;
  height: 42px;
  justify-content: center;
  letter-spacing: var(--tracking-default);
  line-height: var(--leading-ui);
  margin-bottom: 0 !important;
  min-height: auto !important;
  padding: 0 24px;
  position: relative;
  transition: var(--btn-transition);
  white-space: nowrap;
}

/*
  Filled buttons. ::before is the lightning bolt (components/icons/
  LightningIcon): upside down at rest, spins upright and grows on hover.
  ::after is its glow.
*/
.ch2 :is(.ch2-btn-primary, .ch2-btn-secondary, .ch2-btn-transparent) {
  background: var(--btn-bg);
  color: var(--btn-fg);

  &::before,
  &::after {
    background-color: var(--btn-bolt-fill);
    content: "";
    flex-shrink: 0;
    height: 18px;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 22'%3E%3Cpath d='m4.625 22 .688-9.075L.75 11.621a.2.2 0 0 1-.117-.294L7.375 0l-.688 9.075 4.563 1.304a.2.2 0 0 1 .117.294L4.625 22Z'/%3E%3C/svg%3E")
      center / contain no-repeat;
    rotate: 180deg;
    transition:
      rotate 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      scale 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
      background-color 0.15s ease-in-out,
      opacity 0.15s ease-in-out;
    width: 9px;
  }

  &::after {
    background-color: var(--btn-bolt-glow);
    filter: blur(3px);
    left: 24px;
    opacity: 0;
    position: absolute;
    top: calc(50% - 9px);
  }

  &:focus-visible {
    background: var(--btn-hover-bg);
    box-shadow: var(--btn-hover-shadow);
    color: var(--btn-hover-fg);

    &::before {
      background-color: var(--btn-bolt-hover-fill);
    }
  }

  @media (hover: hover) and (pointer: fine) {
    &:hover {
      background: var(--btn-hover-bg);
      box-shadow: var(--btn-hover-shadow);
      color: var(--btn-hover-fg);

      &::before,
      &::after {
        rotate: 0deg;
        scale: 1.25;
      }

      &::before {
        background-color: var(--btn-bolt-hover-fill);
      }

      &::after {
        opacity: 1;
      }
    }

    &:active {
      background: var(--btn-active-bg);
      box-shadow: var(--btn-active-shadow);
      color: var(--btn-active-fg);

      &::before,
      &::after {
        rotate: 180deg;
        scale: 1;
      }

      &::before {
        background-color: var(--btn-bolt-active-fill);
      }
    }
  }
}

/* "Decline all" is outlined, so the two choices don't look the same */
.ch2 .ch2-deny-all-btn:not(.ch2-btn-text) {
  --btn-bg: transparent;
  --btn-fg: var(--theme-cookie-text);
  --btn-shadow: inset 0 0 0 2px var(--theme-cookie-divider);
  --btn-transition: background-color 0.25s ease-out, box-shadow 0.25s ease-out;
  --btn-hover-bg: var(--theme-cookie-panel);
  --btn-hover-fg: var(--theme-cookie-text);
  --btn-hover-shadow: inset 0 0 0 2px
    color-mix(in srgb, var(--theme-cookie-text) 32%, transparent);
  --btn-active-bg: var(--theme-cookie-divider);
  --btn-active-fg: var(--theme-cookie-text);
  --btn-active-shadow: inset 0 0 0 2px
    color-mix(in srgb, var(--theme-cookie-text) 32%, transparent);
  --btn-bolt-fill: var(--theme-cookie-text);
  --btn-bolt-glow: var(--theme-cookie-text);
  --btn-bolt-hover-fill: var(--theme-cookie-text);
  --btn-bolt-active-fill: var(--theme-cookie-text);
}

/* Text button: components/button/TextButton (the hover sweeps a gradient
   through the label) */
.ch2 .ch2-btn-text {
  -webkit-background-clip: text, text;
  background-clip: text, text;
  background-image:
    linear-gradient(var(--text-btn-fg), var(--text-btn-fg)),
    var(--text-btn-hover-bg);
  background-position:
    100% 0,
    0 0;
  background-repeat: no-repeat;
  background-size:
    100% 100%,
    100% 100%;
  border-radius: 0;
  box-shadow: none;
  color: var(--text-btn-fg);
  display: inline-block;
  height: auto;
  min-width: auto;
  /* Room for descenders: the gradient only paints inside the box */
  line-height: 1.2;
  padding: 0.25em 0;
  -webkit-text-fill-color: transparent;
  transition: background-size 0.25s ease-out;

  &:hover,
  &:focus-visible {
    background-size:
      0% 100%,
      100% 100%;
  }

  &:active {
    background-image:
      linear-gradient(var(--text-btn-fg), var(--text-btn-fg)),
      var(--text-btn-active-bg);
  }
}

/* Settings dialog */
.ch2-settings {
  background: var(--theme-cookie-surface);
  border-radius: 32px;
  box-shadow: var(--btn-shadow);
  display: none;
  left: 50%;
  outline: none;
  overflow: hidden;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 705px;
  z-index: 700001;

  @media (max-height: 600px) {
    position: absolute;
    top: 0;
    transform: translate(-50%);
  }

  @media (max-width: 800px) {
    border-radius: 0;
    bottom: 0;
    left: 0;
    top: 0;
    transform: none;
    width: 100%;
  }

  &.ch2-visible {
    display: block;

    @media (min-width: 801px) {
      animation: ch2-settings-in 0.2s ease-out;
    }
  }
}

.ch2-settings-header {
  color: var(--theme-cookie-text);
  height: 80px !important;
  line-height: 80px;
  padding: 0 35px;

  & p {
    display: inherit;
    height: 80px;
    line-height: 80px !important;
    margin: 0;
    outline: 0;
    overflow: hidden;
    padding-top: 2px;
    white-space: nowrap;

    & strong {
      font-size: 22px;
      font-weight: 700;

      @media (max-width: 800px) {
        font-size: 3.1vw;
      }

      @media (max-width: 450px) {
        font-size: 4.2vw;
      }
    }
  }

  /* Close (✕), shown once a choice has been made */
  & button {
    background-color: transparent;
    border: none;
    cursor: pointer;
    display: block;
    float: right;
    height: 40px;
    margin: 21px 0 0;
    padding: 0;
    width: 40px;

    &::before,
    &::after {
      border-bottom: 2px solid var(--theme-cookie-muted);
      content: "";
      display: block;
      left: 8px;
      position: relative;
      top: 0;
      transition: all 0.3s ease;
      width: 25px;
    }

    &::before {
      top: 2px;
      transform: rotate(-45deg);
    }

    &::after {
      transform: rotate(45deg);
    }

    &:hover::before,
    &:hover::after {
      border-bottom-color: var(--theme-cookie-text);
    }
  }
}

.ch2-settings-tabs {
  margin: 0 1px;
  max-height: 100px;
  overflow: hidden;
  position: relative;
  width: 100%;
  z-index: -10;

  & ul {
    list-style: none;
    margin: 0;
    min-width: calc(100% - 70px);
    padding: 0 35px;
    white-space: nowrap;

    @media (max-width: 800px) {
      min-width: calc(100% - 30px);
      padding: 0 15px;
    }
  }

  & li {
    display: inline-block;
    margin-bottom: 0 !important;
    padding: initial;

    &::before {
      display: none;
    }
  }

  & li :is(a, button) {
    background: none;
    border: 1px solid transparent;
    border-radius: 16px 16px 0 0;
    color: var(--theme-cookie-muted);
    cursor: pointer;
    display: block;
    font: inherit;
    margin: 0;
    padding: 10px 20px;
    position: relative;
    top: 1px;

    &:hover {
      background: var(--theme-cookie-panel);
      color: var(--theme-cookie-text);
    }

    &.active {
      background: var(--theme-cookie-surface);
      border-color: var(--theme-cookie-divider);
      border-bottom-color: var(--theme-cookie-surface);
      color: var(--theme-cookie-text);
    }
  }

  & .ch2-settings-tablist-wrap {
    margin: 0 1px;
    overflow: hidden;
    width: 100%;
  }

  & .ch2-settings-tablist {
    position: relative;
  }

  /* Arrows when the tabs overflow */
  & .ch2-settings-scroller {
    color: var(--theme-cookie-muted);
    cursor: pointer;
    direction: ltr;
    font-size: 24px;
    font-weight: 600;
    line-height: 20px;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    user-select: none;
    z-index: 10;
  }

  & .ch2-scroller-left {
    background: linear-gradient(
      90deg,
      var(--theme-cookie-surface),
      var(--theme-cookie-surface) 70%,
      transparent
    );
    float: left;
    left: 0;
    padding: 8px 25px 8px 15px;
  }

  & .ch2-scroller-right {
    background: linear-gradient(
      270deg,
      var(--theme-cookie-surface),
      var(--theme-cookie-surface) 70%,
      transparent
    );
    float: right;
    padding: 8px 15px 8px 25px;
    right: 0;
  }
}

.ch2-settings-content {
  max-height: 500px;
  overflow-y: auto;
  padding: 20px 35px;
  scrollbar-color: var(--theme-cookie-divider) transparent;

  @media (max-height: 700px) {
    max-height: 350px;
  }

  @media (max-height: 600px) {
    max-height: none;
    overflow-y: hidden;
  }

  @media (max-width: 800px) {
    height: calc(100vh - 251px);
    max-height: inherit;
    overflow-y: auto;
  }

  & p {
    color: var(--theme-cookie-muted);
    font-size: 15px;
    line-height: 24px;
    margin: 0 0 4px;

    & strong {
      color: var(--theme-cookie-text);
      font-size: 20px;
      font-weight: 700;
      line-height: 1;
    }
  }

  & h3 {
    color: var(--theme-cookie-text);
    font-size: 17px;
    font-weight: 700;
    line-height: 24px;
    margin: 0 0 4px;
  }

  & dd,
  & dt,
  & span {
    color: var(--theme-cookie-muted);
  }

  & a {
    border-bottom: 1px solid var(--theme-cookie-divider);
    color: var(--theme-cookie-text);

    &:hover {
      border-bottom-color: var(--theme-cookie-text);
    }
  }

  & .ch2-settings-tab-container {
    @media (max-width: 800px) {
      padding-bottom: 60px;
    }

    /* "Powered by CookieHub", which the actions bar shows on desktop */
    & > p:last-child {
      color: var(--theme-cookie-muted);
      font-size: 11px;
      margin: 0;

      @media (min-width: 801px) {
        display: none;
      }

      & a {
        color: var(--theme-cookie-muted);
        font-weight: 700;
      }
    }

    & > button {
      margin-right: 10px;
      margin-top: 20px;

      @media (max-width: 800px) {
        display: flex;
        width: calc(100% - 80px);

        &.ch2-deny-all-btn {
          margin-top: 10px;
        }
      }
    }
  }
}

/* Categories */
.ch2-settings-options {
  margin: 40px 0 0;
}

.ch2-settings-option {
  display: flex;
  margin-bottom: 25px;
  position: relative;

  & > :first-child {
    padding-top: 3px;
  }

  & > :last-child {
    flex-grow: 1;
    padding-left: 30px;

    @media (max-width: 800px) {
      padding-left: 15px;
    }
  }

  & p {
    font-size: 14px;
    margin: 0 !important;

    & strong {
      font-size: 16px;
    }
  }
}

/* Services in a category, each expandable to its cookies */
.ch2-settings-options2 {
  border: 0;
  margin: 6px 0 0;
}

.ch2-settings-option2 {
  & .ch2-settings-option-details {
    background-color: var(--theme-cookie-panel);
    border-color: var(--theme-cookie-divider);
  }

  & .ch2-collapse-toggler {
    display: flex;

    & > a {
      border-bottom: 0;
      flex-grow: 1;
      font-size: 16px;
      line-height: 1.5em;
      margin-left: 21px;
      padding: 7px 15px 7px 5px;

      /* Chevron */
      &::before {
        border: solid var(--theme-cookie-text);
        border-width: 0 2px 2px 0;
        content: "";
        float: left;
        margin: 8px 16px 0 -25px;
        padding: 3px;
        transform: rotate(-45deg);
      }

      &[aria-expanded="true"]::before {
        margin: 6px 14px 0 -23px;
        transform: rotate(45deg);
      }
    }
  }

  & .ch2-collapse-content {
    border-radius: 16px;
    display: flex; /* collapsed: CookieHub sets display: none inline */
    flex-direction: column;
    gap: 12px;
    padding: 16px;

    & p {
      color: var(--theme-cookie-muted);

      &:empty {
        display: none;
      }
    }

    & ul {
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      list-style: none;
      margin: 0;
      padding: 0;
    }

    & li {
      color: var(--theme-cookie-text);
    }

    /* A service's cookie names */
    & .ch2-settings-so-cookies {
      & li {
        border: 1px solid var(--theme-cookie-divider);
        border-radius: 100px;
        font-size: 14px;
        line-height: 1.5;
        padding: 4px 12px;
      }
    }
  }
}

/* Category on/off */
.ch2-switch {
  direction: ltr;

  & input {
    display: block !important;
    opacity: 0;
    position: absolute;
  }

  /* CookieHub's label text is a control character (\b); Mark Pro draws it as
     a box, hence font-size: 0 */
  & label {
    background: var(--theme-cookie-divider);
    border-radius: 17px;
    color: transparent;
    cursor: pointer;
    display: block !important;
    font-size: 0;
    height: 17px;
    line-height: 25px;
    min-height: auto !important;
    overflow: hidden;
    padding: 0 !important;
    transition: background 0.3s ease;
    white-space: nowrap;
    width: 34px;

    &::before {
      background-color: var(--color-white);
      border: 0 !important;
      border-radius: 100% !important;
      box-shadow: 0 0 2px 0 rgba(0, 0, 0, 0.2);
      content: "" !important;
      display: block !important;
      height: 13px !important;
      left: 2px;
      padding: 0 !important;
      position: relative !important;
      top: 2px !important;
      transition: left 0.3s ease-out;
      width: 13px !important;
    }

    &::after {
      display: none;
    }
  }

  & input:focus + label {
    outline: thin solid var(--theme-cookie-text);
    outline-offset: 4px;
  }

  & input:disabled + label::before {
    background: var(--theme-cookie-divider) !important;
  }

  & input:checked + label {
    background: var(--theme-cookie-switch-on);

    &::before {
      left: 19px;
    }
  }
}

/* Shown when the browser sends Global Privacy Control */
.ch2 .ch2-gpc-notice {
  align-items: center;
  background: var(--theme-cookie-panel);
  border: 1px solid var(--theme-cookie-divider);
  border-left-width: 4px;
  border-radius: 4px;
  color: inherit;
  display: flex;
  font-size: 0.9em;
  gap: 10px;
  line-height: 1.35;
  margin: 12px 20px 4px;
  padding: 10px 14px;

  & .ch2-gpc-notice-icon {
    background-color: currentColor;
    flex: 0 0 18px;
    height: 18px;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="10"/><path d="M9 12l2 2 4-4"/></svg>')
      no-repeat center/contain;
    opacity: 0.7;
    width: 18px;
  }

  & .ch2-gpc-notice-text {
    flex: 1;
  }
}

/* Cookie declaration tab */
.ch2-settings-declaration {
  & p {
    font-size: 15px;
    margin: 0 0 5px;

    &:first-child {
      margin-bottom: 4px;
    }

    &.ch2-header {
      margin-bottom: 5px;
      margin-top: 30px;
    }

    & strong {
      font-size: 16px;
    }
  }

  & .ch2-declaration-choice {
    margin-top: 30px;
  }

  /* No intro text in CookieHub: no gap above the first heading */
  &.ch2-declaration-no-message {
    & > .ch2-declaration-choice:empty + .ch2-settings-options,
    &
      > .ch2-declaration-choice:empty
      + .ch2-settings-options
      > .ch2-declaration-category:first-child
      > .ch2-header,
    & > .ch2-declaration-choice:first-child,
    & > .ch2-declaration-choice:first-child > .ch2-header:first-child,
    & > .ch2-settings-options:first-child,
    &
      > .ch2-settings-options:first-child
      > .ch2-declaration-category:first-child
      > .ch2-header {
      margin-top: 0;
    }
  }

  /* The visitor's consent, after a choice */
  & dl {
    margin: 0 0 5px;
  }

  & dd,
  & dt {
    font-size: 14px;
    line-height: 14px;
    margin: 0;
  }

  & dt {
    font-weight: 700;
    margin-bottom: 6px;
    margin-top: 16px;
  }

  & table {
    border: 0;
    border-spacing: 0;
    margin: 0 0 40px;
    padding: 0;
    width: 100%;

    & caption {
      display: none;
    }

    & thead {
      @media (max-width: 800px) {
        display: none;
      }
    }

    & th,
    & td {
      padding: 15px 15px 10px;
      text-align: left;

      &:last-child {
        text-align: right;
      }
    }

    & th {
      color: var(--theme-cookie-muted);
    }

    & td {
      background: var(--theme-cookie-panel);
      color: var(--theme-cookie-text);

      &[colspan] {
        padding-bottom: 15px;
        padding-top: 5px;
        text-align: left;
      }

      & a {
        border-bottom: 0 !important;
      }

      & p {
        background: transparent;
        margin: 0;
        padding: 10px 15px;
      }

      & span {
        background: var(--theme-cookie-divider);
        border-radius: 4px;
        color: var(--theme-cookie-text);
        display: inline-block;
        font-size: 12px;
        padding: 4px 8px;
        white-space: nowrap;
      }

      /* Name, hostname, path */
      @media (min-width: 801px) {
        &:not([colspan]) {
          vertical-align: top;

          &:nth-child(-n + 3) {
            line-break: anywhere;
          }

          &:first-child,
          &:nth-child(3) {
            max-width: 140px;
          }

          &:nth-child(2) {
            max-width: 120px;
          }
        }
      }

      /* One cell per line, labelled */
      @media (max-width: 800px) {
        &[colspan] {
          padding: 8px 15px 20px;
        }

        &:not([colspan]) {
          display: block;
          padding: 8px 20px;
          text-align: left;

          &::before {
            font-weight: 700;
          }

          &:first-child::before {
            content: var(--ch-cookie-name-label, "Name: ");
          }

          &:nth-child(2)::before {
            content: var(--ch-cookie-hostname-label, "Hostname: ");
          }

          &:nth-child(3)::before {
            content: var(--ch-cookie-path-label, "Path: ");
          }

          &:nth-child(4)::before {
            content: var(--ch-cookie-expiry-label, "Expiry: ");
          }

          &:nth-child(5) {
            display: none;
          }
        }
      }
    }

    & tr:first-child td {
      @media (max-width: 800px) {
        padding-top: 15px;
      }
    }

    &.cutoff td:not([colspan]):nth-child(-n + 3) {
      @media (min-width: 801px) {
        line-break: normal;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }
    }
  }
}

/* Host lists in the declaration */
.ch2-hosts {
  display: inline-block;
  vertical-align: top;
  word-wrap: anywhere;

  &:not([open]) .ch2-hosts-less,
  &[open] .ch2-hosts-count {
    display: none;
  }
}

.ch2-hosts-more {
  cursor: pointer;
  list-style: none;
  min-height: 24px;

  &::-webkit-details-marker {
    display: none;
  }
}

.ch2-hosts-count,
.ch2-hosts-less {
  background: var(--theme-cookie-panel);
  border-radius: 999px;
  display: inline-block;
  font-size: 0.8em;
  line-height: 1.5;
  min-width: 2.6em;
  padding: 1px 6px;
  text-align: center;
  white-space: nowrap;
}

.ch2-settings-actions {
  background: var(--theme-cookie-surface);
  border-top: 1px solid var(--theme-cookie-divider);
  display: flex;
  flex-direction: row-reverse;
  padding: 22px 35px;

  @media (max-width: 800px) {
    bottom: 0;
    left: 0;
    position: fixed;
    right: 0;

    & button {
      width: calc(100% - 80px);
    }
  }

  /* "Powered by CookieHub" */
  & p {
    align-self: flex-end;
    color: var(--theme-cookie-muted);
    flex-grow: 1;
    font-size: 11px;
    margin: 0;
    padding-bottom: 4px;
    text-align: right;

    @media (max-width: 800px) {
      display: none;
    }

    & a {
      color: var(--theme-cookie-muted);

      &:hover {
        text-decoration: underline;
      }
    }
  }
}

/* Floating settings icon: hidden, the footer's cookie settings link replaces it */
.ch2-icon {
  display: none !important;
}

/* CookieHub's declaration embedded in a page */
.cookiehub-declaration table > caption {
  display: none;
}

@keyframes ch2-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes ch2-banner-in {
  from {
    opacity: 0;
    visibility: hidden;
  }
}

@keyframes ch2-settings-in {
  from {
    top: 50%;
    transform: translate(-50%, -100%);
  }
  to {
    top: 50%;
    transform: translate(-50%, -50%);
  }
}

/*
  CookieHub adds .ch2-block (and an inline `overflow: hidden` on <body>) for
  both the banner and the settings dialog. Only the settings dialog blocks the
  page: it gets the backdrop, and scrolling is locked on <html>. <body> keeps
  the clip from styles/globals.css, because `hidden` would make it a scroll
  container, which breaks sticky elements and lets the page scroll sideways.
*/
.ch2-block:has(.ch2-settings.ch2-visible) {
  background: var(--theme-cookie-backdrop);
  inset: 0;
  position: fixed;
  z-index: 700000;
}

html:has(.ch2-settings.ch2-visible) {
  overflow: hidden;
}

body:has(.ch2-container) {
  overflow-x: hidden !important;
  overflow-x: clip !important;
  overflow-y: clip !important;
}
