/* ══════════════════════════════════════════════
   main-quest-celebration.css
   Phase 2.8 — Main Quest completion celebration.

   A compact, self-contained overlay for when a Main Quest
   transitions from incomplete to complete. Appears as a
   small glass card with the quest name, a gratitude
   message, and subtle sparkle particles.

   Design:
   - Overlay is a semi-transparent backdrop that covers
     the app, but the card itself is small and centered.
   - Uses existing design tokens (--gold, --gold-glow,
     --surface-deep, --border, --text-bright, --text-muted,
     --font, --radius-lg, --space-*, --z-effect).
   - z-index sits below the Daily Challenge and Achievement
     celebrations (255/260) but above normal modal layer (200).
   - Self-contained reduced-motion block.

   Created/destroyed programmatically by
   main-quest-celebration.js, mirroring the pattern of
   daily-challenge-celebration.css and
   achievement-unlock-celebration.css.
   ══════════════════════════════════════════════ */

/* ── Backdrop ── */
.mq-celebration-overlay {
    position: fixed;
    inset: 0;
    z-index: 254; /* just below achievement-unlock (255) */
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(7, 11, 18, 0.50);
    backdrop-filter: blur(4px);
    padding: var(--space-4);
    animation: mqOverlayIn 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
    pointer-events: none; /* allows clicks to pass through to the app */
}

.mq-celebration-overlay.mq-exit {
    animation: mqOverlayOut 0.2s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes mqOverlayIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes mqOverlayOut { from { opacity: 1; } to { opacity: 0; } }

/* ── Card shell ── */
.mq-card {
    position: relative;
    width: 100%;
    max-width: 320px;
    padding: var(--space-5) var(--space-5) var(--space-4);
    background: var(--surface-deep);
    border: 1.5px solid var(--gold);
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.55),
        0 0 30px color-mix(in srgb, var(--gold) 25%, transparent);
    animation: mqCardIn 0.38s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
    pointer-events: auto; /* but overlay has pointer-events:none, so clicks on card are ignored */
    /* The overlay itself is pointer-events:none, so the card is effectively non-interactive.
       That's fine; the celebration auto-dismisses after a short duration. */
}

/* Impact bounce: start small, overshoot slightly, settle */
@keyframes mqCardIn {
    0%   { opacity: 0; transform: scale(0.88) translateY(6px); }
    60%  { opacity: 1; transform: scale(1.05) translateY(0); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* ── Sparkles (particles) ── */
.mq-sparkles {
    position: absolute;
    inset: -20px;
    pointer-events: none;
    overflow: visible;
}

.mq-sparkle {
    position: absolute;
    width: 10px;
    height: 10px;
    color: var(--gold-glow);
    opacity: 0;
    animation: mqSparkleFloat 1.2s ease-out var(--mq-sparkle-delay, 0s) forwards;
}

.mq-sparkle::before {
    content: '✦';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(240, 200, 96, 0.7));
}

@keyframes mqSparkleFloat {
    0%   { opacity: 0; transform: translate(0, 0) scale(0.4) rotate(0deg); }
    35%  { opacity: 1; transform: translate(var(--mq-tx, 0px), var(--mq-ty, -20px)) scale(1.1) rotate(30deg); }
    100% { opacity: 0; transform: translate(var(--mq-tx, 0px), var(--mq-ty, -40px)) scale(0.7) rotate(60deg); }
}

/* ── Content ── */
.mq-icon {
    font-size: 2.2rem;
    line-height: 1;
    margin-bottom: var(--space-2);
    animation: mqPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) 0.05s both;
}

@keyframes mqPop {
    0%   { opacity: 0; transform: scale(0.6); }
    70%  { transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

.mq-title {
    font-family: 'Oswald', var(--font), sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: linear-gradient(180deg, #fff5d6 0%, #f0c860 40%, #e2b04a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: var(--space-1);
    animation: mqTextIn 0.3s ease-out 0.15s both;
}

.mq-message {
    font-size: var(--text-base);
    color: var(--text-muted);
    line-height: 1.4;
    animation: mqTextIn 0.3s ease-out 0.25s both;
}

.mq-message strong {
    color: var(--gold);
    font-weight: 700;
}

@keyframes mqTextIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    .mq-celebration-overlay,
    .mq-celebration-overlay.mq-exit {
        animation: none;
        opacity: 1;
    }
    .mq-celebration-overlay.mq-exit { opacity: 0; }

    .mq-card {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .mq-icon {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .mq-title,
    .mq-message {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .mq-sparkle {
        display: none;
    }
}