/* Cookie consent.
 *
 * A small card in the corner, not a bar across the page and not a dialogue.
 *
 * Three things are fixed by law and are not design decisions. Analytics and
 * advertising are separate purposes, so they need separate controls and cannot
 * be merged into one. Neither may be on by default. And refusing has to be as
 * easy as accepting, which is why those two buttons are identical twins rather
 * than a bright primary next to a grey afterthought.
 *
 * Everything else is free, so the detail sits behind Customise and the copy is
 * one line.
 */

.dms-consent {
  position: fixed;
  z-index: 10000;
  left: 20px;
  bottom: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  width: 352px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  font-family: "General Sans", system-ui, -apple-system, sans-serif;
  background: rgba(255, 255, 255, 0.86);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  color: #0B0E14;
  border-radius: 16px;
  border: 1px solid rgba(11, 14, 20, 0.08);
  box-shadow: 0 1px 2px rgba(11, 14, 20, 0.04), 0 12px 32px -8px rgba(11, 14, 20, 0.22);
  padding: 15px 15px 13px;
  animation: dms-consent-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes dms-consent-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dms-consent { animation: none; }
}

.dms-consent__head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}

.dms-consent__icon { width: 17px; height: 17px; flex: 0 0 auto; }

.dms-consent__title {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  margin: 0;
}

.dms-consent__copy {
  font-size: 0.78125rem;
  line-height: 1.5;
  margin: 0 0 12px;
  color: rgba(11, 14, 20, 0.6);
}

.dms-consent__copy a {
  color: rgba(11, 14, 20, 0.72);
  text-underline-offset: 2px;
}

.dms-consent__copy a:hover { color: #C2410C; }

/* Accept and Reject are identical: same width, weight, colour and radius.
 * A loud accept beside a quiet decline is the pattern the ICO writes to
 * organisations about, so the symmetry here is load bearing. */
.dms-consent__actions { display: flex; align-items: center; gap: 6px; }

.dms-consent__btn {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 550;
  letter-spacing: -0.005em;
  padding: 8px 12px;
  border-radius: 9px;
  cursor: pointer;
  border: 0;
  flex: 1 1 0;
  background: #0B0E14;
  color: #FFFFFF;
  white-space: nowrap;
  transition: transform 0.12s ease, opacity 0.18s ease;
}

.dms-consent__btn:hover { opacity: 0.88; }
.dms-consent__btn:active { transform: scale(0.985); }

.dms-consent__link {
  font: inherit;
  font-size: 0.78125rem;
  font-weight: 500;
  background: none;
  border: 0;
  padding: 8px 2px;
  cursor: pointer;
  color: rgba(11, 14, 20, 0.48);
  flex: 0 0 auto;
  white-space: nowrap;
  transition: color 0.18s ease;
}

.dms-consent__link:hover { color: #0B0E14; }

.dms-consent__btn:focus-visible,
.dms-consent__link:focus-visible,
.dms-consent__save:focus-visible,
.dms-consent__row input:focus-visible + .dms-consent__switch {
  outline: 2px solid #C2410C;
  outline-offset: 2px;
}

/* ------------------------------------------------------------- the detail */

.dms-consent__detail {
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid rgba(11, 14, 20, 0.08);
}

.dms-consent__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 0;
  cursor: pointer;
}

/* The real checkbox stays in the DOM for keyboard and screen reader use, and
 * is drawn as a switch. A styled div with a click handler would look the same
 * and be unusable without a mouse. */
.dms-consent__row input {
  position: absolute;
  opacity: 0;
  width: 34px;
  height: 20px;
  margin: 0;
  cursor: pointer;
}

.dms-consent__switch {
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(11, 14, 20, 0.16);
  position: relative;
  transition: background 0.2s ease;
  pointer-events: none;
}

.dms-consent__switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 3px rgba(11, 14, 20, 0.28);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.dms-consent__row input:checked + .dms-consent__switch { background: #0E7C55; }
.dms-consent__row input:checked + .dms-consent__switch::after { transform: translateX(14px); }

.dms-consent__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }

.dms-consent__text strong {
  font-size: 0.8125rem;
  font-weight: 550;
  letter-spacing: -0.005em;
}

.dms-consent__text span {
  font-size: 0.75rem;
  line-height: 1.4;
  color: rgba(11, 14, 20, 0.52);
}

.dms-consent__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}

.dms-consent__save {
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 550;
  padding: 8px 15px;
  border-radius: 10px;
  cursor: pointer;
  background: rgba(11, 14, 20, 0.06);
  color: #0B0E14;
  border: 0;
  transition: background 0.18s ease;
}

.dms-consent__save:hover { background: rgba(11, 14, 20, 0.11); }

.dms-consent__more { font-size: 0.75rem; margin: 0; color: rgba(11, 14, 20, 0.45); }
.dms-consent__more a { color: rgba(11, 14, 20, 0.6); }
.dms-consent__more a:hover { color: #C2410C; }

/* On a phone it spans the width, because a 384px card floating in a 390px
 * viewport looks like a mistake. */
@media (max-width: 460px) {
  .dms-consent {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    max-width: none;
  }
}

/* The site's palette is light, so the card is light. This only matters where a
 * visitor forces dark mode at the OS level. */
@media (prefers-color-scheme: dark) {
  .dms-consent {
    background: rgba(22, 26, 34, 0.9);
    border-color: rgba(244, 241, 236, 0.1);
    color: #F4F1EC;
  }
  .dms-consent__copy { color: rgba(244, 241, 236, 0.66); }
  .dms-consent__btn { background: #F4F1EC; color: #0B0E14; }
  .dms-consent__link { color: rgba(244, 241, 236, 0.55); }
  .dms-consent__link:hover { color: #F4F1EC; }
  .dms-consent__detail { border-top-color: rgba(244, 241, 236, 0.1); }
  .dms-consent__switch { background: rgba(244, 241, 236, 0.2); }
  .dms-consent__text span { color: rgba(244, 241, 236, 0.5); }
  .dms-consent__save { background: rgba(244, 241, 236, 0.1); color: #F4F1EC; }
  .dms-consent__save:hover { background: rgba(244, 241, 236, 0.16); }
  .dms-consent__more { color: rgba(244, 241, 236, 0.42); }
  .dms-consent__more a { color: rgba(244, 241, 236, 0.6); }
}
