/* ABC Consent — GDPR Cookie Popup
   Matches a11y-modal design pattern, positioned bottom-left */

/* ── Overlay / mask ──────────────────────────────────────────────────────── */

#abc-consent-overlay {
  display: none;
}

/* ── Popup box ───────────────────────────────────────────────────────────── */

#abc-consent-popup {
  --consent-bg: #ffffff;
  --consent-fg: #262323;
  --consent-accent: var(--plaster-b, #ffa17e);

  position: fixed;
  bottom: 1.8em;
  left: 1.8em;
  z-index: 999999;
  width: 520px;
  max-width: calc(100vw - 3.6em);
  max-height: calc(90vh - 3.6em);
  overflow-y: auto;
  background: #ffffff !important;
  color: var(--consent-fg);
  border-radius: 0;
  padding: 2rem 2rem 1.5rem;
  box-shadow: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.3s ease, visibility 0.3s, transform 0.3s ease;
}

#abc-consent-popup.--active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* ── Header ──────────────────────────────────────────────────────────────── */

.abc-consent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.abc-consent-title {
  font-family: var(--header-font, "Open Sauce Two", Helvetica, Arial, sans-serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--consent-fg);
}

.abc-consent-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 50%;
  color: var(--consent-fg);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.abc-consent-close:hover,
.abc-consent-close:focus-visible {
  border-color: var(--consent-accent);
}

.abc-consent-close svg {
  width: 18px;
  height: 18px;
}

/* ── Body text ───────────────────────────────────────────────────────────── */

.abc-consent-text p {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.45;
  margin: 0 0 1.5rem;
  opacity: 0.55;
}

.abc-consent-privacy-link {
  color: var(--consent-accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.abc-consent-privacy-link:hover {
  opacity: 0.7;
}

/* ── Options list (preferences) ──────────────────────────────────────────── */

.abc-consent-preferences {
  display: flex;
  flex-direction: column;
}

.abc-consent-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.abc-consent-toggle-row:first-child {
  padding-top: 0;
}

.abc-consent-toggle-row:last-child {
  border-bottom: none;
}

.abc-consent-option-text {
  flex: 1;
}

.abc-consent-label {
  display: block;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 0.25rem;
  cursor: pointer;
  color: var(--consent-fg);
}

.abc-consent-label a {
  color: var(--consent-fg);
  text-decoration: underline;
}

.abc-consent-desc {
  font-size: 13px;
  font-weight: 300;
  line-height: 1.45;
  margin: 0;
  opacity: 0.55;
}

/* ── Toggle switch ───────────────────────────────────────────────────────── */

.abc-consent-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.abc-consent-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.abc-consent-slider {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.abc-consent-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--abc-off-white, #f9f7f7);
  border-radius: 50%;
  transition: transform 0.15s ease;
}

.abc-consent-switch input:checked + .abc-consent-slider {
  background: var(--consent-accent);
}

.abc-consent-switch input:checked + .abc-consent-slider::before {
  transform: translateX(20px);
}

.abc-consent-switch input:focus-visible + .abc-consent-slider {
  outline: 2px solid var(--consent-fg);
  outline-offset: 2px;
}

/* Disabled switch for "always active" */
.abc-consent-switch.--disabled {
  opacity: 0.5;
  pointer-events: none;
}

.abc-consent-switch.--disabled .abc-consent-slider {
  background: var(--consent-accent);
}

.abc-consent-switch.--disabled .abc-consent-slider::before {
  transform: translateX(20px);
}

/* ── Action buttons — uses theme .btn class ──────────────────────────────── */

.abc-consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
  margin-top: 1.5rem;
}

/* ── Cookie settings footer trigger ──────────────────────────────────────── */

#abc-consent-settings-trigger a {
  font-family: var(--body-font, "Open Sauce Two", Helvetica, Arial, sans-serif);
  color: var(--abc-black, #262323);
  text-decoration: none;
  font-size: 13px;
  letter-spacing: 0.02em;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}

#abc-consent-settings-trigger a:hover {
  opacity: 1;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 600px) {
  #abc-consent-popup {
    left: 0.75em;
    right: 0.75em;
    bottom: 0.75em;
    width: auto;
    max-width: none;
    padding: 1.5rem;
  }

  .abc-consent-actions {
    flex-direction: column;
  }

  .abc-consent-actions .btn {
    width: 100%;
    text-align: center;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  #abc-consent-overlay,
  #abc-consent-popup,
  .abc-consent-close,
  .abc-consent-slider,
  .abc-consent-slider::before,
  .abc-consent-privacy-link {
    transition-duration: 0.01ms !important;
  }
}

/* ── Protect from a11y overrides ─────────────────────────────────────────── */

html.a11y-high-contrast #abc-consent-popup,
html.a11y-high-contrast #abc-consent-overlay {
  border-color: inherit !important;
  background-color: inherit !important;
  color: inherit !important;
}

html.a11y-no-motion #abc-consent-popup,
html.a11y-no-motion #abc-consent-popup *,
html.a11y-no-motion #abc-consent-popup *::before,
html.a11y-no-motion #abc-consent-popup *::after,
html.a11y-no-motion #abc-consent-overlay {
  transition-duration: 0.3s !important;
}

/* ── Dark theme support ──────────────────────────────────────────────────── */

[data-theme="abc-black"] #abc-consent-popup,
[data-theme="black"] #abc-consent-popup {
  --consent-bg: #ffffff;
  --consent-fg: #262323;
  background: #ffffff !important;
  color: #262323;
}

[data-theme="abc-black"] .abc-consent-header,
[data-theme="black"] .abc-consent-header {
  border-bottom-color: rgba(249, 247, 247, 0.1);
}

[data-theme="abc-black"] .abc-consent-toggle-row,
[data-theme="black"] .abc-consent-toggle-row {
  border-bottom-color: rgba(249, 247, 247, 0.06);
}

[data-theme="abc-black"] .abc-consent-close,
[data-theme="black"] .abc-consent-close {
  color: var(--abc-off-white, #f9f7f7);
  border-color: rgba(249, 247, 247, 0.12);
}

[data-theme="abc-black"] .abc-consent-slider,
[data-theme="black"] .abc-consent-slider {
  background: rgba(249, 247, 247, 0.12);
}
