/* RcloneView Mobile launch — popup (Tier 1) + sticky banner (Tier 2). */

:root {
    --ml-ink: #232a33;
    --ml-ink-2: #3a4552;
    --ml-ink-soft: #6b7684;
    --ml-accent: #ffa735;
    --ml-accent-2: #e08f1f;
    --ml-paper: #ffffff;
    --ml-soft: #f4f6fa;
    --ml-muted: #6c757d;
}

/* Load sentinel — mobile_launch.js checks this before un-hiding the banner/popup,
   so a missing or stale stylesheet degrades to "not shown" instead of raw markup. */
.ml-banner,
.ml-popup {
    --ml-css-loaded: 1;
}

/* ─────────────────────────── Tier 2: sticky banner ─────────────────────────── */

.ml-banner {
    position: relative;
    display: none; /* JS toggles to flex when not dismissed */
    align-items: center;
    gap: 12px;
    padding: 10px 44px 10px 16px;
    background: linear-gradient(90deg, #20262e 0%, #333d49 55%, #9a5f14 100%);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.3;
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.ml-banner:hover {
    color: #fff;
}
.ml-banner.is-visible {
    display: flex;
}

.ml-banner__icon {
    font-size: 18px;
    color: var(--ml-accent);
    flex-shrink: 0;
}
.ml-banner__text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ml-banner__text strong {
    font-weight: 700;
    color: #fff;
}
.ml-banner__cta {
    flex-shrink: 0;
    font-weight: 600;
    color: var(--ml-accent);
    white-space: nowrap;
}
.ml-banner__close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}
.ml-banner__close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

@media (max-width: 560px) {
    .ml-banner {
        font-size: 12px;
        padding: 8px 40px 8px 12px;
        gap: 8px;
    }
    .ml-banner__text {
        white-space: normal;
    }
}

/* ─────────────────────────── Tier 1: full popup ─────────────────────────── */

.ml-popup {
    position: fixed;
    inset: 0;
    z-index: 100000; /* above the fixed nav wrapper (z-index 99999) */
    display: none; /* JS toggles to flex when first visit */
    overflow-y: auto; /* container scrolls when card taller than viewport */
    padding: 16px;
    font-family: inherit;
}
.ml-popup.is-visible {
    display: flex;
    flex-direction: column; /* main axis = vertical: child margin:auto distributes Y free space */
    align-items: center; /* cross axis = horizontal center */
}

.ml-popup__backdrop {
    position: fixed; /* stays put while container scrolls — backdrop always covers viewport */
    inset: 0;
    background: rgba(28, 34, 42, 0.78);
    backdrop-filter: blur(2px);
}
.ml-popup__card {
    position: relative;
    /* Team feedback 2026-07: popup felt too dominant — render the whole card
       at 80%. The store QR compensates back to full size below (scan
       reliability), and the mobile layout opts out. Stage thresholds are
       calibrated to the zoomed heights. */
    zoom: 0.8;
    width: min(960px, 100%);
    margin: auto 0; /* flex item: vertical center when free space, top-aligned when card > viewport */
    background: var(--ml-paper);
    border-radius: 24px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.38), 0 8px 24px rgba(35, 42, 51, 0.12);
    padding: 44px 44px 28px;
    animation: ml-pop 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes ml-pop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.ml-popup__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 0;
    background: var(--ml-soft);
    color: var(--ml-ink);
    cursor: pointer;
    font-size: 16px;
    transition: background 0.15s, transform 0.15s;
    z-index: 2;
}
.ml-popup__close:hover {
    background: #e6ebf3;
    transform: rotate(90deg);
}

.ml-popup__header {
    text-align: center;
    margin-bottom: 36px;
}
.ml-popup__appicon {
    height: 56px;
    width: 56px;
    border-radius: 13px;
    margin-bottom: 16px;
    box-shadow: 0 6px 18px rgba(35, 42, 51, 0.18);
}
.ml-popup__title {
    font-size: 32px;
    font-weight: 700;
    color: var(--ml-ink);
    margin: 0 0 12px;
    letter-spacing: -0.015em;
    line-height: 1.15;
}
.ml-popup__subtitle {
    font-size: 17px;
    color: var(--ml-ink-soft);
    margin: 0;
    font-weight: 400;
}

