/* ===========================================================================
   Cookie consent — custom UI (UK GDPR + PECR)
   Original implementation (replaces vanilla-cookieconsent v3, which has an
   unresolved Chrome render bug — orestbida/cookieconsent#635). Reuses the
   site's existing CSS variables; no new design tokens. RTL via [dir="rtl"].
   All elements scoped under #itc-consent to avoid clashing with site styles.
   =========================================================================== */

#itc-consent,
#itc-consent * { box-sizing: border-box; }

#itc-consent {
  --itc-blue: var(--blue, #003CAA);
  --itc-navy: var(--navy, #0A1628);
  --itc-text: var(--text-dark, #0A1628);
  --itc-gray: var(--text-gray, #5A6B7D);
  --itc-line: #E2E8F0;
  font-family: inherit;
  color: var(--itc-text);
}

#itc-consent[hidden] { display: none !important; }

/* ---- shared button styling: equal visual prominence (no dark patterns) ---- */
.itc-btn {
  appearance: none;
  border: 1.5px solid var(--itc-blue);
  background: #fff;
  color: var(--itc-blue);
  font: inherit;
  font-weight: 600;
  font-size: .95rem;
  line-height: 1.2;
  padding: .7rem 1.15rem;
  border-radius: 8px;
  cursor: pointer;
  min-height: var(--tap, 44px);
  transition: background-color .15s ease, color .15s ease;
}
.itc-btn:hover { background: var(--light-bg, #F0F4F8); }
.itc-btn:focus-visible { outline: 3px solid var(--teal, #00A0FF); outline-offset: 2px; }
/* "Accept all" and "Reject all" share identical weight; only the fill differs
   so neither is visually nudged over the other (both solid, same size). */
.itc-btn--primary { background: var(--itc-blue); color: #fff; }
.itc-btn--primary:hover { background: var(--itc-navy); color: #fff; }

/* ----------------------------- banner (bottom bar) ----------------------------- */
.itc-banner {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  z-index: 2147483646;
  max-width: 560px;
  background: #fff;
  border: 1px solid var(--itc-line);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(10, 22, 40, .22);
  padding: 1.25rem 1.35rem;
}
.itc-banner__title {
  margin: 0 0 .4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--itc-navy);
}
.itc-banner__desc {
  margin: 0 0 1rem;
  font-size: .9rem;
  line-height: 1.55;
  color: var(--itc-gray);
}
.itc-banner__desc a { color: var(--itc-blue); text-decoration: underline; }
.itc-banner__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}
.itc-banner__actions .itc-btn { flex: 1 1 auto; }

/* ------------------------------- preferences modal ------------------------------- */
.itc-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  background: rgba(10, 22, 40, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.itc-modal {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(10, 22, 40, .35);
}
.itc-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 1.35rem .75rem;
  border-bottom: 1px solid var(--itc-line);
}
.itc-modal__title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--itc-navy); }
.itc-modal__close {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--itc-gray);
  cursor: pointer;
  padding: .1rem .4rem;
  border-radius: 6px;
}
.itc-modal__close:hover { color: var(--itc-navy); background: var(--light-bg, #F0F4F8); }
.itc-modal__close:focus-visible { outline: 3px solid var(--teal, #00A0FF); outline-offset: 2px; }
.itc-modal__body { padding: 1.1rem 1.35rem; }
.itc-modal__intro { margin: 0 0 1.1rem; font-size: .9rem; line-height: 1.55; color: var(--itc-gray); }
.itc-modal__intro a { color: var(--itc-blue); text-decoration: underline; }

.itc-cat {
  border: 1px solid var(--itc-line);
  border-radius: 10px;
  padding: .9rem 1rem;
  margin-bottom: .8rem;
}
.itc-cat__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .35rem;
}
.itc-cat__title { font-size: .98rem; font-weight: 600; color: var(--itc-navy); }
.itc-cat__desc { font-size: .85rem; line-height: 1.5; color: var(--itc-gray); margin: 0; }

/* toggle switch */
.itc-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.itc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.itc-switch__track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #cbd5e1; transition: background-color .15s ease; pointer-events: none;
}
.itc-switch__track::before {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px;
  width: 18px; height: 18px; border-radius: 50%; background: #fff;
  transition: transform .15s ease;
}
.itc-switch input:checked + .itc-switch__track { background: var(--green, #00C853); }
.itc-switch input:checked + .itc-switch__track::before { transform: translateX(20px); }
[dir="rtl"] .itc-switch input:checked + .itc-switch__track::before { transform: translateX(-20px); }
.itc-switch input:focus-visible + .itc-switch__track { outline: 3px solid var(--teal, #00A0FF); outline-offset: 2px; }
.itc-switch input:disabled { cursor: not-allowed; }
.itc-switch input:disabled + .itc-switch__track { background: var(--green, #00C853); opacity: .55; }

.itc-modal__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  padding: 1rem 1.35rem 1.35rem;
  border-top: 1px solid var(--itc-line);
}
.itc-modal__actions .itc-btn { flex: 1 1 auto; }

/* ------------------------------- responsive ------------------------------- */
@media (max-width: 640px) {
  .itc-banner { left: .5rem; right: .5rem; bottom: .5rem; padding: 1.1rem; max-width: none; }
  .itc-banner__actions { flex-direction: column; }
  .itc-banner__actions .itc-btn { width: 100%; }
  .itc-modal__actions { flex-direction: column; }
  .itc-modal__actions .itc-btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  #itc-consent .itc-btn,
  #itc-consent .itc-switch__track,
  #itc-consent .itc-switch__track::before { transition: none; }
}
