/* Cookie banner, ported from gpuwerk.com and restyled with this app's tokens.
   Desktop: a bottom bar that does not block the page; the wrapper is
   click-through so someone who wants to read before deciding can. Mobile: a
   compact bottom sheet, no backdrop, the page stays scrollable behind it. */
.mfb-consent {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; pointer-events: none;
}
.mfb-consent-card {
  pointer-events: auto; position: relative;
  width: 100%; max-width: 780px;
  background: var(--surface, #fff);
  border: 1px solid var(--border-strong, #d2d2ca);
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(14, 15, 12, .22);
  color: var(--text, #0e0f0c);
  font-size: 13.5px; line-height: 1.55;
  max-height: 86vh; display: flex; flex-direction: column; overflow: hidden;
}
.mfb-c-body { display: flex; align-items: center; gap: 18px; padding: 15px 18px; flex-wrap: wrap; }
.mfb-c-text { flex: 1; min-width: 240px; margin: 0; color: var(--muted, #6b6e66); }
.mfb-c-text b { color: var(--text, #0e0f0c); font-weight: 600; }
.mfb-consent a { color: var(--accent, #3b5bfd); text-decoration: underline; text-underline-offset: 2px; }

.mfb-c-actions { display: flex; gap: 8px; flex-shrink: 0; }
.mfb-c-actions-foot { padding: 13px 18px; border-top: 1px solid var(--border, #e7e7e2); justify-content: flex-end; }
.mfb-btn {
  font: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  padding: 9px 15px; border-radius: 6px; border: 1px solid transparent;
  white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
/* Reject is the same size and weight as Accept: refusing must not be a grey
   whisper next to a coloured button. */
.mfb-btn-ghost { background: transparent; color: var(--text, #0e0f0c); border-color: var(--border-strong, #d2d2ca); }
.mfb-btn-ghost:hover { background: var(--nav-hover, #ebebe6); }
.mfb-btn-primary { background: var(--accent, #3b5bfd); color: var(--accent-text, #fff); }
.mfb-btn-primary:hover { filter: brightness(.92); }
.mfb-consent :focus-visible { outline: 2px solid var(--accent, #3b5bfd); outline-offset: 2px; }

.mfb-c-head { padding: 15px 18px 12px; border-bottom: 1px solid var(--border, #e7e7e2); }
.mfb-c-head b { display: block; font-size: 15px; margin-bottom: 3px; }
.mfb-c-head span { color: var(--muted, #6b6e66); font-size: 13px; }

.mfb-c-cats { overflow-y: auto; }
.mfb-c-cat { border-bottom: 1px solid var(--border, #e7e7e2); }
.mfb-c-cat:last-child { border-bottom: 0; }
.mfb-c-cat-head { display: flex; align-items: center; gap: 12px; padding: 11px 18px; }
.mfb-c-cat-toggle {
  flex: 1; display: flex; align-items: center; gap: 8px; text-align: left;
  background: none; border: 0; cursor: pointer; padding: 0; min-height: 44px;
  color: var(--text, #0e0f0c); font: inherit; font-weight: 600; font-size: 13.5px;
}
.mfb-c-cat-toggle::after {
  content: ""; flex: 0 0 10px; width: 10px; height: 10px; margin-left: auto;
  background: linear-gradient(var(--muted, #6b6e66), var(--muted, #6b6e66)) center/10px 1.5px no-repeat,
              linear-gradient(var(--muted, #6b6e66), var(--muted, #6b6e66)) center/1.5px 10px no-repeat;
  transition: transform .3s ease;
}
.mfb-c-cat-toggle[aria-expanded="true"]::after { transform: rotate(45deg); }
.mfb-c-count { color: var(--muted, #6b6e66); font-weight: 400; font-size: 12px; }
.mfb-c-cat-body { padding: 0 18px 13px; background: var(--row-read, #f7f7f4); }
.mfb-c-cat-body p { margin: 0 0 9px; padding-top: 10px; color: var(--muted, #6b6e66); font-size: 13px; }
.mfb-c-none { font-style: italic; }

.mfb-c-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.mfb-c-table th {
  text-align: left; font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted, #6b6e66); font-weight: 600; padding: 6px 8px;
  border-bottom: 1px solid var(--border, #e7e7e2);
}
.mfb-c-table td { padding: 7px 8px; vertical-align: top; border-bottom: 1px solid var(--border, #e7e7e2); color: var(--muted, #6b6e66); }
.mfb-c-table tr:last-child td { border-bottom: 0; }
.mfb-c-table code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px;
  background: var(--nav-hover, #ebebe6); padding: 1px 5px; border-radius: 4px; color: var(--text, #0e0f0c);
}

/* Switch */
.mfb-sw { position: relative; display: inline-block; width: 44px; height: 26px; flex-shrink: 0; }
.mfb-sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.mfb-sw span {
  position: absolute; inset: 0; border-radius: 99px; pointer-events: none;
  background: var(--border-strong, #d2d2ca); transition: background .15s;
}
.mfb-sw span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(14, 15, 12, .3); transition: transform .15s;
}
.mfb-sw input:checked + span { background: var(--accent, #3b5bfd); }
.mfb-sw input:checked + span::after { transform: translateX(18px); }
.mfb-sw input:focus-visible + span { outline: 2px solid var(--accent, #3b5bfd); outline-offset: 2px; }
.mfb-sw-locked span { opacity: .5; }
.mfb-sw-locked input { cursor: not-allowed; }

/* Keep page content reachable above the bar while it is open. */
body:has(.mfb-consent) { padding-bottom: var(--mfb-consent-h, 220px); }
body:has(.mfb-consent) :focus { scroll-margin-bottom: var(--mfb-consent-h, 240px); }

/* The footer's "Cookie settings" control looks like the links around it. */
.mfb-footer-link {
  display: block; background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; color: inherit; text-align: left; text-decoration: none;
}
.mfb-footer-link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .mfb-consent { padding: 0; align-items: flex-end; }
  .mfb-consent-card { max-width: none; width: 100%; border-radius: 10px 10px 0 0; max-height: 70vh; }
  .mfb-c-body { flex-direction: column; align-items: stretch; gap: 12px; padding: 14px 16px; }
  .mfb-c-actions, .mfb-c-actions-foot { flex-direction: row; flex-wrap: wrap; }
  .mfb-c-actions-foot { padding: 12px 16px; }
  .mfb-btn { flex: 1 1 auto; min-width: 100px; padding: 11px 14px; }
}
@media (prefers-reduced-motion: reduce) { .mfb-c-cat-toggle::after { transition: none; } }
