/* project5.ai consent UI — matches the site chrome: Space Grotesk, warm near-black
   surfaces, brass accent. Self-contained: every value the widget needs is declared
   on its own roots, so the stack can be lifted into a host theme unchanged. */

.p5-consent,
.p5-consent-control {
  --p5c-surface: #161614;
  --p5c-line: #2E2E2A;
  --p5c-btn-bg: #201F1D;
  --p5c-btn-bg-hover: #2C2B27;
  /* Boundary colours are set for >=3:1 against both the button fill and the banner
     surface (WCAG 2.2 SC 1.4.11) — the border is what identifies the control here,
     since the fill barely separates from the surface. */
  --p5c-btn-line: #706E64;
  --p5c-btn-line-hover: #9A978A;
  --p5c-heading: #F4F4EE;
  --p5c-body: #B4B4AC;
  --p5c-btn-text: #EDEDE7;
  --p5c-link: #D6C39A;
  --p5c-accent: #D6C39A;
  --p5c-font: 'Space Grotesk', ui-sans-serif, -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  box-sizing: border-box;
}

.p5-consent *,
.p5-consent-control * {
  box-sizing: border-box;
}

.p5-consent[hidden],
.p5-consent-control[hidden] {
  display: none !important;
}

/* Defensive against host themes that hide or animate everything on scroll: this is
   a legal control, not decoration, so it opts its whole subtree out. */
.p5-consent,
.p5-consent *,
.p5-consent-control {
  visibility: visible !important;
}

/* ---------- Banner ---------- */

.p5-consent {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 6000;
  background: var(--p5c-surface);
  border-top: 1px solid var(--p5c-line);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.6);
  padding: 22px 24px;
  padding-bottom: max(22px, env(safe-area-inset-bottom));
  max-height: 88vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: p5-consent-in 240ms cubic-bezier(0, 0, 0.2, 1) both;
}

/* Hairline of brass along the top edge — the same signal the site uses for
   "this is the system talking". */
.p5-consent::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--p5c-accent), transparent);
  opacity: 0.5;
}

@keyframes p5-consent-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.p5-consent-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 32px;
}

.p5-consent-copy {
  flex: 1 1 auto;
  min-width: 0;
}

/* Host pages style bare h2/p elements; reset anything that would leak in. */
.p5-consent-title {
  font-family: var(--p5c-font);
  font-weight: 500;
  font-size: 0.75rem;
  line-height: 1.3;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--p5c-heading);
  margin: 0 0 8px;
  padding: 0;
  border: 0;
}

/* Focus moves to the dialog container on open so screen readers announce it. The
   container is not an interactive control, so it takes no visible ring; every
   control inside it does. */
.p5-consent:focus {
  outline: none;
}

.p5-consent-text {
  font-family: var(--p5c-font);
  font-weight: 400;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--p5c-body);
  margin: 0;
  max-width: 68ch;
}

.p5-consent-text a {
  color: var(--p5c-link);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.p5-consent-text a:hover {
  color: #E8DAB8;
}

.p5-consent-gpc {
  font-family: var(--p5c-font);
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.6;
  color: #DAD8CE;
  background: rgba(214, 195, 154, 0.09);
  border-left: 3px solid var(--p5c-accent);
  padding: 10px 14px;
  margin: 12px 0 0;
  max-width: 68ch;
}

/* Accept and Decline are deliberately identical: same size, colour, weight, border
   and hover treatment, in that order. Refusing must be exactly as easy as accepting. */
.p5-consent-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 12px;
}

.p5-consent-btn {
  font-family: var(--p5c-font);
  font-weight: 500;
  font-size: 0.8125rem;
  line-height: 1.5;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--p5c-btn-text);
  background: var(--p5c-btn-bg);
  border: 1px solid var(--p5c-btn-line);
  border-radius: 2px;
  padding: 0.875rem 2rem;
  min-width: 148px;
  min-height: 48px;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
  -webkit-appearance: none;
  appearance: none;
}

.p5-consent-btn:hover {
  background: var(--p5c-btn-bg-hover);
  border-color: var(--p5c-btn-line-hover);
  color: #FFFFFF;
}

/* Declared !important so the ring survives host themes that zero out outlines
   site-wide — a mistake common enough to defend against. */
.p5-consent-btn:focus-visible,
.p5-consent-text a:focus-visible,
.p5-consent-control:focus-visible {
  outline: 3px solid var(--p5c-accent) !important;
  outline-offset: 2px;
}

/* ---------- Floating re-open control ---------- */

.p5-consent-control {
  position: fixed;
  left: 16px;
  bottom: 16px;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5999;
  font-family: var(--p5c-font);
  font-weight: 500;
  font-size: 0.6875rem;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #C8C6BC;
  background: rgba(22, 22, 20, 0.94);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid var(--p5c-btn-line);
  border-radius: 2px;
  padding: 0 18px;
  min-height: 44px;
  cursor: pointer;
  transition: background-color 160ms ease-out, border-color 160ms ease-out, color 160ms ease-out;
  -webkit-appearance: none;
  appearance: none;
}

.p5-consent-control:hover {
  color: #FFFFFF;
  background: rgba(44, 43, 39, 0.97);
  border-color: var(--p5c-btn-line-hover);
}

/* ---------- Mobile: full-width card, stacked equal-width buttons ---------- */

@media (max-width: 767px) {
  .p5-consent {
    padding: 20px 16px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }

  .p5-consent-inner {
    display: block;
  }

  .p5-consent-actions {
    display: block;
    margin-top: 18px;
  }

  .p5-consent-btn {
    display: block;
    width: 100%;
    min-width: 0;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .p5-consent-btn + .p5-consent-btn {
    margin-top: 12px;
  }

  .p5-consent-control {
    left: 12px;
    bottom: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .p5-consent {
    animation: none;
  }

  .p5-consent-btn,
  .p5-consent-control {
    transition: none;
  }
}
