
/* ==========================================================================
   PersonaHarbor A2 Cookie Consent & Preferences Drawer (Consent Mode v2)
   Design System: Harbor Lights · Navy Hour
   ========================================================================== */

/* 1. Reset & Banner Base (Fixed, 0 CLS) */
:root #ph-consent-banner[hidden] {
  display: none !important;
}

:root #ph-consent-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  width: calc(100% - 32px);
  max-width: 880px;
  background: rgba(14, 13, 20, 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(201, 169, 255, 0.18);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 0 0 1px rgba(201, 169, 255, 0.25);
  z-index: 99990;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  box-sizing: border-box;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #D9D4E6;
  transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
}

:root #ph-consent-banner.ph-consent-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}

:root .ph-consent-container {
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  box-sizing: border-box;
}

:root .ph-consent-message {
  flex: 1 1 auto;
  font-size: 14px;
  line-height: 1.5;
  color: #D9D4E6;
  margin: 0;
}

:root .ph-consent-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

/* JetBrains Mono Uppercase Buttons */
:root .ph-consent-btn {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 18px;
  border-radius: 8px;
  cursor: pointer;
  line-height: 1.2;
  white-space: nowrap;
  box-sizing: border-box;
  text-align: center;
  text-decoration: none !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  min-width: 130px;
  transition: opacity 150ms ease, background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

/* Accept: Solid lilac background, dark text */
:root .ph-consent-btn--accept {
  background-color: #C9A9FF;
  color: #0E0D14 !important;
  border: 1px solid #C9A9FF;
}

:root .ph-consent-btn--accept:hover {
  background-color: #D6BDFF;
  border-color: #D6BDFF;
}

/* Decline: Transparent background, lilac border and text, same dimensions */
:root .ph-consent-btn--decline {
  background-color: transparent;
  color: #C9A9FF !important;
  border: 1px solid #C9A9FF;
}

:root .ph-consent-btn--decline:hover {
  background-color: rgba(201, 169, 255, 0.08);
}

/* Preferences Text Link */
:root .ph-consent-link {
  background: none;
  border: none;
  color: #8D96A4;
  font-family: Inter, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 4px;
  white-space: nowrap;
  transition: color 150ms ease;
}

:root .ph-consent-link:hover {
  color: #C9A9FF;
}

/* 2. Preferences Drawer & Backdrop */
:root #ph-consent-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 16, 30, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  z-index: 99995;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 200ms ease, visibility 200ms;
}

:root #ph-consent-drawer-overlay.ph-drawer-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

:root #ph-consent-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  max-width: 440px;
  background: #071628;
  border-left: 1px solid rgba(201, 169, 255, 0.18);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.7);
  z-index: 99996;
  transform: translateX(100%);
  visibility: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #D9D4E6;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1), visibility 240ms;
}

:root #ph-consent-drawer.ph-drawer-open {
  transform: translateX(0);
  visibility: visible;
}

:root .ph-drawer-header {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(201, 169, 255, 0.12);
}

:root .ph-drawer-title {
  margin: 0;
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 24px;
  font-weight: 400;
  color: #F3EBDD;
  letter-spacing: -0.01em;
}

:root .ph-drawer-close {
  background: transparent;
  border: none;
  color: #8D96A4;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: color 150ms ease;
}

:root .ph-drawer-close:hover {
  color: #F3EBDD;
}

:root .ph-drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

:root .ph-drawer-desc {
  font-size: 13px;
  line-height: 1.55;
  color: #8D96A4;
  margin: 0;
}

/* Category Card */
:root .ph-drawer-item {
  background: #0B1B30;
  border: 1px solid rgba(201, 169, 255, 0.12);
  border-radius: 10px;
  padding: 16px;
}

:root .ph-drawer-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

:root .ph-drawer-item-title {
  font-size: 14px;
  font-weight: 600;
  color: #F3EBDD;
  display: flex;
  align-items: center;
  gap: 8px;
}

:root .ph-drawer-item-desc {
  font-size: 13px;
  line-height: 1.5;
  color: #8D96A4;
  margin: 0;
}

:root .ph-drawer-badge-locked {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8D96A4;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 3px 8px;
  border-radius: 4px;
}

/* Toggle Switch */
:root .ph-toggle-wrap {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

:root .ph-toggle-wrap input {
  opacity: 0;
  width: 0;
  height: 0;
}

:root .ph-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #1A2D47;
  border: 1px solid rgba(201, 169, 255, 0.2);
  transition: 200ms ease;
  border-radius: 24px;
}

:root .ph-toggle-slider::before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: #8D96A4;
  transition: 200ms ease;
  border-radius: 50%;
}

:root .ph-toggle-wrap input:checked + .ph-toggle-slider {
  background-color: rgba(201, 169, 255, 0.24);
  border-color: #C9A9FF;
}

:root .ph-toggle-wrap input:checked + .ph-toggle-slider::before {
  transform: translateX(20px);
  background-color: #C9A9FF;
}

:root .ph-toggle-wrap input:disabled + .ph-toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* GPC Alert Box in Drawer */
:root .ph-drawer-gpc-notice {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.45;
  color: #8EC3E0;
  background: rgba(142, 195, 224, 0.08);
  border: 1px solid rgba(142, 195, 224, 0.25);
  padding: 10px 14px;
  border-radius: 8px;
}

:root .ph-drawer-footer {
  padding: 20px 24px;
  border-top: 1px solid rgba(201, 169, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: #04101E;
}

:root .ph-drawer-save-btn {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background-color: #C9A9FF;
  color: #0E0D14;
  border: 1px solid #C9A9FF;
  padding: 10px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 150ms ease;
}

:root .ph-drawer-save-btn:hover {
  background-color: #D6BDFF;
}

/* 3. Mobile Viewport Adjustments (< 768px) */
@media (max-width: 767.98px) {
  :root #ph-consent-banner {
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    transform: translateY(8px);
    border-radius: 14px 14px 0 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    max-height: 22vh;
    overflow-y: auto;
    padding: 14px 16px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  }

  :root #ph-consent-banner.ph-consent-active {
    transform: translateY(0);
  }

  :root .ph-consent-container {
    padding: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  :root .ph-consent-message {
    font-size: 13px;
    line-height: 1.4;
  }

  :root .ph-consent-actions {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    width: 100%;
  }

  :root .ph-consent-btn {
    flex: 1 1 calc(50% - 5px);
    min-width: 0;
    padding: 8px 12px;
    font-size: 11px;
    min-height: 36px;
  }

  :root .ph-consent-link {
    width: 100%;
    text-align: center;
    padding: 2px 0 4px;
    font-size: 12px;
  }

  /* Drawer on Mobile slides up from bottom */
  :root #ph-consent-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 80vh;
    border-left: none;
    border-top: 1px solid rgba(201, 169, 255, 0.18);
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  :root #ph-consent-drawer.ph-drawer-open {
    transform: translateY(0);
  }
}

/* 4. Accessibility: Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  :root #ph-consent-banner,
  :root #ph-consent-drawer-overlay,
  :root #ph-consent-drawer,
  :root .ph-consent-btn,
  :root .ph-toggle-slider,
  :root .ph-toggle-slider::before {
    transition: none !important;
    transform: none !important;
  }
  :root #ph-consent-drawer {
    display: none;
  }
  :root #ph-consent-drawer.ph-drawer-open {
    display: flex;
  }
}

