/*
 * COMMAND 3100_075B — P0 STOREFRONT USABILITY REPAIR
 * No visual redesign. Layout/usability only. Load LAST after 074.
 */

:root {
  --cw-sticky-bar-height: 0px;
}

/* P0-1: Mobile reveal must not leave opacity:0 content occupying multi-screen blank space */
@media (max-width: 900px) {
  .cw-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* P0-2: Reserve real space for mobile sticky CTA; coordinate via CSS variable */
@media (max-width: 768px) {
  :root {
    /* height owned by JS/075d measured var — do not force a magic 72px */
    --cw-sticky-bar-height: 0px;
  }

  body.cw-r2 {
    padding-bottom: var(--cw-sticky-bar-height) !important;
  }

  /* Hero CTAs stay above sticky while hero is in view */
  body.cw-r2 .cw-im-hero,
  body.cw-r2 .cw-hero {
    padding-bottom: calc(var(--cw-sticky-bar-height) + 24px) !important;
    box-sizing: border-box;
  }

  body.cw-r2 .cw-im-hero-copy,
  body.cw-r2 .cw-hero-content {
    margin-bottom: 0 !important;
  }

  body.cw-r2 .cw-hero-actions {
    position: relative;
    z-index: 2;
    padding-bottom: 4px;
  }

  /* Sticky deferred until past hero (JS toggles .is-past-hero) */
  body.cw-r2 .cw-mobile-sticky-cta {
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  body.cw-r2 .cw-mobile-sticky-cta.is-gated:not(.is-past-hero) {
    transform: translateY(110%);
    opacity: 0;
    pointer-events: none;
  }

  body.cw-r2 .cw-mobile-sticky-cta.is-gated.is-past-hero {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  /* Contact dock sits above sticky when sticky is visible */
  body.cw-r2 .contact-widget-container.cw-g-dock,
  body.cw-r2 .contact-widget-container {
    bottom: calc(var(--cw-sticky-bar-height) + 12px) !important;
  }

  body.cw-r2:has(.cw-mobile-sticky-cta.is-gated:not(.is-past-hero)) .contact-widget-container,
  body.cw-r2:has(.cw-mobile-sticky-cta.is-gated:not(.is-past-hero)) .contact-widget-container.cw-g-dock {
    bottom: 14px !important;
  }
}

/* Product detail sticky bar clearance */
@media (max-width: 899px) {
  body.cw-r2.cw-product-detail {
    --cw-pd-sticky-bar-height: calc(64px + env(safe-area-inset-bottom, 0px));
  }

  body.cw-r2.cw-product-detail:not(.pd-lead-open) .pd-sticky-cta.is-active {
    /* measured via variable for padding */
  }

  body.cw-r2.cw-product-detail:has(.pd-sticky-cta.is-active) .pd-wrap {
    padding-bottom: calc(var(--cw-pd-sticky-bar-height, 64px) + 24px) !important;
  }

  body.cw-r2.cw-product-detail:has(.pd-sticky-cta.is-active) .contact-widget-container {
    bottom: calc(var(--cw-pd-sticky-bar-height, 64px) + 12px) !important;
  }
}
