/* Cookie consent banner. Accent follows the project via --primary-blue. */

/* Some projects (sendform) set --container-bg within a few percent of the
   page background, so surface color alone does not read as an overlay.
   The lift comes from the shadow and the accent edge, not the fill. */
.base-consent {
  position: fixed;
  z-index: 9999;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--container-bg, #fff);
  border-top: 2px solid var(--primary-blue, #fb596e);
  box-shadow:
    0 -8px 20px rgba(0, 0, 0, 0.28),
    0 -1px 0 rgba(0, 0, 0, 0.12);
  color: var(--text-color, #1a1d23);
  display: none;
}

.base-consent.base-consent--visible {
  display: block;
}

.base-consent__inner {
  max-width: 1200px;
  margin: 0 auto !important;
  padding: 20px 22px;
}

.base-consent__row {
  display: flex;
  gap: 28px 40px;
  align-items: center;
  flex-wrap: wrap;
}

/* Cap the copy instead of letting it stretch - on wide pages a growing
   flex child pushes the actions to the far edge and opens a dead gap. */
.base-consent__copy {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 68ch;
}

/* Framework h2/h3 set --heading-color, 30px/22px and big margins. Reassert
   all of it, including color - the inherited one can be invisible on the
   banner surface. */
.base-consent__copy h2 {
  font-size: 15px;
  font-weight: 620;
  line-height: 1.3;
  margin: 0 0 5px;
  padding: 0;
  border: none;
  letter-spacing: normal;
  color: var(--text-color, #1a1d23);
}

.base-consent__copy p {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted-text, #5b6472);
  max-width: 60ch;
}

.base-consent__copy a {
  color: var(--primary-blue, #fb596e);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.base-consent__actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  align-items: center;
  flex-wrap: wrap;
  /* eduloo (and similar) ship a universal `* { margin: 0 }` reset that
     outranks this by load order - !important is required to center/push. */
  margin-left: auto !important;
}

/* Buttons. base_elements.css styles all <button> with !important, so every
   property we care about has to be re-asserted the same way. */
.base-consent__btn {
  font-family: inherit !important;
  font-size: 13.5px !important;
  font-weight: 550 !important;
  padding: 9px 18px !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  border: 1px solid var(--border-color, #d6dae1) !important;
  background: var(--container-bg, #fff) !important;
  color: var(--text-color, #1a1d23) !important;
  white-space: nowrap !important;
  width: auto !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  box-shadow: none !important;
  transition:
    filter 0.13s ease,
    background 0.13s ease;
}

/* base_elements.css `button:hover` forces a color-mix background AND
   color: var(--text-color); both need re-asserting per variant. */
.base-consent .base-consent__btn:hover {
  background: var(--bg-dark, #f4f6f9) !important;
  color: var(--text-color, #1a1d23) !important;
}

.base-consent__btn:focus-visible {
  outline: 2px solid var(--primary-blue, #fb596e) !important;
  outline-offset: 2px !important;
}

.base-consent__btn--accent {
  background: var(--primary-blue, #fb596e) !important;
  border-color: var(--primary-blue, #fb596e) !important;
  color: #fff !important;
}

.base-consent .base-consent__btn--accent:hover {
  background: var(
    --primary-blue-hover,
    var(--primary-blue, #fb596e)
  ) !important;
  border-color: var(
    --primary-blue-hover,
    var(--primary-blue, #fb596e)
  ) !important;
  color: #fff !important;
}

/* Categories */
.base-consent__cats {
  display: none;
  border-top: 1px solid var(--border-color, #d6dae1);
  background: var(--bg-dark, #f4f6f9);
}

.base-consent--expanded .base-consent__cats {
  display: block;
}

.base-consent--expanded .base-consent__actions {
  display: none;
}

/* Same max-width + padding as __inner so rows line up with the copy above. */
.base-consent__cat {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-color, #d6dae1);
  max-width: 1200px;
  margin: 0 auto !important;
}

.base-consent__cat:last-child {
  border-bottom: none;
}

.base-consent__cat-text {
  flex: 1 1 auto;
  min-width: 0;
}

.base-consent__cat-text h3 {
  font-size: 13.5px;
  font-weight: 620;
  line-height: 1.3;
  margin: 0 0 3px;
  padding: 0;
  border: none;
  letter-spacing: normal;
  color: var(--text-color, #1a1d23);
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.base-consent__cat-text p {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted-text, #5b6472);
  max-width: 68ch;
}

.base-consent__tag {
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--border-color, #d6dae1);
  color: var(--muted-text, #5b6472);
  background: var(--container-bg, #fff);
}

/* Switches */
.base-consent__sw {
  flex: 0 0 auto;
  position: relative;
  width: 40px;
  height: 23px;
}

.base-consent__sw input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}

/* Off-state needs to read against the category row, which is already a
   tinted surface - --border-color is too close to it in light themes. */
.base-consent__track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text-color, #1a1d23) 28%, transparent);
  transition: background 0.16s ease;
}

.base-consent__track::after {
  content: '';
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  transition: transform 0.16s ease;
}

.base-consent__sw input:checked + .base-consent__track {
  background: var(--primary-blue, #fb596e);
}

.base-consent__sw input:checked + .base-consent__track::after {
  transform: translateX(17px);
}

.base-consent__sw input:focus-visible + .base-consent__track {
  outline: 2px solid var(--primary-blue, #fb596e);
  outline-offset: 2px;
}

.base-consent__sw--locked .base-consent__track {
  background: var(--muted-text, #8a919c);
}

.base-consent__sw--locked .base-consent__track::after {
  transform: translateX(17px);
}

.base-consent__sw--locked input {
  cursor: not-allowed;
}

/* Full-width divider + surface, content capped to match the rows above. */
.base-consent__foot {
  border-top: 1px solid var(--border-color, #d6dae1);
  background: var(--container-bg, #fff);
}

.base-consent__foot-inner {
  display: flex;
  gap: 10px;
  padding: 16px 22px;
  flex-wrap: wrap;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto !important;
}

.base-consent__spacer {
  flex: 1 1 auto;
}

/* Phone. Stack full width; accent moves to Save once categories are open. */
@media (max-width: 620px) {
  .base-consent__inner {
    padding: 16px 16px 18px;
  }

  .base-consent__row {
    gap: 16px;
  }

  .base-consent__copy {
    flex: 1 1 100%;
  }

  /* column-reverse on source order Reject > Customize > Accept puts Accept
     nearest the thumb without making the destructive action the easy one. */
  .base-consent__actions {
    width: 100%;
    flex-direction: column-reverse;
    gap: 8px;
    margin-left: 0 !important;
  }

  .base-consent__actions .base-consent__btn {
    width: 100% !important;
    padding: 13px 18px !important;
    font-size: 15px !important;
  }

  .base-consent__cat {
    padding: 14px 16px;
    gap: 12px;
  }

  .base-consent__foot-inner {
    padding: 14px 16px;
    flex-direction: column;
    gap: 8px;
  }

  .base-consent__spacer {
    display: none;
  }

  .base-consent__foot-inner .base-consent__btn {
    width: 100% !important;
    padding: 13px 18px !important;
    font-size: 15px !important;
    order: 2;
  }

  .base-consent__foot-inner .base-consent__btn--save,
  .base-consent .base-consent__foot-inner .base-consent__btn--save:hover {
    order: 1;
    background: var(--primary-blue, #fb596e) !important;
    border-color: var(--primary-blue, #fb596e) !important;
    color: #fff !important;
  }

  .base-consent__foot-inner .base-consent__btn--accent {
    order: 2;
    background: var(--container-bg, #fff) !important;
    border-color: var(--border-color, #d6dae1) !important;
    color: var(--text-color, #1a1d23) !important;
  }

  .base-consent__foot-inner .base-consent__btn--reject {
    order: 3;
  }

  /* 23px is too small for a thumb. */
  .base-consent__sw {
    width: 46px;
    height: 27px;
  }

  .base-consent__track::after {
    width: 22px;
    height: 22px;
  }

  .base-consent__sw input:checked + .base-consent__track::after,
  .base-consent__sw--locked .base-consent__track::after {
    transform: translateX(19px);
  }
}

/* Short viewport: scroll the categories, never the buttons. */
@media (max-height: 520px) and (max-width: 900px) {
  .base-consent {
    max-height: 92vh;
    display: none;
    flex-direction: column;
  }

  .base-consent.base-consent--visible {
    display: flex;
  }

  .base-consent__cats {
    overflow-y: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .base-consent *,
  .base-consent *::after {
    transition: none !important;
  }
}
