/* ============================================================
   Card Spotlight — Global feature
   Uses the "box-shadow infinite spread" trick to darken the
   rest of the page while keeping the targeted card bright.

   Technique: an outer box-shadow with 9999px spread acts as a
   page-wide dim layer that follows the card naturally. No
   overlay div, no DOM cloning — works on every browser
   including iOS Safari.

   Accompanies: /Scripts/card-spotlight.js
   ============================================================ */

/* Lock scroll so the card stays in view while spotlight is active */
body.spotlight-active {
    overflow: hidden;
}

/* ----- Spotlight target -----
   Three stacked box-shadows:
     1. Solid orange ring (3px)         — clear delineation
     2. Orange outer glow (60px blur)   — premium feel
     3. Huge dim shadow (9999px spread) — darkens the rest of
        the viewport. This is the magic — it scales to any
        screen size and follows the card if anything moves.
   The card itself sits at z-index 100 so it visually rises
   above sibling cards in the same row.
*/
.spotlight-target {
    position: relative !important;
    z-index: 100 !important;
    box-shadow:
        0 0 0 3px rgba(255, 83, 0, 0.65),
        0 0 60px rgba(255, 83, 0, 0.35),
        0 0 0 9999px rgba(0, 0, 0, 0.6) !important;
    border-color: var(--primary-color-1, #ff5300) !important;
    animation: spotlight-glow-in 0.35s ease;
}

@keyframes spotlight-glow-in {
    from {
        box-shadow:
            0 0 0 0 rgba(255, 83, 0, 0),
            0 0 0 rgba(255, 83, 0, 0),
            0 0 0 0 rgba(0, 0, 0, 0);
    }
    to {
        box-shadow:
            0 0 0 3px rgba(255, 83, 0, 0.65),
            0 0 60px rgba(255, 83, 0, 0.35),
            0 0 0 9999px rgba(0, 0, 0, 0.6);
    }
}

/* ----- Floating close button ----- */
.spotlight-close-btn {
    display: none;
    position: fixed;
    top: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Sit above the spotlight target (which has z-index 100 and a
       9999px box-shadow rendered at the same layer) */
    z-index: 10000;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    -webkit-backdrop-filter: blur(10px);
            backdrop-filter: blur(10px);
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

body.spotlight-active .spotlight-close-btn {
    display: flex;
    animation: spotlight-fade-in 0.4s ease 0.15s backwards;
}

.spotlight-close-btn:hover {
    background: rgba(255, 83, 0, 0.85);
    border-color: rgba(255, 83, 0, 0.95);
    transform: rotate(90deg);
}

@keyframes spotlight-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* ----- Mobile responsive ----- */
@media (max-width: 768px) {
    .spotlight-target {
        /* Slightly reduced spread on mobile (still covers viewport) */
        box-shadow:
            0 0 0 2px rgba(255, 83, 0, 0.65),
            0 0 40px rgba(255, 83, 0, 0.3),
            0 0 0 4000px rgba(0, 0, 0, 0.6) !important;
    }
    .spotlight-close-btn {
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
}

/* ----- Reduced-motion accessibility ----- */
@media (prefers-reduced-motion: reduce) {
    .spotlight-target,
    .spotlight-close-btn {
        animation: none !important;
        transition: none !important;
    }
}
