/* ==========================================================================
   APP DOWNLOAD MODAL — shown on index.php (guest feed) page load.
   Play Store button leaves for the store listing; the ✕ / backdrop / Esc /
   "Remind me later" all snooze it for 15 minutes, after which the in-page
   timer re-opens it (see assets/app-download-modal.js).

   inset:0 — NOT width/height:100v* — so the overlay covers the whole screen
   under the global body{zoom:.9} in styles.css: viewport units are not
   compensated by zoom and would leave a 10% dead band on the right/bottom.
   ========================================================================== */
#appDownloadModal {
    position: fixed;
    inset: 0;
    /* above .modal-overlay (2100) and the fixed bottom-nav (2000) */
    z-index: 2300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overscroll-behavior: contain;
}

/* [hidden] alone loses to the display:flex above — restate it. */
#appDownloadModal[hidden] {
    display: none;
}

#appDownloadModal.visible {
    opacity: 1;
    pointer-events: auto;
}

.appdl-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 3, 10, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.appdl-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 360px;
    background: var(--bg-surface, #120c24);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: 20px;
    padding: 30px 24px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-premium, 0 20px 40px -15px rgba(0, 0, 0, 0.5));
    transform: translateY(16px) scale(0.97);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#appDownloadModal.visible .appdl-card {
    transform: translateY(0) scale(1);
}

/* Focused programmatically on open purely to move the reading cursor in. */
.appdl-card:focus {
    outline: none;
}

.appdl-close {
    position: absolute;
    top: 10px;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    font-size: 1.15rem;
    line-height: 1;
    padding: 6px;
    cursor: pointer;
    transition: color 0.2s;
}

.appdl-close:hover {
    color: var(--accent-pink, #ff2a74);
}

.appdl-icon {
    position: relative;
    width: 68px;
    height: 68px;
    border-radius: 18px;
    object-fit: cover;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
}

.appdl-title {
    position: relative;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary, #f8fafc);
    line-height: 1.3;
}

.appdl-sub {
    position: relative;
    font-size: 0.875rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
    margin: 0;
}

/* Google Play lockup — a real <a> so it still works with JS disabled. */
.appdl-play {
    position: relative;
    width: 100%;
    margin-top: 4px;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 12px;
    padding: 11px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
}

.appdl-play:hover {
    opacity: 0.88;
}

.appdl-play:active {
    transform: scale(0.97);
}

.appdl-play svg {
    width: 26px;
    height: 26px;
    display: block;
    flex-shrink: 0;
}

.appdl-play-txt {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.15;
}

.appdl-play-txt small {
    font-size: 0.56rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
}

.appdl-play-txt b {
    font-size: 1rem;
    font-weight: 600;
}

.appdl-later {
    position: relative;
    background: transparent;
    border: none;
    color: var(--text-muted, #64748b);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 6px 10px;
    cursor: pointer;
    transition: color 0.2s;
}

.appdl-later:hover {
    color: var(--text-primary, #f8fafc);
}

@media (max-width: 480px) {
    .appdl-card {
        padding: 26px 18px 20px;
        gap: 12px;
    }

    .appdl-icon {
        width: 58px;
        height: 58px;
    }

    .appdl-title {
        font-size: 1.05rem;
    }

    .appdl-sub {
        font-size: 0.82rem;
    }
}

@media (prefers-reduced-motion: reduce) {

    #appDownloadModal,
    .appdl-card {
        transition: none;
    }
}
