/* WHEEL_ELITE_PAID_LAUNCH_MOBILE_FIXES_V1
 * Additive safeguards for the Fuel premium conversion layer.
 * Desktop composition is intentionally unchanged.
 */

/* Keep premium modules inside their containing column without disabling
 * intentional carousel or dialog scrolling. */
.we-fuel-related,
.we-blueprint-compact-intro,
.we-blueprint-teaser,
.we-blueprint-popup,
.we-blueprint-popup-shell,
.we-blueprint-workspace,
.we-blueprint-workspace-shell,
.we-blueprint-workspace-form,
.we-fitment-glance,
.we-supporting-details,
.we-supporting-details-body {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}

.we-fuel-related-heading,
.we-fuel-related-actions,
.we-fuel-card,
.we-fuel-card-copy,
.we-blueprint-compact-copy,
.we-blueprint-popup-copy,
.we-blueprint-modal-panel,
.we-blueprint-modal-panel .we-blueprint-fields,
.we-supporting-details > summary,
.we-supporting-details-body > * {
  min-inline-size: 0;
  max-inline-size: 100%;
}

.we-fuel-related-heading *,
.we-fuel-card-copy *,
.we-blueprint-compact-copy *,
.we-blueprint-popup-copy *,
.we-blueprint-modal-panel *,
.we-supporting-details * {
  overflow-wrap: anywhere;
}

.we-fuel-card-media img,
.we-blueprint-compact-photo img,
.we-blueprint-popup-visual img,
.we-blueprint-workspace-visual img {
  max-inline-size: 100%;
}

/* Lock the document only while the native lead-magnet dialog is open. The
 * dialog itself remains the scroll container when a short screen needs it. */
html.we-blueprint-popup-open,
html.we-blueprint-popup-open body {
  overflow: hidden;
  overscroll-behavior: none;
}

@media (max-width: 760px) {
  .we-fuel-related,
  .we-blueprint-compact-intro,
  .we-blueprint-teaser,
  .we-fitment-glance,
  .we-supporting-details {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    margin-left: 0;
  }

  /* Reserve a real viewport gutter. Explicit border-box sizing prevents the
   * dialog border from extending beyond a 390px viewport. */
  .we-blueprint-popup {
    position: fixed;
    inset: auto;
    top: 50%;
    right: auto;
    bottom: auto;
    left: 50%;
    width: calc(100vw - 20px);
    width: calc(100dvw - 20px);
    max-width: 370px;
    max-inline-size: calc(100vw - 20px);
    max-inline-size: calc(100dvw - 20px);
    height: fit-content;
    max-block-size: calc(100dvh - 20px);
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    overflow-x: clip;
    border-radius: 16px;
    transform: translate(-50%, -50%);
  }

  .we-blueprint-popup-shell {
    display: flex;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: calc(100vh - 20px);
    max-height: calc(100dvh - 20px);
    flex-direction: column;
    overflow: hidden;
  }

  .we-blueprint-popup-shell > * {
    min-width: 0;
    max-width: 100%;
  }

  .we-blueprint-popup-close {
    top: 8px;
    right: 8px;
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
    box-sizing: border-box;
  }

  .we-blueprint-popup-visual {
    width: 100%;
    min-height: 92px;
    max-height: 104px;
    flex: 0 0 96px;
  }

  .we-blueprint-popup-visual picture,
  .we-blueprint-popup-visual img {
    display: block;
    width: 100%;
    height: 100%;
  }

  .we-blueprint-popup-copy {
    display: flex;
    min-height: 0;
    max-height: calc(100vh - 116px);
    max-height: calc(100dvh - 116px);
    flex: 0 1 auto;
    justify-content: flex-start;
    padding: 13px 14px 11px;
    overflow-x: clip;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  .we-blueprint-popup-kicker {
    font-size: 0.66rem;
    line-height: 1.25;
  }

  .we-blueprint-popup h2 {
    max-width: 100%;
    margin: 4px 0 6px;
    padding-right: 38px;
    font-size: clamp(1.32rem, 6.4vw, 1.55rem);
    line-height: 1.04;
  }

  .we-blueprint-popup-copy > p {
    font-size: 0.82rem;
    line-height: 1.38;
  }

  .we-blueprint-popup-benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    margin: 8px 0 7px;
  }

  .we-blueprint-popup-benefits span {
    display: grid;
    min-width: 0;
    min-height: 32px;
    place-items: center;
    padding: 5px 4px;
    text-align: center;
    white-space: normal;
  }

  .we-blueprint-popup .we-blueprint-popup-note {
    font-size: 0.66rem;
    line-height: 1.3;
  }

  .we-blueprint-popup-actions {
    gap: 2px;
    margin-top: 7px;
  }

  .we-blueprint-popup-cta,
  .we-blueprint-popup-later {
    width: 100%;
    max-width: 100%;
  }

  .we-blueprint-popup-cta {
    min-height: 46px;
    padding: 10px 12px;
    white-space: normal;
  }

  .we-blueprint-popup-later {
    min-height: 42px;
    padding: 8px 10px;
  }

  /* The full blueprint workspace is a separate dialog, but it uses the same
   * premium layer. Keep its existing scrolling behavior inside the viewport. */
  .we-blueprint-workspace {
    width: calc(100vw - 12px);
    width: calc(100dvw - 12px);
    max-width: calc(100vw - 12px);
    max-width: calc(100dvw - 12px);
  }

  .we-fuel-card-grid {
    max-inline-size: 100%;
    overscroll-behavior-inline: contain;
  }
}

@media (max-width: 760px) and (max-height: 620px) {
  .we-blueprint-popup-visual {
    min-height: 70px;
    max-height: 76px;
    flex-basis: 72px;
  }

  .we-blueprint-popup-copy {
    max-height: calc(100vh - 92px);
    max-height: calc(100dvh - 92px);
    padding-top: 10px;
  }

  .we-blueprint-popup h2 {
    font-size: 1.3rem;
  }

  .we-blueprint-popup-benefits {
    margin-block: 6px;
  }
}

@supports not (height: 100dvh) {
  @media (max-width: 760px) {
    .we-blueprint-popup,
    .we-blueprint-popup-shell {
      max-height: calc(100vh - 20px);
    }

    .we-blueprint-popup-copy {
      max-height: calc(100vh - 116px);
    }
  }
}
