/*
 * Cookie banner (cookie_banner.php). Colours and font come in as custom properties
 * from the site's config; everything else is scoped to .cb / .cb-reopen and resets
 * what old site stylesheets tend to set globally on p, div, a, input and button.
 */
html.cb-open {
  overflow: hidden !important;
}

dialog.cb {
  --cb-text: #2b2b2b;
  --cb-muted: #5f5f5f;
  --cb-line: #dcdcdc;
  --cb-bg: #ffffff;

  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 680px;
  max-height: calc(100% - 32px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 6px;
  background: var(--cb-bg);
  color: var(--cb-text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  font-family: var(--cb-font, Arial, Helvetica, sans-serif);
  font-size: 15px;
  line-height: 1.5;
  text-align: left;
}

dialog.cb:not([open]) {
  display: none;
}

/* Browsers without showModal(): the open attribute alone, centred by hand. */
dialog.cb[open]:not(:modal) {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
}

dialog.cb::backdrop {
  background: rgba(0, 0, 0, 0.6);
}

dialog.cb:focus {
  outline: none;
}

.cb *,
.cb *::before,
.cb *::after {
  box-sizing: border-box;
}

.cb p,
.cb div,
.cb span,
.cb label,
.cb summary,
.cb strong,
.cb a,
.cb button {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  word-wrap: break-word;
}

.cb p,
.cb div,
.cb span,
.cb label,
.cb summary,
.cb strong {
  color: inherit;
}

.cb p {
  margin: 0 0 12px;
  padding: 0;
}

.cb .cb-inner {
  padding: 24px;
}

.cb a:link,
.cb a:visited {
  color: inherit;
  font-weight: inherit;
  text-decoration: underline;
}

.cb a:hover,
.cb a:focus {
  color: var(--cb-primary);
}

.cb a:focus-visible,
.cb button:focus-visible,
.cb summary:focus-visible,
.cb input:focus-visible {
  outline: 2px solid var(--cb-primary);
  outline-offset: 2px;
}

.cb .cb-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
  margin-bottom: 12px;
}

.cb .cb-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
}

.cb .cb-links {
  margin: 0;
  font-size: 13px;
  color: var(--cb-muted);
}

.cb .cb-categories {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
  padding: 16px 0;
  border-top: 1px solid var(--cb-line);
  border-bottom: 1px solid var(--cb-line);
}

.cb .cb-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
  cursor: pointer;
}

.cb .cb-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--cb-primary);
  cursor: pointer;
}

.cb .cb-check input:disabled {
  cursor: default;
}

.cb .cb-details {
  margin-top: 4px;
  font-size: 13px;
  color: var(--cb-muted);
}

.cb .cb-details summary {
  display: inline-block;
  cursor: pointer;
  text-decoration: underline;
  list-style: none;
}

.cb .cb-details summary::-webkit-details-marker {
  display: none;
}

.cb .cb-details summary::before {
  content: '▸ ';
}

.cb .cb-details[open] summary::before {
  content: '▾ ';
}

.cb .cb-details p {
  margin: 6px 0 0;
}

.cb .cb-hint {
  font-weight: 700;
  text-align: center;
}

/* All three choices look the same: rejecting must be as easy as accepting. */
.cb .cb-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cb .cb-button {
  flex: 1 1 180px;
  margin: 0;
  padding: 10px 16px;
  border: 2px solid var(--cb-primary);
  border-radius: 4px;
  background: var(--cb-primary);
  color: var(--cb-primary-text);
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.cb .cb-button:hover {
  filter: brightness(1.1);
}

.cb-reopen {
  position: fixed;
  bottom: 12px;
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 50%;
  background: var(--cb-primary, #333333);
  color: var(--cb-primary-text, #ffffff);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  cursor: pointer;
}

.cb-reopen-left {
  left: 12px;
}

.cb-reopen-right {
  right: 12px;
}

@media (max-width: 480px) {
  .cb .cb-inner {
    padding: 16px;
  }

  .cb .cb-title {
    font-size: 18px;
  }
}