/* fan-stack: side phones recede, center phone steps forward */
.ml-popup__phones {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 0;
    margin: 0 0 48px;
    padding: 0 8px;
}
.ml-popup__phone {
    flex: 0 0 29%;
    max-width: 29%;
    margin: 0;
    text-align: center;
    transition: transform 0.25s ease;
}
.ml-popup__phone img {
    width: 100%;
    height: auto;
    display: block;
    /* raw screenshots — fake a device frame with border + radius */
    border-radius: 24px;
    border: 6px solid #23262c;
    background: #23262c;
    box-shadow: 0 14px 26px rgba(35, 42, 51, 0.22);
}
.ml-popup__phone figcaption {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 5px;
    margin-top: 18px;
    padding: 0 4px;
    font-size: 12px;
    color: var(--ml-ink-2);
    font-weight: 500;
    line-height: 1.4;
    opacity: 0.55;
    transition: opacity 0.25s, font-size 0.25s, font-weight 0.25s;
}
.ml-popup__phone-icon {
    flex-shrink: 0;
    font-size: 13px;
    line-height: 1;
    color: var(--ml-ink-soft);
    transition: color 0.25s, font-size 0.25s;
}
.ml-popup__phone:nth-child(1) {
    /* left */
    transform: scale(0.86) translateY(8px);
    margin-right: -3%;
    z-index: 1;
}
.ml-popup__phone:nth-child(2) {
    /* center — hero (media backup) */
    transform: scale(1.08);
    z-index: 2;
    position: relative;
}
.ml-popup__phone:nth-child(2) figcaption {
    opacity: 1;
    font-size: 14px;
    font-weight: 600;
    color: var(--ml-ink);
}
.ml-popup__phone:nth-child(2) .ml-popup__phone-icon {
    font-size: 15px;
    color: var(--ml-accent); /* brand accent on the hero phone */
}
.ml-popup__phone:nth-child(3) {
    /* right */
    transform: scale(0.86) translateY(8px);
    margin-left: -3%;
    z-index: 1;
}

/* Free / Plus chips on phone captions */
.ml-popup__chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1.7;
    background: #e9edf3;
    color: #5b6674;
}
.ml-popup__chip--plus {
    background: linear-gradient(135deg, #ffb84d 0%, #f29111 100%);
    color: #fff;
    box-shadow: 0 2px 6px rgba(242, 145, 17, 0.35);
}

.ml-popup__stores {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 0 18px;
}
.ml-popup__store {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    background: var(--ml-ink);
    color: #fff;
    border-radius: 16px;
    text-decoration: none;
    transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background 0.18s,
        box-shadow 0.18s;
    box-shadow: 0 4px 12px rgba(35, 42, 51, 0.08);
}
.ml-popup__store:hover {
    transform: translateY(-3px);
    background: var(--ml-ink-2);
    color: #fff;
    box-shadow: 0 12px 28px rgba(35, 42, 51, 0.22);
}
.ml-popup__store-icon {
    font-size: 34px;
}
.ml-popup__store-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
    text-align: left;
}
.ml-popup__store-text small {
    font-size: 13px;
    opacity: 0.82;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 2px;
}
.ml-popup__store-text strong {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.ml-popup__store-qr {
    zoom: 1.25; /* cancel the card's 0.8 zoom — QR stays 130px for camera scan */
    width: 130px;
    height: 130px;
    background: #fff;
    border-radius: 8px;
    padding: 6px;
    image-rendering: pixelated; /* keep QR module edges crisp when downscaled — critical for camera scan */
    flex-shrink: 0;
}

/* App Store — not published yet: muted, non-interactive "coming soon" card */
.ml-popup__store--soon {
    background: var(--ml-soft);
    color: var(--ml-ink-soft);
    box-shadow: none;
    cursor: default;
}
.ml-popup__store--soon:hover {
    transform: none;
    background: var(--ml-soft);
    color: var(--ml-ink-soft);
    box-shadow: none;
}
.ml-popup__store-soon-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ml-ink-soft);
    border: 1px dashed #c4ccd6;
    border-radius: 8px;
    padding: 8px 12px;
    white-space: nowrap;
}

