/*
 * HubSpot cookie banner, restyled to the redesign.
 *
 * HubSpot (loaded through GTM) injects the banner into the page with its own
 * <style> tag, full of !important and three-id selectors. Rather than out-
 * specify it, every rule here sits in a cascade layer and is !important: a
 * layered !important declaration beats any unlayered one, whatever its
 * specificity or load order.
 *
 * Linked from Layout.astro (Astro pages) and injected by build.js (legacy
 * pages), so the rd tokens aren't guaranteed: values are literal copies of
 * rd.css (--rd-ink, --rd-violet, --rd-lift, .rd-button).
 *
 * Banner text, buttons and the policy link are set in HubSpot:
 * Settings → Privacy & Consent → Cookies → Banner.
 */
@layer cookie-banner {
  /* Floating card, bottom left, above everything. */
  #hs-eu-cookie-confirmation {
    position: fixed !important;
    inset: auto auto 24px 24px !important;
    z-index: 2147483000 !important;
    width: 400px !important;
    max-width: calc(100vw - 48px) !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #ffffff !important;
    border: 0 !important;
    border-radius: 20px !important;
    box-shadow: inset 0 0 0 1px rgba(13, 0, 26, 0.1), 0 40px 80px -30px rgba(10, 6, 40, 0.7) !important;
    color: #0d001a !important;
    font-family: Inter, system-ui, -apple-system, sans-serif !important;
    animation: rd-cookie-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both !important;
  }

  /* HubSpot's bottom/top variants set their own top/bottom/left; undo them. */
  #hs-eu-cookie-confirmation.hs-cookie-notification-position-bottom,
  #hs-eu-cookie-confirmation.hs-cookie-notification-position-top {
    top: auto !important;
    bottom: 24px !important;
    left: 24px !important;
    right: auto !important;
  }

  #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-inner {
    position: relative !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 16px !important;
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 20px !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    font-family: inherit !important;
  }

  /* Wording. */
  #hs-eu-cookie-confirmation #hs-eu-policy-wording {
    margin: 0 !important;
    padding: 0 !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-policy-wording,
  #hs-eu-cookie-confirmation #hs-eu-policy-wording p,
  #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-inner p {
    margin: 0 !important;
    padding: 0 !important;
    color: rgba(13, 0, 26, 0.7) !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    text-align: left !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-policy-wording p + p { margin-top: 8px !important; }
  #hs-eu-cookie-confirmation #hs-eu-policy-wording a,
  #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-inner p a {
    color: #0d001a !important;
    font-weight: 500 !important;
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
    text-decoration-color: rgba(13, 0, 26, 0.3) !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-policy-wording a:hover,
  #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-inner p a:hover {
    text-decoration-color: currentColor !important;
  }

  /* Button rows. HubSpot nests the accept/decline group inside a buttons area
     next to "Cookie settings" on newer banners; lay both out the same way. */
  #hs-eu-cookie-confirmation #hs-en-cookie-confirmation-buttons-area,
  #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-button-group {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 8px !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    float: none !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-button-group { order: 0 !important; }

  /* Buttons: rd-button sm/md pills. */
  #hs-eu-cookie-confirmation #hs-eu-confirmation-button,
  #hs-eu-cookie-confirmation #hs-eu-decline-button,
  #hs-eu-cookie-confirmation #hs-eu-cookie-settings-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    box-sizing: border-box !important;
    min-height: 40px !important;
    height: auto !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 18px !important;
    border: 0 !important;
    border-radius: 9999px !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1 !important;
    letter-spacing: normal !important;
    text-decoration: none !important;
    text-transform: none !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    float: none !important;
    transition: background-color 0.2s, color 0.2s, box-shadow 0.2s !important;
  }

  #hs-eu-cookie-confirmation #hs-eu-confirmation-button {
    background: #685fff !important;
    color: #ffffff !important;
    box-shadow: none !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-confirmation-button:hover {
    background: #4d40ec !important;
    color: #ffffff !important;
  }

  #hs-eu-cookie-confirmation #hs-eu-decline-button {
    background: #ffffff !important;
    color: #0d001a !important;
    box-shadow: inset 0 0 0 1px rgba(13, 0, 26, 0.12) !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-decline-button:hover {
    background: #f9f9fb !important;
    color: #0d001a !important;
  }

  /* "Cookie settings": a quiet text action after Accept/Decline, pushed right. */
  #hs-eu-cookie-confirmation #hs-eu-cookie-settings-button {
    order: 1 !important;
    margin-left: auto !important;
    padding: 0 4px !important;
    background: transparent !important;
    color: rgba(13, 0, 26, 0.7) !important;
    box-shadow: none !important;
    font-weight: 500 !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-cookie-settings-button:hover {
    background: transparent !important;
    color: #0d001a !important;
    text-decoration: underline !important;
    text-underline-offset: 2px !important;
  }

  #hs-eu-cookie-confirmation #hs-eu-confirmation-button:focus-visible,
  #hs-eu-cookie-confirmation #hs-eu-decline-button:focus-visible,
  #hs-eu-cookie-confirmation #hs-eu-cookie-settings-button:focus-visible,
  #hs-eu-cookie-confirmation #hs-eu-close-button:focus-visible {
    outline: 2px solid #685fff !important;
    outline-offset: 2px !important;
  }

  /* Close (×), when the banner has one: top right, 40px tap target. */
  #hs-eu-cookie-confirmation #hs-eu-close-button {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: 40px !important;
    height: 40px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 9999px !important;
    background-color: transparent !important;
    color: rgba(13, 0, 26, 0.45) !important;
    opacity: 1 !important;
  }
  #hs-eu-cookie-confirmation #hs-eu-close-button:hover {
    background-color: #f3f3f4 !important;
    color: #0d001a !important;
  }
  /* Keep the wording clear of the × when it's there. */
  #hs-eu-cookie-confirmation #hs-eu-close-button ~ #hs-eu-policy-wording {
    padding-right: 32px !important;
  }

  /* Phones: full width with the 20px gutter, buttons fill the row. */
  @media (max-width: 479px) {
    #hs-eu-cookie-confirmation,
    #hs-eu-cookie-confirmation.hs-cookie-notification-position-bottom,
    #hs-eu-cookie-confirmation.hs-cookie-notification-position-top {
      left: 20px !important;
      right: 20px !important;
      bottom: 20px !important;
      width: auto !important;
      max-width: none !important;
    }
    #hs-eu-cookie-confirmation #hs-eu-cookie-confirmation-button-group { width: 100% !important; }
    #hs-eu-cookie-confirmation #hs-eu-confirmation-button,
    #hs-eu-cookie-confirmation #hs-eu-decline-button { flex: 1 1 0 !important; }
    #hs-eu-cookie-confirmation #hs-eu-cookie-settings-button { margin-left: 0 !important; }
  }

  @media (prefers-reduced-motion: reduce) {
    #hs-eu-cookie-confirmation { animation: none !important; }
  }
}

@keyframes rd-cookie-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
