/* ============================================
   Promo Banner (generic, campaign-agnostic)
   ============================================
   Styles for the banner rendered by /js/promo-banner.js into the
   #promo-banner-root slot. Everything is namespaced under .pti-promo-banner
   so it cannot clash with existing site CSS. Colors and fonts come from the
   site's existing :root variables (style.css) with safe fallbacks — nothing
   campaign-specific is hardcoded here, so the file is reusable as-is for
   future campaigns.

   The empty #promo-banner-root slot renders nothing and takes no space, so
   it is safe to leave in every page permanently between campaigns. */

#promo-banner-root:empty {
    display: none;
}

.pti-promo-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001; /* one above the site navbar (z-index: 1000) */
    background: linear-gradient(135deg, var(--primary-dark, #1e40af) 0%, var(--primary-color, #2563eb) 100%);
    color: #ffffff;
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
    line-height: 1.4;
}

.pti-promo-banner__inner {
    /* Matches the site's .container convention (max-width 1200px, centered) */
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 1.25rem;
    /* Extra right padding reserves room for the fixed dismiss button */
    padding: 0.625rem 3.5rem 0.625rem 1.25rem;
}

.pti-promo-banner__text {
    margin: 0;
    text-align: center;
    font-size: clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
}

.pti-promo-banner__headline {
    font-weight: 700;
    margin-right: 0.5rem;
    white-space: nowrap;
}

.pti-promo-banner__subtext {
    opacity: 0.92;
}

.pti-promo-banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
}

.pti-promo-banner__counter {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.pti-promo-banner__counter-num {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pti-promo-banner__cta {
    display: inline-block;
    background-color: #ffffff;
    color: var(--primary-dark, #1e40af);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.45rem 1rem;
    border-radius: 8px; /* matches the site's .btn radius */
    white-space: nowrap;
    transition: var(--transition, all 0.3s ease);
}

.pti-promo-banner__cta:hover,
.pti-promo-banner__cta:focus-visible {
    background-color: var(--bg-light, #f9fafb);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md, 0 4px 6px -1px rgba(0, 0, 0, 0.1));
}

.pti-promo-banner__dismiss {
    position: absolute;
    top: 50%;
    right: 0.25rem;
    transform: translateY(-50%);
    /* 44x44 minimum tap target */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    border-radius: 8px;
    opacity: 0.85;
    transition: var(--transition, all 0.3s ease);
}

.pti-promo-banner__dismiss:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.15);
}

.pti-promo-banner__dismiss:focus-visible {
    opacity: 1;
    outline: 2px solid #ffffff;
    outline-offset: -4px;
}

/* ---- Tablet (~768–1024px): single row, slightly tighter ---- */
@media (min-width: 641px) and (max-width: 1024px) {
    .pti-promo-banner__inner {
        gap: 0.5rem 1rem;
        padding: 0.5rem 3.25rem 0.5rem 1rem;
    }

    .pti-promo-banner__cta {
        padding: 0.4rem 0.875rem;
    }
}

/* ---- Mobile (≤640px): stack text above actions, dismiss pinned top-right ---- */
@media (max-width: 640px) {
    .pti-promo-banner__inner {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.625rem 3rem 0.625rem 1rem;
    }

    .pti-promo-banner__headline {
        display: block;
        margin-right: 0;
        white-space: normal;
    }

    .pti-promo-banner__subtext {
        display: block;
        font-size: 0.8125rem;
    }

    .pti-promo-banner__actions {
        width: 100%;
    }

    .pti-promo-banner__dismiss {
        top: 0.25rem;
        right: 0.25rem;
        transform: none;
    }
}

/* ============================================
   Site integration: keep the fixed navbar and
   page content below the banner (no overlap,
   no layout shift). --pti-promo-height is set
   by promo-banner.js only while the banner is
   visible; without it these rules are inert.
   ============================================ */
body.pti-promo-visible {
    margin-top: var(--pti-promo-height, 0px);
}

body.pti-promo-visible .navbar {
    top: var(--pti-promo-height, 0px);
}

/* The mobile slide-in nav menu is fixed below the 70px navbar (style.css);
   shift it down by the banner height too. */
@media (max-width: 768px) {
    body.pti-promo-visible .nav-menu {
        top: calc(70px + var(--pti-promo-height, 0px));
        height: calc(100vh - 70px - var(--pti-promo-height, 0px));
    }
}

@media print {
    .pti-promo-banner {
        display: none;
    }
}
