/*
 * Cookie consent panel (consent.js). A banner that slides up along the bottom of the screen; on
 * phones it becomes a bottom sheet with a drag handle. Its buttons are the site's own btn-glow
 * (Reject all, Save my choices) and btn-pill (Accept all), so each theme already styles them; the
 * panel itself takes its look from the --cc-* tokens, which themes.css sets per theme.
 */
:root {
  --cc-bg: rgba(20, 6, 38, 0.97);
  --cc-text: var(--purple-100);
  --cc-muted: rgba(233, 213, 255, 0.78);
  --cc-border: rgba(168, 85, 247, 0.45);
  --cc-card-bg: rgba(88, 28, 135, 0.25);
  --cc-card-border: rgba(168, 85, 247, 0.3);
  --cc-accent: var(--purple-500);
  --cc-knob: #fff;
  --cc-radius: 1rem;
  --cc-card-radius: 0.75rem;
  --cc-shadow: 0 -10px 40px rgba(0, 0, 0, 0.55), 0 0 30px rgba(168, 85, 247, 0.25);
  --cc-font: inherit;
  --cc-heading-font: inherit;
  --cc-heading-weight: 700;
  --cc-link: var(--purple-300);
}

.cc-root {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.cc-root[hidden] {
  display: none;
}

.cc-backdrop {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cc-root.is-open .cc-backdrop {
  opacity: 1;
}

.cc-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88vh;
  max-height: 88dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem max(1.5rem, calc((100% - 70rem) / 2)) calc(1.5rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--cc-border);
  border-radius: var(--cc-radius) var(--cc-radius) 0 0;
  background: var(--cc-bg);
  box-shadow: var(--cc-shadow);
  color: var(--cc-text);
  font-family: var(--cc-font);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.cc-root.is-open .cc-sheet {
  transform: none;
}

.cc-sheet.is-dragging {
  transition: none;
}

.cc-handle {
  display: none;
}

.cc-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.cc-title {
  margin: 0;
  font-family: var(--cc-heading-font);
  font-size: 1.35rem;
  font-weight: var(--cc-heading-weight);
  color: var(--cc-text);
}

.cc-subtitle {
  margin: 0.25rem 0 0;
  color: var(--cc-muted);
  font-size: 0.95rem;
}

.cc-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid var(--cc-card-border);
  border-radius: 50%;
  background: transparent;
  color: var(--cc-text);
}

.cc-close svg {
  width: 1.1rem;
  height: 1.1rem;
}

.cc-close:hover {
  border-color: var(--cc-border);
  background: var(--cc-card-bg);
}

.cc-close:focus-visible,
.cc-policy:focus-visible,
.cc-switch input:focus-visible + .cc-switch-track {
  outline: 2px solid var(--cc-accent);
  outline-offset: 2px;
}

.cc-intro {
  margin: 1rem 0;
  color: var(--cc-muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.cc-cards {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .cc-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.cc-card {
  padding: 1rem 1.1rem;
  border: 1px solid var(--cc-card-border);
  border-radius: var(--cc-card-radius);
  background: var(--cc-card-bg);
}

.cc-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cc-card-title {
  flex: 1;
  font-family: var(--cc-heading-font);
  font-weight: var(--cc-heading-weight);
  color: var(--cc-text);
}

.cc-card-state {
  font-size: 0.8rem;
  color: var(--cc-muted);
}

.cc-card-text {
  margin: 0.5rem 0 0;
  color: var(--cc-muted);
  font-size: 0.875rem;
  line-height: 1.5;
}

/* Switch: a real checkbox laid over a styled track */
.cc-switch {
  position: relative;
  flex-shrink: 0;
  width: 2.75rem;
  height: 1.5rem;
}

.cc-switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

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

.cc-switch-track {
  position: absolute;
  inset: 0;
  border: 1px solid var(--cc-card-border);
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.35);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.cc-switch-track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--cc-knob);
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}

.cc-switch input:checked + .cc-switch-track {
  border-color: var(--cc-accent);
  background: var(--cc-accent);
}

.cc-switch input:checked + .cc-switch-track::after {
  transform: translate(1.2rem, -50%);
}

.cc-switch input:disabled + .cc-switch-track {
  opacity: 0.65;
}

/* Actions. Wide: Reject, Save and Accept in one row with the policy link at the end.
   Medium: Accept drops to its own row. Phones: stacked as Reject, Save, Accept. */
.cc-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* All three buttons share one size, so "Reject all" is never smaller than "Accept all" */
.cc-actions .cc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 11rem;
  margin: 0;
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.cc-policy {
  color: var(--cc-link);
  font-size: 0.9rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

@media (min-width: 1024px) {
  .cc-policy {
    margin-left: auto;
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .cc-btn-accept {
    order: 1;
  }

  .cc-policy {
    order: 2;
    margin-left: auto;
  }

  /* Forces Accept onto the next row after Reject and Save */
  .cc-actions::after {
    content: "";
    order: 0;
    flex-basis: 100%;
  }
}

@media (max-width: 639px) {
  .cc-sheet {
    padding: 0.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom, 0px));
  }

  .cc-handle {
    display: block;
    width: 2.75rem;
    height: 0.3rem;
    margin: 0.25rem auto 1rem;
    border-radius: 9999px;
    background: var(--cc-muted);
    opacity: 0.6;
  }

  .cc-close {
    display: none;
  }

  .cc-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .cc-actions .cc-btn {
    width: 100%;
  }

  .cc-policy {
    align-self: center;
  }
}

/* The page behind doesn't scroll while the panel is open */
html.cc-open,
html.cc-open body {
  overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .cc-backdrop,
  .cc-sheet {
    transition: none;
  }
}

/* ---- Site footer: privacy and cookie settings, on every page ---- */
.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1.5rem;
  margin: 2rem 0 0;
  padding: 1rem;
  font-size: 0.85rem;
}

.site-footer a,
.site-footer button {
  padding: 0;
  border: none;
  background: none;
  color: var(--cc-link);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.site-footer a:hover,
.site-footer button:hover {
  color: var(--cc-text);
}
