/* =========================================================
   Cookie consent banner — AEPD-compliant, minimally invasive
   ========================================================= */

.loy-cb {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  max-width: 460px;
  margin-left: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 0 var(--line-soft), 0 18px 50px -22px rgba(0,0,0,0.28);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  font-family: var(--font-sans);
  color: var(--ink);
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.45s cubic-bezier(0.2, 0.6, 0.2, 1),
              opacity 0.35s ease;
  pointer-events: none;
}
.loy-cb[data-open="true"] {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.loy-cb-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-mute);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.loy-cb-eyebrow::before {
  content: "";
  width: 18px; height: 1.5px;
  background: var(--ink);
  display: inline-block;
}

.loy-cb-body {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.loy-cb-body a {
  color: var(--ink);
  border-bottom: 1px solid var(--line);
  transition: border-color 0.2s ease;
}
.loy-cb-body a:hover { border-color: var(--ink); }

.loy-cb-prefs {
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 8px 0;
  display: flex;
  flex-direction: column;
}
.loy-cb-prefs[hidden] { display: none; }

.loy-cb-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}
.loy-cb-row:last-child { border-bottom: 0; }
.loy-cb-row .loy-cb-row-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.loy-cb-row strong {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.loy-cb-row span {
  font-size: 0.78rem;
  color: var(--ink-mute);
}

/* iOS-style switch — same family as the tweaks panel toggle */
.loy-cb-switch {
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ink) 18%, transparent);
  border: 0;
  cursor: pointer;
  transition: background 0.18s ease;
  flex-shrink: 0;
  padding: 0;
}
.loy-cb-switch::after {
  content: "";
  position: absolute;
  left: 2px; top: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: transform 0.18s ease;
}
.loy-cb-switch[aria-pressed="true"] { background: var(--accent); }
.loy-cb-switch[aria-pressed="true"]::after { transform: translateX(14px); }
.loy-cb-switch[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Equivalent visual prominence for all three CTAs (AEPD) */
.loy-cb-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.loy-cb-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 9px 12px;
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.loy-cb-btn:hover {
  border-color: var(--ink);
  background: var(--tag-bg);
}
.loy-cb-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* When preferences are open, swap buttons for a single Save action +
   keep accept/reject as alternatives. */
.loy-cb[data-mode="prefs"] .loy-cb-actions {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 540px) {
  .loy-cb {
    left: 12px;
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    max-width: none;
    padding: 16px 16px 14px;
  }
  .loy-cb-actions { grid-template-columns: 1fr; }
  .loy-cb-actions .loy-cb-btn { padding: 12px; }
  .loy-cb-row { grid-template-columns: 1fr auto; }
}

@media (prefers-reduced-motion: reduce) {
  .loy-cb { transition: opacity 0.2s ease; transform: none; }
}
