/**
 * Leaving-site interstitial — DONI-724 (CHR-9).
 *
 * Skinned onto contrib `external_link_popup` 2.0.1, which opens a jQuery-UI
 * dialog. We own no markup here; the module builds it. See
 * docroot/modules/contrib/external_link_popup/js/dialog.js.
 *
 * Figma (file PMOumVEsuQEHJFYkbGBD84, canvas 24410:65586):
 *   desktop `24581:12651` — 893x288, padding 60, gap 32, radius 16
 *   mobile  `24581:6971`  — 327x282 at x=24 in a 375 frame,
 *                           padding 40/24, gap 40, radius 16
 * Colours are Figma variables STEEL #515861, Coral #f16b50, White #ffffff.
 */

.ui-widget-overlay.ui-front {
  /* Figma `4045:210` "Overlay background" — STEEL at 60%. */
  background: rgb(81 88 97 / 60%);
}

/**
 * DONI-724: lock the background while the dialog is open.
 *
 * jQuery UI 1.13 does NOT do this — 1.8's `ui-dialog-disable-scroll` body class
 * was removed and nothing replaced it. Verified by source: neither
 * core/assets/vendor/jquery.ui/ui/widgets/dialog.js nor
 * core/misc/dialog/dialog.jquery-ui.js touches body overflow.
 *
 * Keyed off the dialog's own class because the module owns all the markup and
 * gives us no hook to add a body class. `create:` in dialog.js adds
 * `external-link-popup` to the wrapper, and `dialog('destroy')` removes the
 * whole wrapper on close — so this scopes itself and needs no JS.
 *
 * Deliberately NOT keyed off `.ui-widget-overlay`: that would also lock every
 * other Drupal modal on the site, which this ticket has not tested.
 *
 * `overflow: hidden` preserves scroll position; `position: fixed` would not.
 */
body:has(.external-link-popup.ui-dialog) {
  overflow: hidden;
}

.external-link-popup.external-link-popup-id-default.ui-dialog {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 60px;
  border-radius: 16px;
  max-width: 893px;
  background-color: var(--color-white);
  z-index: 1025;

  @media (max-width: 991px) {
    left: 50% !important;
    transform: translateX(-50%);
    padding: 40px 24px;
    gap: 40px;
    /* Figma draws 327 inside 375 — a 24px gutter each side. `min-width`
       rather than `width` because jQuery UI writes an inline `width` from
       the module's 85% setting, which a stylesheet `width` cannot beat
       without `!important`. Was `92%` (345px at 375), 18px too wide. */
    min-width: calc(100% - 48px);
    max-width: none;
  }

  .ui-dialog-titlebar {
    display: none;
  }

  .external-link-popup-content.ui-dialog-content.ui-widget-content {
    /* DONI-724 (QA reopen): `gin.info.yml` extends `core/drupal.dialog` with
       `gin/dialog`, and that library-extend is NOT scoped to admin routes —
       `core/themes/claro/css/components/dialog.css` and
       `themes/contrib/gin/dist/css/components/dialog.css` both load on this
       anonymous dtc_nxt page (confirmed via `document.styleSheets`, 2026-08-10).
       Claro's `> .ui-dialog-content { padding: var(--space-m) var(--space-l); }`
       (16px 24px) was previously only cancelled on mobile, so desktop carried an
       unwanted 16px top/bottom — a third of the 63px height QA measured against
       Figma. Reset unconditionally, not just under the 991px query. */
    padding: 0;
    border-radius: 20px;

    .external-link-popup-body {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
      gap: 24px;

      h3 {
        color: var(--color-steel);
        text-align: center;
        font-family: var(--font-tilt-neon);
        font-size: var(--size-h3);
        font-style: normal;
        font-weight: 400;
        /* FND-3: never `normal` on tilt-neon — that face resolves it to 1.57. */
        line-height: 1.25;
        margin: 0;

        @media (max-width: 991px) {
          /* DONI-488's value. Figma declares no mobile mode for Size/H3, so
             this is unverified against the design — see DONI-724 report. */
          font-size: 26px;
        }
      }

      p {
        color: var(--color-steel);
        text-align: center;
        /* agenda may use `normal` (1.16); the tilt-neon ban does not apply. */
        font-family: var(--font-agenda);
        font-size: var(--size-body);
        font-style: normal;
        font-weight: 400;
        line-height: normal;
        margin: 0;
      }
    }
  }

  .ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix {
    background: white;
    margin-top: 0;
    border: 0;
    border-radius: 20px;
    padding: 0;

    .ui-dialog-buttonset {
      /* DONI-724 (QA reopen): same Claro/Gin leak as the content padding above.
         Claro sets `.ui-dialog-buttonpane .ui-dialog-buttonset { margin-block:
         var(--space-m); margin-inline-end: var(--space-l); }` (16px top/bottom,
         24px right, 0 left) with nothing here to cancel it. That's the other
         two-thirds of the height excess, the doubled subcopy-to-buttons gap
         (32px flex gap + 16px leaked top margin), and — because a 100%-width
         flex item plus a non-zero, non-symmetric margin does not net to a
         centered box — the buttonset rendering flush-left instead of centered,
         which is what QA saw as wrong button positions on mobile. */
      margin: 0;
      display: flex;
      justify-content: center;
      width: 100%;
      gap: 16px;

      .button {
        display: flex;
        height: 48px;
        padding: 13px 16px 11px 24px;
        justify-content: center;
        align-items: center;
        gap: 8px;
        border-radius: 999px;
        font-style: normal;
        font-weight: 700;
        position: relative;
        font-size: var(--size-body);
        margin: 0;

        @media (max-width: 991px) {
          gap: 5px;
          max-width: 145px;
        }
      }

      /* Proceed. Figma `24581:12656`, 140x48. */
      .button:nth-child(1) {
        background: var(--color-coral);
        font-family: var(--font-agenda);
        color: var(--color-white);
      }

      /* DONI-724: a `:focus { outline: none }` rule lived here and stripped the
         focus ring from the modal's primary action — WCAG 2.4.7 (AA). Removed
         so `reset.css`'s `*:focus-visible` applies. Do not reinstate it. */

      .button:nth-child(1)::after {
        content: "";
        width: 24px;
        height: 24px;
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        display: inline-block;
        background: url("../../images/icons/chevron-right.svg");
      }

      /* Cancel. Figma `24581:12665`, 128x48. */
      .button:nth-child(2) {
        font-family: var(--font-agenda);
        background: var(--color-white);
        border: 3px solid var(--color-coral);
        color: var(--color-coral);
      }

      .button:nth-child(2)::after {
        content: "";
        width: 24px;
        height: 24px;
        background-repeat: no-repeat;
        background-position: center;
        background-size: contain;
        display: inline-block;
        background: url("../../images/icons/arrow-coral-right.svg");
      }
    }
  }
}
