/**
 * Cookie consent banner and blocked-embed placeholders.
 *
 * Accept and Decline are deliberately identical in size, weight, padding and
 * contrast. Under GDPR Art. 7(3) and the EDPB's 2023 cookie-banner report,
 * refusing has to be exactly as easy as consenting; styling Decline as a
 * de-emphasised link is the single most commonly enforced violation. If you
 * restyle these buttons, keep them symmetrical.
 *
 * @see app/cookie-consent.php
 */

.c-consent {
  --consent-blue: #005c8b;
  --consent-dark: #2a2f33;
  --consent-ink: #221f20;

  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  /* dist/styles/main.css already reaches 1000000 for the sticky nav. */
  z-index: 1000001;
  background: #fff;
  color: var(--consent-ink);
  box-shadow: 0 -2px 28px rgba(0, 0, 0, 0.18);
  font-size: 15px;
  line-height: 1.55;
}

.c-consent[hidden] {
  display: none;
}

.c-consent__inner {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 40px;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px;
}

.c-consent__text {
  flex: 1 1 420px;
}

.c-consent__title {
  margin: 0 0 6px;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
}

/* Holds the WYSIWYG field's own <p> tags, so it cannot be a <p> itself. */
.c-consent__desc {
  margin: 0 0 8px;
  max-width: 78ch;
}

.c-consent__desc p {
  margin: 0 0 8px;
}

.c-consent__desc p:last-child {
  margin-bottom: 0;
}

.c-consent__desc a {
  color: var(--consent-blue);
  text-decoration: underline;
}

.c-consent__links {
  margin: 0;
  font-size: 14px;
}

.c-consent__links a {
  color: var(--consent-blue);
  text-decoration: underline;
}

.c-consent__actions {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  gap: 12px;
  min-width: 260px;
}

/**
 * One button style, used for Accept and Decline alike: identical box, type,
 * colour and contrast, so neither choice is nudged. There is deliberately no
 * primary/secondary modifier -- adding one back is how a compliant banner
 * quietly becomes a non-compliant one.
 */
.c-consent-btn {
  display: block;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 14px 24px;
  border: 2px solid #005c8b;
  border-radius: 2px;
  background: #005c8b;
  color: #fff;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.c-consent-btn:hover {
  opacity: 0.88;
}

.c-consent-btn:focus-visible {
  outline: 3px solid #90d0f0;
  outline-offset: 2px;
}

/* --------------------------------------------------- footer revoke link -- */

/**
 * Withdrawing consent has to be as easy as giving it (GDPR Art. 7(3)), so this
 * sits on every page. .o-footer__row is a grid whose children are placed by
 * explicit grid-column; span the full width to stay out of their way at every
 * breakpoint (2, 6 and 12 columns).
 */
.c-footer-consent {
  grid-column: 1 / -1;
  justify-self: start;
  margin: 10px 0 0;
  padding: 0;
  border: 0;
  background: none;
  /* The footer is BASE blue with white type; a <button> would otherwise
     inherit the black default and vanish into the background. */
  color: #fff;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
  opacity: 0.85;
}

.c-footer-consent:hover {
  opacity: 1;
}

.c-footer-consent:focus-visible {
  outline: 2px solid #90d0f0;
  outline-offset: 3px;
}

/* ------------------------------------------------------- blocked embeds -- */

/**
 * Deliberately NOT `aspect-ratio: var(--consent-ratio)`. The placeholder now
 * carries the full banner copy, which is taller than 16:9 at most widths, and
 * aspect-ratio on a flex container does not grow to fit its content -- the text
 * would spill straight over the border. The embed's own ratio still rides along
 * in --consent-ratio for anyone who wants it.
 */
.c-consent-embed {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  padding: 28px 24px;
  border: 1px solid #dcdcdc;
  background: #f2f2f2;
  color: #221f20;
  /**
   * Left-aligned on purpose. `.o-gutenberg-content p` in the compiled theme CSS
   * out-specifies a plain `text-align: center` here, so centring the copy would
   * need a specificity fight that leaves the buttons and text disagreeing.
   */
  text-align: left;
}

.c-consent-embed__body {
  max-width: 72ch;
}

.c-consent-embed__text {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
}

.c-consent-embed__text p {
  margin: 0 0 8px;
}

.c-consent-embed__text p:last-child {
  margin-bottom: 0;
}

.c-consent-embed__text a {
  color: #005c8b;
  text-decoration: underline;
}

.c-consent-embed__title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.c-consent-embed__notice {
  margin: 0 0 16px;
  font-size: 14px;
  line-height: 1.5;
}

.c-consent-embed__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
}

/**
 * Shrink to fit the placeholder, but keep a shared min-width: left to size
 * themselves, "Accept" and "Decline" come out 4px apart, and the pair has to
 * stay symmetrical wherever it appears.
 */
.c-consent-embed__actions .c-consent-btn {
  width: auto;
  min-width: 150px;
  padding: 11px 18px;
  font-size: 15px;
}

.c-consent-embed__legal {
  margin: 14px 0 0;
  font-size: 13px;
}

.c-consent-embed__legal a {
  color: #005c8b;
  text-decoration: underline;
}

/* ------------------------------------------------------------- responsive */

@media (max-width: 780px) {
  .c-consent {
    max-height: 85vh;
    overflow-y: auto;
    font-size: 14px;
  }

  .c-consent__inner {
    gap: 18px;
    padding: 20px 16px;
  }

  .c-consent__actions {
    width: 100%;
    min-width: 0;
  }

  .c-consent-embed {
    min-height: 0;
    padding: 24px 16px;
  }

  .c-consent-embed__actions .c-consent-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .c-consent-btn {
    transition: none;
  }
}
