/* Cookie consent components: isolated from the site's general UI classes. */
.cookie-banner,
.cookie-dialog,
.map-consent-note {
  box-sizing: border-box;
  color: var(--ink, #252638);
  font-family: var(--font-body, "DM Sans"), sans-serif;
  font-size: 16px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.cookie-banner *,
.cookie-dialog *,
.map-consent-note * {
  box-sizing: border-box;
}

/* Native hidden states must win over layout declarations. */
.cookie-banner[hidden],
.cookie-banner [hidden],
.cookie-dialog[hidden],
.cookie-dialog [hidden],
.cookie-settings-link[hidden],
.map-consent-note[hidden],
.map-consent-note [hidden] {
  display: none !important;
}

.cookie-banner {
  position: fixed;
  z-index: 90;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: calc(16px + env(safe-area-inset-left, 0px));
  width: auto;
  max-width: 1180px;
  max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  margin-inline: auto;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--blue, #4e5cb1);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgb(25 30 60 / 16%);
}

.cookie-banner-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 24px;
}

.cookie-copy {
  flex: 1 1 360px;
  min-width: 0;
}

.cookie-copy h2,
.cookie-dialog-header h2 {
  margin: 0;
  color: var(--ink, #252638);
  font: inherit;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.3;
}

.cookie-copy p {
  margin: 10px 0 0;
  font-size: 16px;
  line-height: 1.6;
}

.cookie-copy a,
.cookie-dialog-meta a {
  color: var(--blue, #4e5cb1);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.cookie-copy a:hover,
.cookie-dialog-meta a:hover {
  text-decoration-thickness: 2px;
}

.cookie-actions,
.cookie-dialog-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  min-width: 0;
}

.cookie-actions {
  flex: 1 1 520px;
}

.cookie-action,
.cookie-actions .cookie-open,
.cookie-dialog-actions .cookie-open,
.map-consent-note .cookie-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 44px;
  height: auto;
  max-width: 100%;
  margin: 0;
  padding: 11px 16px;
  border: 2px solid var(--blue, #4e5cb1);
  border-radius: 8px;
  background: #fff;
  color: var(--blue, #4e5cb1);
  font-family: var(--font-body, "DM Sans"), sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: background-color 150ms ease, box-shadow 150ms ease;
}

/* Accept all and necessary-only are deliberately equally prominent. */
.cookie-action[data-consent="all"],
.cookie-action[data-consent="necessary"] {
  background: var(--blue, #4e5cb1);
  color: #fff;
}

.cookie-action:hover,
.cookie-actions .cookie-open:hover,
.cookie-dialog-actions .cookie-open:hover,
.map-consent-note .cookie-open:hover {
  box-shadow: inset 0 0 0 1px var(--blue, #4e5cb1);
}

.cookie-action:not([data-consent="all"]):not([data-consent="necessary"]):hover,
.cookie-actions .cookie-open:hover,
.cookie-dialog-actions .cookie-open:hover,
.map-consent-note .cookie-open:hover {
  background: var(--lavender, #f0eff9);
}

.cookie-dialog {
  width: min(600px, calc(100vw - 32px));
  min-width: 0;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 28px;
  overflow: auto;
  overscroll-behavior: contain;
  background: #fff;
  border: 1px solid var(--blue, #4e5cb1);
  border-radius: 16px;
  box-shadow: 0 16px 56px rgb(25 30 60 / 24%);
}

/* Do not assign display to the dialog itself: closed native dialogs stay closed. */
.cookie-dialog::backdrop {
  background: rgb(20 24 45 / 55%);
}

.cookie-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cookie-dialog-header h2 {
  flex: 1 1 auto;
  min-width: 0;
  padding-block: 7px;
}

.cookie-close {
  flex: 0 1 auto;
  min-width: 0;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid var(--blue, #4e5cb1);
  border-radius: 8px;
  background: #fff;
  color: var(--blue, #4e5cb1);
  font-family: var(--font-body, "DM Sans"), sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.cookie-close:hover {
  background: var(--lavender, #f0eff9);
}

.cookie-dialog-intro {
  margin: 16px 0 20px;
  font-size: 16px;
  line-height: 1.6;
}

.cookie-category {
  min-width: 0;
  margin: 0 0 14px;
  padding: 18px;
  background: var(--lavender, #f0eff9);
  border: 1px solid transparent;
  border-radius: 10px;
}

.cookie-category h3 {
  margin: 0;
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
}

.cookie-category p {
  margin: 8px 0 0;
  color: var(--muted, #55586c);
  font-size: 14px;
  line-height: 1.6;
}

.cookie-required {
  display: inline-block;
  max-width: 100%;
  margin-top: 10px;
  color: var(--ink, #252638);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.cookie-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  min-height: 44px;
  margin-top: 12px;
  padding: 10px 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}

.cookie-option input[type="checkbox"] {
  flex: 0 0 22px;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--blue, #4e5cb1);
  cursor: pointer;
}

.cookie-option span {
  flex: 1 1 auto;
  min-width: 0;
}

.cookie-dialog-actions {
  margin-top: 22px;
}

.cookie-dialog-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 18px;
  font-size: 14px;
  line-height: 1.6;
}

.cookie-settings-link {
  display: inline-block;
  min-height: 44px;
  max-width: 100%;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--blue, #4e5cb1);
  font-family: var(--font-body, "DM Sans"), sans-serif;
  font-size: 16px;
  line-height: 1.5;
  text-align: start;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

footer .cookie-settings-link {
  font-size: 14px;
}

.cookie-settings-link:hover {
  text-decoration-thickness: 2px;
}

.map-consent-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  width: 100%;
  min-width: 0;
  height: 100%;
  min-height: 180px;
  padding: 24px;
  background: var(--lavender, #f0eff9);
  text-align: center;
}

.map-consent-note p {
  max-width: 46ch;
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
}

.cookie-action:focus-visible,
.cookie-open:focus-visible,
.cookie-close:focus-visible,
.cookie-settings-link:focus-visible,
.cookie-copy a:focus-visible,
.cookie-dialog-meta a:focus-visible,
.cookie-option input:focus-visible {
  outline: 3px solid var(--ink, #252638);
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fff;
}

@media (max-width: 1000px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
  }

  .cookie-copy,
  .cookie-actions {
    flex: 0 1 auto;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .cookie-banner {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    max-height: 70vh;
    max-height: 70dvh;
    border-radius: 12px;
  }

  .cookie-banner-inner {
    gap: 18px;
    padding: 20px;
  }

  .cookie-copy h2,
  .cookie-dialog-header h2 {
    font-size: 20px;
  }

  .cookie-actions,
  .cookie-dialog-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .cookie-actions > :last-child:nth-child(odd),
  .cookie-dialog-actions > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .cookie-dialog {
    padding: 20px;
  }

  .cookie-category {
    padding: 16px;
  }

  .cookie-option {
    min-height: 48px;
    padding-block: 12px;
  }
}

@media (max-width: 480px) {
  .cookie-actions,
  .cookie-dialog-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .cookie-dialog-header {
    flex-wrap: wrap;
    gap: 8px 12px;
  }

  .cookie-dialog-header h2 {
    flex-basis: 100%;
  }

  .map-consent-note {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-action,
  .cookie-actions .cookie-open,
  .cookie-dialog-actions .cookie-open,
  .map-consent-note .cookie-open {
    transition: none;
  }
}
