/* Cookie consent banner + preferences dialog.
   Loaded on every page (linked from templates/base.html). */

.cc-backdrop {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(15, 26, 22, 0.38);
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px;
}
.cc-backdrop[hidden] { display: none; }

.cc-panel {
  width: 100%; max-width: 640px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 18px 48px rgba(15, 26, 22, 0.32);
  padding: 20px 22px 18px;
  max-height: 88vh; overflow-y: auto;
  animation: cc-rise 0.22s ease-out;
}
@keyframes cc-rise { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cc-panel { animation: none; } }

.cc-title { font-size: 18px; font-weight: 700; margin-bottom: 8px; }
.cc-text { font-size: 14.5px; color: var(--ink-2); }
.cc-text a { color: var(--accent); }

.cc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.cc-btn {
  font: inherit; font-size: 14.5px; font-weight: 600;
  padding: 9px 18px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.cc-btn:hover { background: #f2f5f3; }
.cc-btn-acc { background: var(--felt); border-color: var(--felt); color: #fff; }
.cc-btn-acc:hover { background: var(--felt-dark); border-color: var(--felt-dark); }
.cc-btn-link {
  border-color: transparent; background: transparent; color: var(--accent);
  text-decoration: underline; padding-left: 6px; padding-right: 6px;
}
.cc-btn-link:hover { background: transparent; text-decoration: none; }

/* preference rows */
.cc-prefs { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.cc-prefs[hidden] { display: none; }
.cc-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.cc-row:last-child { border-bottom: 0; }
.cc-row-copy { flex: 1; }
.cc-row-title { font-size: 14.5px; font-weight: 600; }
.cc-row-desc { font-size: 13.5px; color: var(--ink-2); }
.cc-row-always { font-size: 13px; color: var(--ink-2); white-space: nowrap; padding-top: 3px; }

/* switch */
.cc-switch { position: relative; flex: none; width: 44px; height: 24px; }
.cc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.cc-slider {
  position: absolute; inset: 0; border-radius: 99px;
  background: #cfd8d3; transition: background 0.15s ease;
}
.cc-slider::before {
  content: ""; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.cc-switch input:checked + .cc-slider { background: var(--felt); }
.cc-switch input:checked + .cc-slider::before { transform: translateX(20px); }
.cc-switch input:focus-visible + .cc-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

/* footer trigger, styled like the surrounding footer links */
.cc-open {
  font: inherit; font-size: inherit; background: none; border: 0; padding: 0;
  color: inherit; cursor: pointer; text-decoration: underline;
}
.cc-open:hover { text-decoration: none; }

.cc-reopen { margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.cc-reopen b { color: var(--ink); font-weight: 600; }

@media (max-width: 640px) {
  .cc-panel { padding: 16px 16px 14px; }
  .cc-actions { flex-direction: column; align-items: stretch; }
  .cc-btn { width: 100%; }
  .cc-btn-link { text-align: center; }
}
