/* =====================================================
   DV HANDBOOK — BOLD DYNAMIC LAYER (dynamic.css)
   Site-wide flashy effects: particle network, aurora blobs,
   cursor glow, scroll progress, ripples, card spotlight, glitch.
   Loaded on every page after style.css / futuristic.css.
   ===================================================== */

/* --- Scroll progress bar ------------------------------------------ */
#dv-scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #06b6d4, #ec4899);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.7);
    z-index: 2001;
    transition: width 0.12s linear;
    pointer-events: none;
}

/* --- Particle network canvas -------------------------------------- */
#dv-particles {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.55;
}

/* --- Aurora gradient blobs ------------------------------------------ */
.aurora-layer {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}
.aurora-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    opacity: 0.32;
    will-change: transform;
}
.aurora-blob.b1 { width: 460px; height: 460px; top: -140px; left: -120px; background: #6366f1; animation: dvAurora1 24s ease-in-out infinite; }
.aurora-blob.b2 { width: 400px; height: 400px; bottom: -160px; right: -100px; background: #06b6d4; animation: dvAurora2 28s ease-in-out infinite; }
.aurora-blob.b3 { width: 320px; height: 320px; top: 45%; right: 8%; background: #ec4899; opacity: 0.2; animation: dvAurora3 32s ease-in-out infinite; }

@keyframes dvAurora1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(90px, 70px) scale(1.12); } }
@keyframes dvAurora2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-70px, -50px) scale(1.08); } }
@keyframes dvAurora3 { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-40px, 60px); } }

/* --- Cursor glow trail (desktop only) ------------------------------ */
.cursor-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.20), rgba(6, 182, 212, 0.10) 45%, transparent 72%);
    pointer-events: none;
    z-index: 3;
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity 0.3s ease;
    will-change: transform;
}

@media (max-width: 900px) {
    .cursor-glow { display: none !important; }
}

/* --- Button ripple -------------------------------------------------- */
.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    transform: scale(0);
    opacity: 1;
    pointer-events: none;
    animation: dvRipple 0.65s ease-out forwards;
}
@keyframes dvRipple {
    to { transform: scale(2.6); opacity: 0; }
}

/* --- Card spotlight (mouse-follow glow) ----------------------------- */
.card-spotlight {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    z-index: 5;
    transition: opacity 0.35s ease;
    background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), rgba(99, 102, 241, 0.16), transparent 65%);
    mix-blend-mode: screen;
}
.topic-card:hover .card-spotlight,
.feature-card:hover .card-spotlight,
.step-card:hover .card-spotlight { opacity: 1; }

/* --- Typing caret while revealing page headers ---------------------- */
.typing-caret::after {
    content: '';
    display: inline-block;
    width: 3px;
    height: 0.85em;
    margin-left: 4px;
    background: #06b6d4;
    vertical-align: -0.1em;
    animation: dvCaretBlink 0.85s step-end infinite;
}
@keyframes dvCaretBlink { 50% { opacity: 0; } }

/* --- Glitch hover on the site logo ----------------------------------- */
.nav-logo:hover span {
    animation: dvGlitch 0.45s steps(2) both;
}
@keyframes dvGlitch {
    0%   { text-shadow: 2px 0 #ec4899, -2px 0 #06b6d4; transform: translate(0); }
    30%  { text-shadow: -2px 0 #ec4899, 2px 0 #06b6d4; transform: translate(-1px, 1px); }
    60%  { text-shadow: 2px 0 #ec4899, -2px 0 #06b6d4; transform: translate(1px, -1px); }
    100% { text-shadow: none; transform: translate(0); }
}

@media (prefers-reduced-motion: reduce) {
    #dv-particles, .cursor-glow, .aurora-blob { display: none !important; animation: none !important; }
}

/* --- Announcement flashcard toast ------------------------------------ */
.dv-announcement {
    position: fixed;
    left: 1.25rem;
    bottom: 1.25rem;
    z-index: 2500;
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    max-width: 380px;
    padding: 1.1rem 1.2rem;
    background: rgba(17, 20, 29, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 25px 60px -18px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(99, 102, 241, 0.12);
    backdrop-filter: blur(10px);
    transform: translateY(24px) scale(0.96);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.4s ease;
}
.dv-announcement.show { transform: translateY(0) scale(1); opacity: 1; pointer-events: auto; }
.dv-announcement.hide { transform: translateY(16px) scale(0.97); opacity: 0; }
.dv-announcement-icon { font-size: 1.6rem; line-height: 1; }
.dv-announcement-body strong { display: block; color: var(--text-primary); font-size: 0.95rem; margin-bottom: 0.3rem; }
.dv-announcement-body p { color: var(--text-secondary); font-size: 0.83rem; margin: 0 0 0.8rem; line-height: 1.45; }
.dv-announcement-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.dv-announcement-actions .btn { font-size: 0.75rem; padding: 0.5rem 0.85rem !important; }
.dv-announcement-close {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.2rem;
    line-height: 1;
}
.dv-announcement-close:hover { color: var(--text-primary); }

@media (max-width: 520px) {
    .dv-announcement { left: 0.7rem; right: 0.7rem; bottom: 0.7rem; max-width: none; }
}

/* --- Subscribe modal ---------------------------------------------------- */
.dv-subscribe-overlay {
    position: fixed;
    inset: 0;
    z-index: 3100;
    background: rgba(5, 6, 12, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}
.dv-subscribe-overlay.open { display: flex; }
.dv-subscribe-modal {
    position: relative;
    width: 100%;
    max-width: 420px;
    background: #11141d;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 1.8rem 1.7rem;
    box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
    animation: dvSubscribeIn 0.25s ease;
}
@keyframes dvSubscribeIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.dv-subscribe-modal h3 { margin: 0 0 0.6rem; font-size: 1.15rem; color: var(--text-primary); }
.dv-subscribe-modal p { color: var(--text-secondary); font-size: 0.85rem; line-height: 1.5; margin: 0 0 1.1rem; }
.dv-subscribe-modal label { display: block; font-size: 0.78rem; color: var(--text-muted); margin: 0.7rem 0 0.3rem; }
.dv-subscribe-modal input[type="text"],
.dv-subscribe-modal input[type="email"] {
    width: 100%;
    padding: 0.65rem 0.8rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
}
.dv-subscribe-modal input:focus { outline: none; border-color: #6366f1; background: rgba(255, 255, 255, 0.07); }
.dv-subscribe-modal .btn { margin-top: 1.1rem; width: 100%; }
.dv-subscribe-modal .dv-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.dv-subscribe-close {
    position: absolute;
    top: 0.85rem;
    right: 0.85rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    cursor: pointer;
}
.dv-subscribe-close:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.dv-subscribe-status { font-size: 0.82rem; margin: 0.7rem 0 0 !important; min-height: 1.1em; }
.dv-subscribe-status.success { color: #4ade80; }
.dv-subscribe-status.error { color: #f87171; }
