/* Impact Fund newsletter: the native dialog and the raw Flodesk form inside it.
   Mirrors the Blog raw-form treatment, stacked to one column because this
   sits in the narrow right-hand column of the impact-follow section. */

dialog.impact-signup-dialog {
  position: fixed;
  box-sizing: border-box;
  width: min(100% - 32px, 560px);
  max-height: calc(100svh - 32px);
  /* Safari gives <dialog> no intrinsic height, so with its top and bottom
     pinned it fills to max-height; Chrome and Firefox size it to content. */
  height: fit-content;
  margin: auto;
  padding: clamp(28px, 5vw, 52px);
  overflow-y: auto;
  color: var(--espresso, #231a10);
  background: var(--limestone, #e9e2d6);
  border: 0;
  text-align: center;
}

dialog.impact-signup-dialog::backdrop {
  background: rgba(35, 26, 16, 0.44);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
@media (prefers-reduced-transparency: reduce) {
  dialog.impact-signup-dialog::backdrop {
    background: rgba(35, 26, 16, 0.6);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

html.impact-signup-open,
html.impact-signup-open body { overflow: hidden; }

/* No JavaScript: the dialog is opened as a plain block so the form is still
   reachable and still posts. Matches launch-accessibility's existing approach
   of leaving enhanced content usable when the scripts never run. */
html:not(.zuvani-js) dialog.impact-signup-dialog {
  position: static;
  display: block;
  width: 100%;
  max-height: none;
  margin-top: 24px;
  background: transparent;
  padding-inline: 0;
}
html:not(.zuvani-js) .impact-signup-dialog__close { display: none; }

.impact-signup-dialog__close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: inherit;
  background: rgba(243, 237, 224, 0.92);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.impact-signup-dialog__close:active { transform: scale(.95); }
.impact-signup-dialog__close:focus-visible {
  outline: 2px solid var(--bronze, #8c6240);
  outline-offset: 2px;
}

.impact-signup-dialog__title {
  margin: 0 0 14px;
  font-family: var(--font-display);
  font-size: var(--text-heading-3);
  font-weight: var(--weight-display);
  line-height: var(--leading-heading);
  text-wrap: balance;
}
.impact-signup-dialog__intro {
  margin: 0 0 24px;
  color: var(--text-secondary);
  font-size: var(--text-body-sm);
  line-height: var(--leading-body-sm);
  text-wrap: pretty;
}

.impact-newsletter-raw__form {
  display: grid;
  gap: 16px;
  width: 100%;
  color: var(--espresso);
  text-align: left;
}
.impact-newsletter-raw__fields { display: grid; gap: 14px; min-width: 0; }
.impact-newsletter-raw .fd-form-group { min-width: 0; }
.impact-newsletter-raw .fd-form-label {
  display: block;
  margin-bottom: 6px;
  font-size: var(--text-body-sm);
  line-height: var(--leading-body-sm);
  font-weight: 400;
}
.impact-newsletter-raw .fd-form-control {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid var(--espresso);
  border-radius: 0;
  background: transparent;
  font: inherit;
  font-size: var(--text-body-sm);
  line-height: var(--leading-body-sm);
}
.impact-newsletter-raw input[aria-invalid="true"] { border-color: #963c32; }

.impact-newsletter-raw__consent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  column-gap: 4px;
  color: #3b2d26;
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
  overflow-wrap: anywhere;
}
.impact-newsletter-raw__consent label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  cursor: pointer;
}
.impact-newsletter-raw__consent input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--espresso);
  cursor: pointer;
}
.impact-newsletter-raw__consent a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: .15em;
}

.impact-newsletter-raw__action { display: grid; }
.impact-newsletter-raw .fd-btn {
  min-height: 52px;
  padding: 14px 28px;
  color: var(--warm-ivory, #f3ede0);
  background: #3b2d26;
  border: 1px solid #3b2d26;
  border-radius: 0;
  font: inherit;
  font-size: var(--text-label);
  letter-spacing: var(--tracking-button);
  text-transform: uppercase;
  cursor: pointer;
  transition: transform 160ms var(--ease-out);
}
.impact-newsletter-raw .fd-btn:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .impact-newsletter-raw .fd-btn:active,
  .impact-signup-dialog__close:active { transform: none; }
}

/* Match the Collective form's softer mobile treatment while leaving the
   desktop card and the raw Flodesk form behaviour unchanged. */
@media (max-width: 599px) {
  dialog.impact-signup-dialog {
    border-radius: 12px;
    box-shadow: 0 16px 56px rgb(35 26 16 / 20%);
  }
  .impact-newsletter-raw .fd-form-control {
    border-color: var(--warm-stone, #a7947e);
    border-radius: 4px;
    background: rgb(255 255 255 / 22%);
    font-size: max(16px, var(--text-body-sm));
  }
  .impact-newsletter-raw input[aria-invalid="true"] { border-color: #963c32; }
  .impact-newsletter-raw .fd-btn {
    border-radius: var(--btn-radius, 999px);
  }
}


/* ---- Post-signup confirmation, mirroring the Blog treatment ---- */
/* Shared by the post-signup return page and Blog's native confirmation dialog.
   No form, header or editorial styles are changed here. */
.impact-signup-return-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  padding: 24px;
  box-sizing: border-box;
  background: var(--warm-ivory, #f3ede0);
}

.impact-signup-confirmation {
  box-sizing: border-box;
  padding: clamp(28px, 5vw, 52px);
  color: var(--espresso, #231a10);
  background: var(--warm-ivory, #f3ede0);
  font-family: var(--font-body, "Cormorant Garamond", Georgia, serif);
  text-align: center;
}

.impact-signup-confirmation--page {
  width: min(100%, 560px);
}

dialog.impact-signup-confirmation {
  width: min(560px, calc(100% - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px);
  height: fit-content; /* Safari: size to content, never to the viewport */
  margin: auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--limestone, #e9e2d6);
  border-radius: 4px;
  box-shadow: 0 20px 70px rgb(35 26 16 / 18%);
}

dialog.impact-signup-confirmation:not([open]) {
  display: none;
}

dialog.impact-signup-confirmation::backdrop {
  background: rgb(35 26 16 / 44%);
}

html.impact-signup-confirmation-open,
html.impact-signup-confirmation-open body {
  overflow: hidden;
}

.impact-signup-confirmation .impact-signup-confirmation__mark {
  display: block;
  position: relative;
  width: 80px;
  height: 44px;
  overflow: hidden;
  margin: 0 auto 24px;
}

/* The shared PNG has a transparent canvas around the artwork, whose
   vertical centre is at 44%. Frame the existing asset, without editing it. */
.impact-signup-confirmation__mark img {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  width: 224px;
  max-width: none;
  height: auto;
  transform: translate(-50%, -44%);
}

.impact-signup-confirmation .impact-signup-confirmation__eyebrow {
  margin: 0 0 16px;
  color: var(--bronze, #8c6240);
  font-size: var(--text-label, .9rem);
  font-weight: var(--weight-label, 600);
  line-height: 1.5;
  letter-spacing: var(--tracking-label, .18em);
  text-transform: uppercase;
}

.impact-signup-confirmation .impact-signup-confirmation__title {
  max-width: 15ch;
  margin: 0 auto 20px;
  font-family: var(--font-display, "Cormorant Garamond", Georgia, serif);
  font-size: var(--text-heading-3, 2.6rem);
  font-weight: var(--weight-heading, 400);
  line-height: 1.1;
  letter-spacing: var(--tracking-heading, -.015em);
  text-wrap: balance;
}

.impact-signup-confirmation .impact-signup-confirmation__message {
  max-width: 36ch;
  margin: 0 auto 28px;
  color: var(--text-secondary, rgb(35 26 16 / 74%));
  font-size: var(--text-body, 1.2rem);
  line-height: var(--leading-body, 1.5);
  text-wrap: pretty;
}

.impact-signup-confirmation .impact-signup-confirmation__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--content-button-width, 276px);
  max-width: 100%;
  min-height: var(--content-button-height, 46px);
  padding: 8px 16px;
  border: 0;
  border-radius: var(--btn-radius, 999px);
  background: var(--espresso, #231a10);
  color: var(--warm-ivory, #f3ede0);
  font: var(--weight-label, 600) var(--content-button-font, .75rem) / 1.5 var(--font-body, "Cormorant Garamond", Georgia, serif);
  letter-spacing: var(--content-button-tracking, .16em);
  text-align: center;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  touch-action: manipulation;
}

.impact-signup-confirmation .impact-signup-confirmation__button:focus-visible {
  outline: 2px solid var(--espresso, #231a10);
  outline-offset: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .impact-signup-confirmation .impact-signup-confirmation__button:hover {
    background: var(--bronze, #8c6240);
  }
}
