/* ==========================================================================
   Cookie consent (templates/landing/partials/cookie_consent.html)
   A card in the corner, not a wall across the page: the site stays usable
   while the question is open, and nothing optional is stored until it is
   answered. On a phone it becomes a sheet along the bottom edge.
   ========================================================================== */

.cc {
  --cc-ink: #0f172a;
  --cc-ink-soft: #475569;
  --cc-ink-faint: #64748b;
  --cc-line: rgba(15, 23, 42, 0.08);
  --cc-surface: #ffffff;
  --cc-emerald: #10b981;
  --cc-emerald-dark: #059669;
  --cc-forest: #0b2b20;
  --cc-forest-hover: #123d2f;
  --cc-tint: #f0fdf4;

  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 2147483000;
  width: min(420px, calc(100vw - 32px));
  font-family: 'Plus Jakarta Sans', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--cc-ink);
  -webkit-font-smoothing: antialiased;
}
.cc[hidden] { display: none; }

.cc-card {
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--cc-surface);
  border: 1px solid var(--cc-line);
  border-radius: 20px;
  padding: 22px 22px 16px;
  box-shadow:
    0 24px 60px -12px rgba(11, 43, 32, 0.28),
    0 4px 14px rgba(15, 23, 42, 0.06);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition:
    opacity 0.32s cubic-bezier(0.2, 0.8, 0.2, 1),
    transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1.05);
}
.cc.is-open .cc-card { opacity: 1; transform: none; }
.cc.is-leaving .cc-card {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition-duration: 0.2s;
}

.cc-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.cc-icon {
  flex: none;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--cc-tint);
  color: var(--cc-emerald-dark);
}
.cc-icon svg { width: 22px; height: 22px; }
.cc-title {
  margin: 0;
  font-family: 'Outfit', 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.25;
  color: var(--cc-ink);
}
.cc-summary {
  margin: 0 0 16px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--cc-ink-soft);
}
.cc-summary strong { color: var(--cc-ink); font-weight: 600; }

/* --- the three categories, shown when someone chooses ------------------- */
.cc-choices {
  display: grid;
  gap: 2px;
  margin: 0 0 16px;
  border: 1px solid var(--cc-line);
  border-radius: 14px;
  overflow: hidden;
}
.cc-choices[hidden] { display: none; }
.cc-row {
  padding: 12px 14px;
  background: #fbfcfd;
}
.cc-row-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.cc-row + .cc-row { border-top: 1px solid var(--cc-line); }
.cc-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cc-row-title { font-size: 0.86rem; font-weight: 650; color: var(--cc-ink); cursor: default; }
label.cc-row-title { cursor: pointer; }
.cc-row-desc { font-size: 0.78rem; line-height: 1.45; color: var(--cc-ink-faint); }
.cc-row.is-none .cc-row-title { color: var(--cc-ink-soft); }

.cc-always, .cc-none {
  flex: none;
  margin-top: 1px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.cc-always { background: var(--cc-tint); color: var(--cc-emerald-dark); }
.cc-none { background: #f1f5f9; color: var(--cc-ink-faint); }

/* A real checkbox underneath, so keyboards, forms and screen readers work. */
.cc-switch { position: relative; flex: none; margin-top: 1px; }
.cc-switch input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
  z-index: 1;
}
.cc-switch-track {
  display: block;
  width: 40px; height: 24px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background-color 0.2s ease;
}
.cc-switch-thumb {
  display: block;
  width: 18px; height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.25);
  transition: transform 0.24s cubic-bezier(0.2, 0.9, 0.25, 1.1);
}
.cc-switch input:checked + .cc-switch-track { background: var(--cc-emerald); }
.cc-switch input:checked + .cc-switch-track .cc-switch-thumb { transform: translateX(16px); }
.cc-switch input:focus-visible + .cc-switch-track {
  outline: 2px solid var(--cc-emerald);
  outline-offset: 2px;
}

/* --- actions ------------------------------------------------------------- */
.cc-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cc-actions [hidden] { display: none; }
.cc-actions .cc-btn:only-child,
.cc.is-customising .cc-actions { grid-template-columns: 1fr; }

.cc-btn {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 0.86rem;
  font-weight: 650;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease,
    color 0.15s ease, transform 0.1s ease;
}
.cc-btn:active { transform: scale(0.98); }
.cc-btn:focus-visible { outline: 2px solid var(--cc-emerald); outline-offset: 2px; }
.cc-btn-primary { background: var(--cc-forest); color: #fff; }
.cc-btn-secondary { background: #fff; color: var(--cc-ink); border-color: #cbd5e1; }
@media (hover: hover) and (pointer: fine) {
  .cc-btn-primary:hover { background: var(--cc-forest-hover); }
  .cc-btn-secondary:hover { border-color: var(--cc-ink-faint); background: #f8fafc; }
}

.cc-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}
.cc-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 0;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--cc-emerald-dark);
  text-decoration: none;
  cursor: pointer;
}
.cc-link:hover { text-decoration: underline; }
.cc-link:focus-visible { outline: 2px solid var(--cc-emerald); outline-offset: 2px; border-radius: 4px; }

/* --- phones: a sheet along the bottom ----------------------------------- */
@media (max-width: 560px) {
  .cc { left: 0; right: 0; bottom: 0; width: 100%; }
  .cc-card {
    border-radius: 20px 20px 0 0;
    border-bottom: 0;
    padding: 20px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    transform: translateY(100%);
  }
  .cc.is-leaving .cc-card { transform: translateY(100%); }
  .cc-actions { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .cc-card, .cc.is-leaving .cc-card { transition: opacity 0.15s linear; transform: none; }
  .cc-switch-track, .cc-switch-thumb { transition: none; }
}

/* The "Cookie settings" entry in the footer, which reopens the card. */
.cc-footer-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* --- what each category stores, one click away --------------------------- */
.cc-detail { margin-top: 8px; }
.cc-detail summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--cc-emerald-dark);
  cursor: pointer;
}
.cc-detail summary::-webkit-details-marker { display: none; }
.cc-detail summary::after {
  content: "";
  width: 6px; height: 6px;
  margin-left: 2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}
.cc-detail[open] summary::after { transform: rotate(-135deg) translateY(-1px); }
.cc-detail summary:focus-visible { outline: 2px solid var(--cc-emerald); outline-offset: 2px; border-radius: 4px; }

.cc-list { margin: 8px 0 0; display: grid; gap: 6px; }
.cc-list div {
  display: grid;
  grid-template-columns: minmax(0, 11.5rem) 1fr;
  gap: 10px;
  align-items: baseline;
}
.cc-list dt {
  margin: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  color: var(--cc-ink);
  overflow-wrap: anywhere;
}
.cc-list dd { margin: 0; font-size: 0.75rem; line-height: 1.45; color: var(--cc-ink-faint); }
.cc-note { margin: 8px 0 0; font-size: 0.74rem; line-height: 1.45; color: var(--cc-ink-faint); }

@media (max-width: 560px) {
  .cc-card { max-height: 88vh; max-height: 88dvh; }
  .cc-list div { grid-template-columns: 1fr; gap: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  .cc-detail summary::after { transition: none; }
}
