/* ==========================================================================
   Cookie consent: banner + preferences dialog (js/core/consent.js)
   The industry pattern (GDPR / ePrivacy style):
     - a card in the corner on first visit, with Reject all, Customise and
       Accept all given equal weight, so declining is as easy as agreeing
     - a preferences dialog with one switch per category: Necessary (always
       on), Analytics and Marketing (off until switched on)
     - "Cookie settings" in the footer reopens the dialog at any time
   The card slides up from the bottom; the dialog fades in over a dim
   backdrop. Theme-aware. Prefixed .ck- (.ft-cookie for the footer button).
   ========================================================================== */

.ck-banner {
  --ck-card: #ffffff;
  position: fixed;
  z-index: 1200;
  left: 24px;
  bottom: 24px;
  width: min(420px, calc(100vw - 32px));
  padding: 22px 22px 20px;
  background: var(--ck-card);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  box-shadow: 0 28px 60px -24px rgba(10,47,107,0.45);
  transform: translateY(calc(100% + 40px));
  opacity: 0;
  transition: transform 0.45s var(--ease-out), opacity 0.3s ease;
}
:root[data-theme="dark"] .ck-banner,
:root[data-theme="dark"] .ck-dialog { --ck-card: #0B1F42; }
.ck-banner.is-in { transform: none; opacity: 1; }
.ck-banner[hidden] { display: none; }

.ck-head { display: flex; align-items: center; gap: 10px; }
.ck-head .ti { font-size: 21px; color: var(--accent); }
.ck-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.015em; color: var(--text-primary); }
.ck-link { color: var(--accent-text); text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; white-space: nowrap; }
.ck-link:hover { text-decoration-color: currentColor; }
.ck-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
.ck-text { margin-top: 10px; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }

.ck-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.ck-actions .ck-btn--wide { grid-column: 1 / -1; }
.ck-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--ck-card);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease, transform 0.1s ease;
}
.ck-btn:hover { color: var(--accent-text); border-color: var(--accent-line); }
.ck-btn:active { transform: scale(0.98); }
.ck-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* accept and reject carry the same visual weight; customise is quieter */
.ck-btn--solid { color: #fff; background: var(--accent); border-color: var(--accent); }
.ck-btn--solid:hover { color: #fff; border-color: var(--accent-text); background: var(--accent-text); }
:root[data-theme="dark"] .ck-btn--solid,
:root[data-theme="dark"] .ck-btn--solid:hover { color: #061530; }
.ck-btn--link { min-height: 36px; border-color: transparent; background: none; color: var(--accent-text); font-weight: 500; }
.ck-btn--link:hover { border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }

/* ─── Preferences dialog ─────────────────────────────────────────────── */
.ck-dialog {
  --ck-card: #ffffff;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  margin: auto;                       /* the reset zeroes the native centring */
  padding: 0;
  color: var(--text-primary);
  background: var(--ck-card);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  box-shadow: 0 40px 80px -30px rgba(10,47,107,0.5);
}
.ck-dialog::backdrop { background: rgba(6,21,48,0.45); }
.ck-dialog[open] { animation: ck-in 0.3s var(--ease-out); }
.ck-dialog[open]::backdrop { animation: ck-fade 0.3s ease; }
@keyframes ck-in { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
@keyframes ck-fade { from { opacity: 0; } }

.ck-dlg-in { display: flex; flex-direction: column; max-height: calc(100vh - 50px); }
.ck-dlg-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 24px 8px; }
.ck-dlg-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.ck-dlg-sub { margin-top: 6px; font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
.ck-x {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px; height: 40px;
  margin: -6px -8px 0 0;
  font-size: 19px;
  color: var(--text-muted);
  background: none;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
}
.ck-x:hover { color: var(--text-primary); background: var(--surface-raised); }
.ck-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ck-cats { flex: 1; overflow-y: auto; margin: 0; padding: 8px 24px; list-style: none; }
.ck-cat { display: flex; align-items: flex-start; gap: 16px; padding: 16px 0; border-top: 1px solid var(--border); }
.ck-cat:first-child { border-top: 0; }
.ck-cat-body { flex: 1; min-width: 0; }
.ck-cat-name { font-size: 15.5px; font-weight: 600; color: var(--text-primary); }
.ck-cat-text { margin-top: 4px; font-size: 13.5px; line-height: 1.55; color: var(--text-secondary); }
.ck-always { flex: none; padding-top: 2px; font-size: 12.5px; font-weight: 600; color: var(--good); white-space: nowrap; }

/* switch */
.ck-switch {
  position: relative;
  flex: none;
  width: 44px; height: 26px;
  margin-top: 1px;
  padding: 0;
  background: var(--border-strong);
  border: 0;
  border-radius: 99px;
  cursor: pointer;
  transition: background-color 0.18s ease-out;
}
.ck-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  transition: transform 0.18s ease-out;
}
.ck-switch[aria-checked="true"] { background: var(--accent); }
.ck-switch[aria-checked="true"]::after { transform: translateX(18px); }
.ck-switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.ck-dlg-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 16px 24px 22px; border-top: 1px solid var(--border); }
.ck-dlg-foot .ck-btn { min-width: 120px; }

/* footer "Cookie settings": looks like the legal links beside it */
.ft-legal-links .ft-cookie {
  position: relative;
  display: inline-block;
  padding: 0 0 3px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 300;
  color: rgba(255,255,255,0.45);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.18s ease;
}
.ft-legal-links .ft-cookie:hover, .ft-legal-links .ft-cookie:focus-visible { color: #ffffff; }
.ft-legal-links .ft-cookie:focus-visible { outline: 2px solid rgba(255,255,255,0.6); outline-offset: 3px; border-radius: 3px; }

@media (max-width: 560px) {
  /* a sheet along the bottom edge on phones */
  .ck-banner { left: 8px; right: 8px; bottom: 8px; width: auto; }
  .ck-dlg-foot .ck-btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .ck-banner, .ck-switch, .ck-switch::after { transition: none; }
  .ck-dialog[open], .ck-dialog[open]::backdrop { animation: none; }
}