/* Free vs Plus one-liner under the store buttons */
.ml-popup__note {
    text-align: center;
    font-size: 13px;
    color: var(--ml-muted);
    margin: 0 0 14px;
}
.ml-popup__note strong {
    color: var(--ml-ink);
    font-weight: 600;
}

.ml-popup__footer {
    text-align: center;
    padding-top: 4px;
}
.ml-popup__dismiss-7d {
    background: transparent;
    border: 0;
    color: var(--ml-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 8px 16px;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: rgba(108, 117, 125, 0.35);
    transition: color 0.15s, text-decoration-color 0.15s;
}
.ml-popup__dismiss-7d:hover {
    color: var(--ml-ink);
    text-decoration-color: var(--ml-ink);
}

/* Progressive responsive scaling based on viewport height.
   Card heights are calibrated so each stage fits its own viewport without
   inner scroll, and Stage 3 is the floor — viewports smaller than that
   keep Stage 3 sizing and fall back to container scroll. */

/* NOTE: RcloneView screenshots are taller (h/w 2.17) than NetDrive's (1.92),
   so each stage uses a narrower phone column than the bdweb original.
   Thresholds assume the card's 0.8 zoom: the zoomed full-mode is ~920px
   tall, so each stage kicks in earlier than the unzoomed heights suggest. */

/* Stage 1 — vp ≤ 950 : zoomed full-mode (~920px) no longer fits, phone 26% */
@media (max-height: 950px) {
    .ml-popup__card {
        padding: 26px 36px 18px;
    }
    .ml-popup__header {
        margin-bottom: 20px;
    }
    .ml-popup__appicon {
        height: 46px;
        width: 46px;
        border-radius: 11px;
        margin-bottom: 10px;
    }
    .ml-popup__title {
        font-size: 26px;
        margin-bottom: 6px;
    }
    .ml-popup__subtitle {
        font-size: 15px;
    }
    .ml-popup__phones {
        margin-bottom: 26px;
    }
    .ml-popup__phone {
        flex: 0 0 23.5%;
        max-width: 23.5%;
    }
    .ml-popup__phone figcaption {
        margin-top: 12px;
        font-size: 11px;
        gap: 4px;
    }
    .ml-popup__phone:nth-child(2) figcaption {
        font-size: 13px;
    }
    .ml-popup__phone-icon {
        font-size: 12px;
    }
    .ml-popup__phone:nth-child(2) .ml-popup__phone-icon {
        font-size: 14px;
    }
    .ml-popup__stores {
        margin-bottom: 12px;
        gap: 14px;
    }
    .ml-popup__store {
        padding: 12px 18px;
        gap: 14px;
    }
    .ml-popup__store-icon {
        font-size: 30px;
    }
    .ml-popup__store-text strong {
        font-size: 18px;
    }
    .ml-popup__store-text small {
        font-size: 13px;
    }
    .ml-popup__note {
        font-size: 12px;
        margin-bottom: 10px;
    }
    .ml-popup__dismiss-7d {
        font-size: 12px;
        padding: 6px 14px;
    }
}

/* Stage 2 — vp ≤ 780 : phone 24% (zoomed stage-1 card is ~745px) */
@media (max-height: 780px) {
    .ml-popup__card {
        padding: 22px 32px 16px;
    }
    .ml-popup__header {
        margin-bottom: 16px;
    }
    .ml-popup__appicon {
        height: 40px;
        width: 40px;
        border-radius: 10px;
        margin-bottom: 8px;
    }
    .ml-popup__title {
        font-size: 24px;
        margin-bottom: 4px;
    }
    .ml-popup__subtitle {
        font-size: 14px;
    }
    .ml-popup__phones {
        margin-bottom: 20px;
    }
    .ml-popup__phone {
        flex: 0 0 21.5%;
        max-width: 21.5%;
    }
    .ml-popup__phone figcaption {
        margin-top: 10px;
        font-size: 11px;
    }
    .ml-popup__phone:nth-child(2) figcaption {
        font-size: 12px;
    }
    .ml-popup__phone-icon {
        font-size: 11px;
    }
    .ml-popup__phone:nth-child(2) .ml-popup__phone-icon {
        font-size: 13px;
    }
    .ml-popup__stores {
        margin-bottom: 10px;
        gap: 12px;
    }
    .ml-popup__store {
        padding: 10px 16px;
        gap: 12px;
    }
    .ml-popup__store-icon {
        font-size: 28px;
    }
    .ml-popup__store-text strong {
        font-size: 17px;
    }
    .ml-popup__store-text small {
        font-size: 12px;
    }
}

/* Stage 3 — vp ≤ 690 : phone 20% — this is the FLOOR (zoomed ~580px).
   Smaller viewports keep Stage 3 sizing and rely on .ml-popup container
   scrolling. 1366x768 laptops now land on Stage 2 and fit without scroll. */
@media (max-height: 690px) {
    .ml-popup__card {
        padding: 16px 28px 10px;
        border-radius: 18px;
    }
    .ml-popup__header {
        margin-bottom: 8px;
    }
    .ml-popup__appicon {
        height: 32px;
        width: 32px;
        border-radius: 8px;
        margin-bottom: 5px;
    }
    .ml-popup__title {
        font-size: 22px;
        margin-bottom: 2px;
    }
    .ml-popup__subtitle {
        font-size: 13px;
    }
    .ml-popup__phones {
        margin-bottom: 8px;
    }
    .ml-popup__phone {
        flex: 0 0 18%;
        max-width: 18%;
    }
    .ml-popup__phone img {
        border-radius: 18px;
        border-width: 4px;
    }
    .ml-popup__phone figcaption {
        margin-top: 8px;
        font-size: 10px;
        gap: 3px;
    }
    .ml-popup__phone:nth-child(2) figcaption {
        font-size: 11px;
    }
    .ml-popup__phone-icon {
        font-size: 10px;
    }
    .ml-popup__phone:nth-child(2) .ml-popup__phone-icon {
        font-size: 12px;
    }
    .ml-popup__stores {
        margin-bottom: 6px;
        gap: 10px;
    }
    .ml-popup__store {
        padding: 8px 14px;
        gap: 10px;
        border-radius: 12px;
    }
    .ml-popup__store-icon {
        font-size: 24px;
    }
    .ml-popup__store-text strong {
        font-size: 16px;
    }
    .ml-popup__store-text small {
        font-size: 11px;
    }
    .ml-popup__note {
        display: none; /* chips already carry the Free/Plus info — reclaim height */
    }
    .ml-popup__footer {
        padding-top: 0;
    }
    .ml-popup__dismiss-7d {
        font-size: 10px;
        padding: 2px 10px;
    }
}

/* Tablet & smaller — collapse to the hero phone + stacked stores, hide QR */
@media (max-width: 760px) {
    .ml-popup__card {
        zoom: 1; /* the 20% shrink is a desktop fix — keep mobile full-size */
        padding: 28px 22px 20px;
        border-radius: 18px;
    }
    .ml-popup__header {
        margin-bottom: 24px;
    }
    .ml-popup__appicon {
        height: 48px;
        width: 48px;
        border-radius: 11px;
        margin-bottom: 12px;
    }
    .ml-popup__title {
        font-size: 24px;
    }
    .ml-popup__subtitle {
        font-size: 15px;
    }
    .ml-popup__phones {
        display: block;
        max-width: 200px; /* keep the store buttons close to the fold */
        margin: 0 auto 24px;
        padding: 0;
    }
    .ml-popup__phone {
        flex: none;
        max-width: none;
        margin: 0 !important;
        transform: none !important;
    }
    .ml-popup__phone:not(:nth-child(2)) {
        display: none; /* show only the media-backup hero on mobile */
    }
    .ml-popup__phone figcaption {
        opacity: 1;
        font-size: 14px;
        font-weight: 600;
        color: var(--ml-ink);
        margin-top: 14px;
    }
    .ml-popup__phone-icon {
        font-size: 15px;
        color: var(--ml-accent);
    }
    .ml-popup__stores {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 16px;
    }
    .ml-popup__store-qr {
        display: none; /* tap the button directly */
    }
    .ml-popup__store {
        grid-template-columns: auto 1fr auto;
        padding: 16px 20px;
    }
    .ml-popup__store-icon {
        font-size: 28px;
    }
    .ml-popup__note {
        display: none; /* chips already carry the Free/Plus info */
    }
}
