/* Consent banner (consent.js): a card in the corner on desktop, a bottom sheet on phones.
   It sits under the skip link (z-index 20) and never covers the whole page. */

.cc {
  position: fixed;
  left: var(--gutter);
  bottom: var(--gutter);
  z-index: 15;
  display: grid;
  gap: 1rem;
  width: min(32rem, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - var(--bar-h) - 2 * var(--gutter));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.25rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: 0 18px 48px rgb(0 0 0 / 0.55);
  font: 400 var(--fs-small)/1.55 var(--sans);
}

.cc[hidden],
.cc [hidden] {
  display: none;
}

.cc:focus-visible {
  outline-offset: 2px;
}

.cc-main,
.cc-settings {
  display: grid;
  gap: 0.6rem;
}

.cc-title {
  font: 600 1.0625rem/1.3 var(--sans);
  letter-spacing: -0.01em;
  color: var(--ink);
}

.cc p {
  color: var(--muted);
}

.cc a {
  color: var(--ink);
}

/* Under the one-line explanation: "Read more" opens the rest in place, beside the privacy notice link. */
.cc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
}

.cc-small {
  font-size: 0.8125rem;
}

.cc-cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r);
}

.cc-cat-text {
  display: grid;
  gap: 0.25rem;
}

.cc-cat label {
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}

.cc-note {
  margin-left: 0.5rem;
  font-weight: 400;
  color: var(--muted);
}

.cc-switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  margin: 0.1rem 0 0;
  background: var(--bg);
  border: 1px solid var(--subtle);
  border-radius: 999px;
  cursor: pointer;
}

.cc-switch::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.2rem;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--muted);
  transform: translateY(-50%);
}

.cc-switch:checked {
  background: var(--amber);
  border-color: var(--amber);
}

.cc-switch:checked::before {
  left: calc(100% - 1.2rem);
  background: var(--on-amber);
}

.cc-switch:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.cc-switch:focus-visible {
  border-radius: 999px;
}

.cc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

/* Accept, Reject and Save share one look, so no answer is easier to give than another. */
.cc-btn {
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  background: var(--amber);
  color: var(--on-amber);
  border: 1px solid var(--amber);
  border-radius: var(--r);
  font: 600 var(--fs-small)/1.2 var(--sans);
  cursor: pointer;
}

.cc-btn:hover {
  background: var(--amber-hover);
  border-color: var(--amber-hover);
}

.cc-btn-quiet {
  grid-column: 1 / -1;
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}

.cc-btn-quiet:hover {
  background: transparent;
  border-color: var(--ink);
}

.cc-btn[data-cc-do="save"] {
  grid-column: 1 / -1;
}

/* "Cookie settings" in the footer and in the privacy notice: a button that reads as a link. */
.cc-link {
  padding: 0;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .cc:not([hidden]) {
    animation: cc-in 0.32s var(--ease);
  }

  .cc-switch,
  .cc-switch::before,
  .cc-btn {
    transition: background-color 0.15s, border-color 0.15s, left 0.15s;
  }

  @keyframes cc-in {
    from {
      opacity: 0;
      transform: translateY(1rem);
    }
  }
}

@media (max-width: 600px) {
  .cc {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: 85dvh;
    padding: 1.1rem var(--gutter) calc(1.1rem + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 12px 12px 0 0;
  }
}

@media (forced-colors: active) {
  .cc,
  .cc-btn,
  .cc-switch {
    border: 1px solid CanvasText;
  }

  .cc-switch:checked {
    background: Highlight;
  }
}

@media print {
  .cc {
    display: none;
  }
}
