/* Cookie banner + preferences drawer — public site */
#cookie-banner {
  position: fixed;
  left: 1.1rem;
  bottom: 1.1rem;
  z-index: 70;
  width: min(26.5rem, calc(100vw - 2rem));
  padding: 1.15rem 1.2rem 1.1rem;
  background: hsl(var(--background));
  border: 1px solid hsl(var(--border-soft));
  border-radius: 1.05rem;
  box-shadow: var(--shadow-elevated, 0 18px 50px hsl(var(--foreground) / 0.14));
  font-family: Inter, system-ui, sans-serif;
  animation: cb-in 0.35s ease both;
}
@keyframes cb-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
#cookie-banner .cb-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--foreground) / 0.5);
}
#cookie-banner .cb-title {
  margin: 0 0 0.45rem;
  font-family: var(--font-serif, 'Instrument Serif', Georgia, serif);
  font-size: 1.35rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: hsl(var(--foreground));
}
#cookie-banner p {
  margin: 0 0 0.95rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: hsl(var(--foreground) / 0.78);
}
#cookie-banner a {
  color: hsl(var(--accent));
  text-decoration: underline;
  text-underline-offset: 3px;
}
#cookie-banner .cb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
#cookie-banner button {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
}
#cookie-banner .cb-reject {
  background: transparent;
  color: hsl(var(--foreground) / 0.7);
  border-color: hsl(var(--border-soft));
}
#cookie-banner .cb-reject:hover { color: hsl(var(--foreground)); border-color: hsl(var(--foreground) / 0.35); }
#cookie-banner .cb-manage {
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
#cookie-banner .cb-accept {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
#cookie-banner .cb-accept:hover { filter: brightness(0.96); }

#cookie-prefs-overlay {
  position: fixed;
  inset: 0;
  background: hsl(var(--foreground) / 0.32);
  backdrop-filter: blur(4px);
  z-index: 88;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms ease;
}
#cookie-prefs-overlay.is-open { opacity: 1; pointer-events: auto; }
#cookie-prefs {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 28rem;
  height: 100%;
  background: hsl(var(--background));
  z-index: 89;
  transform: translateX(100%);
  transition: transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: var(--shadow-elevated, 0 18px 50px hsl(var(--foreground) / 0.14));
  display: flex;
  flex-direction: column;
}
#cookie-prefs:not(.is-open) { pointer-events: none; }
#cookie-prefs.is-open { transform: translateX(0); }
#cookie-prefs .cp-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 1.6rem 1.15rem;
  border-bottom: 1px solid hsl(var(--border-soft));
}
#cookie-prefs .cp-kicker {
  margin: 0 0 0.3rem;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: hsl(var(--foreground) / 0.5);
}
#cookie-prefs .cp-title {
  margin: 0;
  font-family: var(--font-serif, 'Instrument Serif', Georgia, serif);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}
#cookie-prefs .cp-close {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  background: transparent;
  border-radius: 5px;
  font-size: 1.35rem;
  cursor: pointer;
  color: hsl(var(--foreground) / 0.55);
}
#cookie-prefs .cp-close:hover { background: hsl(var(--muted) / 0.7); color: hsl(var(--foreground)); }
#cookie-prefs .cp-body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem 1.6rem 1.5rem;
}
#cookie-prefs .cp-lead {
  margin: 0 0 1.1rem;
  font-size: 0.9rem;
  line-height: 1.55;
  color: hsl(var(--foreground) / 0.72);
}
.cp-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid hsl(var(--border-soft));
}
.cp-row h4 {
  margin: 0 0 0.25rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.cp-row p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: hsl(var(--foreground) / 0.62);
}
.cp-always {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: hsl(var(--accent));
  padding: 0.35rem 0.55rem;
  border-radius: 999px;
  background: hsl(var(--accent) / 0.1);
  white-space: nowrap;
}
.cp-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.cp-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.cp-toggle span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: hsl(var(--foreground) / 0.18);
  cursor: pointer;
  transition: background 180ms ease;
}
.cp-toggle span::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px hsl(var(--foreground) / 0.2);
  transition: transform 180ms ease;
}
.cp-toggle input:checked + span { background: hsl(var(--accent)); }
.cp-toggle input:checked + span::after { transform: translateX(18px); }
.cp-toggle input:focus-visible + span { box-shadow: 0 0 0 3px hsl(var(--accent) / 0.25); }
#cookie-prefs .cp-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  padding: 1rem 1.6rem 1.25rem;
  border-top: 1px solid hsl(var(--border-soft));
}
#cookie-prefs .cp-foot button {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
}
#cookie-prefs .cp-save {
  background: hsl(var(--accent));
  color: hsl(var(--accent-foreground));
}
#cookie-prefs .cp-essential {
  background: transparent;
  border-color: hsl(var(--border));
  color: hsl(var(--foreground));
}
@media (max-width: 500px) {
  #cookie-banner { left: 0.75rem; right: 0.75rem; bottom: 0.75rem; width: auto; }
}
@media (max-width: 640px) {
  #cookie-prefs {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 92vh;
    max-height: 92dvh;
    transform: translateY(100%);
    border-radius: 1rem 1rem 0 0;
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  #cookie-prefs.is-open { transform: translateY(0); }
  #cookie-prefs::before {
    content: "";
    display: block;
    width: 2.5rem;
    height: 0.28rem;
    margin: 0.55rem auto 0;
    border-radius: 999px;
    background: hsl(var(--foreground) / 0.22);
    flex-shrink: 0;
  }
}
