/* ============================================================
   KodePilot — Micro-Animations & Transitions  (animations.css)
   Loaded after design-system.css. Adds:
     • new keyframes (shake, pulse-ring)
     • .fade-in-up / .hover-lift / .hover-scale utility classes
     • .stagger-parent / .stagger-item generic stagger utility
     • hero section page-load entry animations
     • global form input focus & validation shake
     • practice-card hover lift (gap in design-system)
     • WhatsApp FAB spring-scale
     • chatbot suggestion chip stagger on panel open
     • prefers-reduced-motion safety net
   ============================================================ */

/* ── 1. KEYFRAMES ─────────────────────────────────────────────── */

/* Field-level form validation shake */
@keyframes kp-shake {
    0%, 100% { transform: translateX(0);    }
    15%       { transform: translateX(-7px); }
    30%       { transform: translateX( 6px); }
    45%       { transform: translateX(-5px); }
    60%       { transform: translateX( 4px); }
    75%       { transform: translateX(-2px); }
    90%       { transform: translateX( 1px); }
}

/* Pulsing ring — used by WhatsApp FAB attention effect */
@keyframes kp-pulse-ring {
    0%   { transform: scale(1);    opacity: 0.55; }
    100% { transform: scale(1.65); opacity: 0;    }
}

/* ── 2. SCROLL-REVEAL UTILITY ─────────────────────────────────── */

/*
 * .fade-in-up + .is-visible
 * Hand-apply to individual elements in HTML; JS (design-system.js)
 * observes them and adds .is-visible when they scroll into view.
 */
.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    transition:
        opacity   0.55s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.fade-in-up.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── 3. HOVER UTILITY CLASSES ─────────────────────────────────── */

/*
 * .hover-lift — card lift with brand glow
 * Add to any card-like surface for a consistent lift interaction.
 */
.hover-lift {
    transition:
        transform  0.28s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.28s ease !important;
}

.hover-lift:hover {
    transform:  translateY(-4px) !important;
    box-shadow: var(--shadow-soft),
                0 8px 32px rgba(var(--brand-primary-rgb, 69, 170, 242), 0.12) !important;
}

/*
 * .hover-scale — subtle scale on hover
 * Use on buttons, icons, chips.
 */
.hover-scale {
    transition: transform 0.2s ease !important;
}

.hover-scale:hover {
    transform: scale(1.04) !important;
}

/* ── 4. STAGGER UTILITY ───────────────────────────────────────── */

/*
 * .stagger-parent > .stagger-item
 * JS observes .stagger-parent; when it enters view, adds
 * .is-visible — the children transition in with delays.
 *
 * Complements .kp-stagger / .kp-reveal from design-system.css
 * for ad-hoc use in custom page sections.
 */
.stagger-parent > .stagger-item {
    opacity: 0;
    transform: translateY(18px);
    transition:
        opacity   0.5s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.stagger-parent.is-visible > .stagger-item           { opacity: 1; transform: translateY(0); }
.stagger-parent.is-visible > .stagger-item:nth-child(1) { transition-delay:   0ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(2) { transition-delay:  65ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(3) { transition-delay: 130ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(4) { transition-delay: 195ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(5) { transition-delay: 260ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(6) { transition-delay: 325ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(7) { transition-delay: 390ms; }
.stagger-parent.is-visible > .stagger-item:nth-child(8) { transition-delay: 455ms; }

/* ── 5. EXTENDED .kp-stagger DELAY RANGE ─────────────────────── */

/*
 * design-system.css defines delays up to :nth-child(6).
 * Extend for grids with more items.
 */
.kp-stagger > .kp-reveal:nth-child(7)  { transition-delay: 480ms; }
.kp-stagger > .kp-reveal:nth-child(8)  { transition-delay: 560ms; }
.kp-stagger > .kp-reveal:nth-child(9)  { transition-delay: 640ms; }
.kp-stagger > .kp-reveal:nth-child(10) { transition-delay: 720ms; }
.kp-stagger > .kp-reveal:nth-child(11) { transition-delay: 800ms; }
.kp-stagger > .kp-reveal:nth-child(12) { transition-delay: 880ms; }

/* ── 6. HERO SECTION — PAGE-LOAD ENTRY ANIMATIONS ────────────── */

/*
 * Children of .hero animate in on page load (not scroll-triggered).
 * Uses animation-fill-mode: both so elements hold the from-state
 * before the delay fires, avoiding a FOUC flash.
 *
 * kp-reveal-up keyframe is defined in design-system.css:
 *   from { opacity:0; transform:translateY(24px) }
 *   to   { opacity:1; transform:translateY(0)    }
 */
.hero .cards_box h1 {
    animation: kp-reveal-up 0.65s cubic-bezier(0.4, 0, 0.2, 1) 0.05s both;
}

.hero .cards_box p {
    animation: kp-reveal-up 0.55s cubic-bezier(0.4, 0, 0.2, 1) 0.18s both;
}

.hero .cards_box .button_blue_box {
    animation: kp-reveal-up 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.28s both;
}

.hero .cards {
    animation: kp-reveal-up 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.2s both;
}

/* ── 7. GLOBAL FORM INPUT FOCUS ───────────────────────────────── */

/*
 * Extends the focus ring from .container-quizz scope (design-system)
 * to ALL form inputs site-wide. Lower specificity than per-page
 * inline styles — safe to add globally.
 *
 * Excludes .search bar (has its own focus style in design-system.css).
 */
input[type="text"]:not(.search),
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="password"],
input[type="url"],
textarea,
select {
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

input[type="text"]:not(.search):focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
textarea:focus,
select:focus {
    border-color: var(--color-primary, #45AAF2) !important;
    box-shadow:   0 0 0 3px var(--color-primary-dim, rgba(69, 170, 242, 0.15)) !important;
    outline: none !important;
}

/* ── 8. FORM VALIDATION SHAKE ─────────────────────────────────── */

/*
 * Applied when JS adds .has-error to a .field wrapper.
 * Only the input inside shakes — not the label or error text.
 */
.field.has-error input,
.field.has-error select,
.field.has-error textarea {
    animation: kp-shake 0.45s ease;
}

/* ── 9. PRACTICE CARDS — HOVER LIFT ───────────────────────────── */

/*
 * design-system.css styles .practice-card background/border but
 * has no transform hover. Adding it here completes the interaction.
 */
.practice-card {
    transition:
        transform    0.28s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow   0.28s ease,
        border-color 0.28s ease !important;
}

.practice-card:hover {
    transform:    translateY(-5px) !important;
    border-color: rgba(var(--brand-primary-rgb, 69, 170, 242), 0.28) !important;
    box-shadow:   var(--shadow-soft),
                  0 8px 32px rgba(var(--brand-primary-rgb, 69, 170, 242), 0.10) !important;
}

/* ── 10. WHATSAPP FAB — SPRING SCALE ─────────────────────────── */

/*
 * Spring-scale hover + WhatsApp-green glow.
 * cubic-bezier(0.34, 1.56, 0.64, 1) = spring overshoot.
 */
.whatsapp-btn {
    transition:
        transform  0.28s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.28s ease !important;
}

.whatsapp-btn:hover {
    transform:  scale(1.14) translateY(-2px) !important;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.40) !important;
}

/* Pulse ring around WhatsApp button (purely decorative) */
.whatsapp-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid rgba(37, 211, 102, 0.45);
    opacity: 0;
    pointer-events: none;
}

.whatsapp-btn:hover::before {
    animation: kp-pulse-ring 0.7s cubic-bezier(0, 0, 0.2, 1) forwards;
}

/* ── 11. CHATBOT SUGGESTION CHIP STAGGER ──────────────────────── */

/*
 * Chips start invisible; CSS transitions run when
 * .chatbot-window gets .open (re-triggers on every open).
 * The transition-delay values stagger each chip.
 *
 * We extend the existing transition in chatbot.css — adding
 * opacity and transform to the list. The !important ensures
 * the multi-property list wins over the simpler declaration.
 */
.chatbot-suggestion-btn {
    opacity: 0;
    transform: translateY(8px);
    transition:
        opacity      0.25s ease,
        transform    0.28s cubic-bezier(0.4, 0, 0.2, 1),
        background   0.18s ease,
        border-color 0.18s ease,
        color        0.18s ease !important;
}

.chatbot-window.open .chatbot-suggestion-btn {
    opacity:   1;
    transform: translateY(0);
}

.chatbot-window.open .chatbot-suggestion-btn:nth-child(1) { transition-delay:  90ms; }
.chatbot-window.open .chatbot-suggestion-btn:nth-child(2) { transition-delay: 150ms; }
.chatbot-window.open .chatbot-suggestion-btn:nth-child(3) { transition-delay: 210ms; }
.chatbot-window.open .chatbot-suggestion-btn:nth-child(4) { transition-delay: 270ms; }
.chatbot-window.open .chatbot-suggestion-btn:nth-child(5) { transition-delay: 330ms; }

/* ── 12. BUTTON HOVER SCALE (supplement design-system) ─────────── */

/*
 * Ensures all .apply-btn and other CTA variants get the 1.03 scale
 * mentioned in the spec in addition to their existing translateY.
 */
.apply-btn:hover {
    transform: translateY(-2px) scale(1.02) !important;
}

/* ── 13. STAT ITEMS — HOVER LIFT ─────────────────────────────── */
.stat-item {
    transition:
        transform    0.28s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow   0.28s ease,
        border-color 0.28s ease !important;
}

.stat-item:hover {
    transform:    translateY(-3px) !important;
    border-color: rgba(var(--brand-primary-rgb, 69, 170, 242), 0.22) !important;
    box-shadow:   var(--shadow-soft),
                  0 6px 24px rgba(var(--brand-primary-rgb, 69, 170, 242), 0.10) !important;
}

/* ── 14. ACCENTURE-INSPIRED SCROLL REVEALS ────────────────────── */

/* Dramatic 60px lift — hero-scale reveals */
@keyframes kp-accenture-up {
    from { opacity: 0; transform: translateY(60px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes kp-slide-in-left {
    from { opacity: 0; transform: translateX(-48px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes kp-slide-in-right {
    from { opacity: 0; transform: translateX(48px); }
    to   { opacity: 1; transform: translateX(0); }
}

@keyframes kp-scale-reveal {
    from { opacity: 0; transform: scale(0.90); }
    to   { opacity: 1; transform: scale(1); }
}

@keyframes kp-line-draw {
    from { width: 0; opacity: 0; }
    to   { width: 64px; opacity: 1; }
}

/* Dramatic reveal — 60px translateY, slow spring easing */
.kp-reveal-xl {
    opacity: 0;
    transform: translateY(60px);
    transition:
        opacity   0.9s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

.kp-reveal-xl.kp-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Directional reveals */
.kp-reveal-left {
    opacity: 0;
    transform: translateX(-48px);
    transition:
        opacity   0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.kp-reveal-left.kp-visible  { opacity: 1; transform: translateX(0); }

.kp-reveal-right {
    opacity: 0;
    transform: translateX(48px);
    transition:
        opacity   0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.kp-reveal-right.kp-visible { opacity: 1; transform: translateX(0); }

/* Scale reveal */
.kp-reveal-scale {
    opacity: 0;
    transform: scale(0.90);
    transition:
        opacity   0.75s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.75s cubic-bezier(0.16, 1, 0.3, 1);
}
.kp-reveal-scale.kp-visible { opacity: 1; transform: scale(1); }

/* Stagger delay helpers for .kp-reveal-xl / .kp-reveal-left / .kp-reveal-right */
.kp-delay-1 { transition-delay:  80ms !important; }
.kp-delay-2 { transition-delay: 160ms !important; }
.kp-delay-3 { transition-delay: 240ms !important; }
.kp-delay-4 { transition-delay: 320ms !important; }
.kp-delay-5 { transition-delay: 400ms !important; }
.kp-delay-6 { transition-delay: 480ms !important; }

/* ── Word-by-word heading reveal ─────────────────────────────── */
.kp-words-wrap {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
}

.kp-word {
    display: inline-block;
    opacity: 0;
    transform: translateY(110%);
    transition:
        opacity   0.65s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Words animate in when JS adds .kp-words-active to the heading */
.kp-words-active .kp-word {
    opacity: 1;
    transform: translateY(0);
}

/* ── Accent underline that draws in on scroll ─────────────────── */
.kp-accent-heading {
    position: relative;
    padding-bottom: 16px;
}

.kp-accent-heading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 2px;
    transition: width 0.75s cubic-bezier(0.16, 1, 0.3, 1) 0.2s;
}

.kp-accent-heading.kp-visible::after {
    width: 72px;
}

/* ── Left-border card accent (Accenture slide-in style) ──────── */
.kp-card-border {
    position: relative;
    overflow: hidden;
}

.kp-card-border::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 3px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        var(--color-primary),
        var(--color-accent)
    );
    transform: scaleY(0);
    transform-origin: top center;
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 0 2px 2px 0;
}

.kp-card-border:hover::before {
    transform: scaleY(1);
}

/* ── Counter elements ────────────────────────────────────────── */
[data-counter] {
    display: inline-block;
    transition:
        opacity   0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Section divider — thin colored bar drawn on scroll ────────  */
.kp-divider-line {
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.16, 1, 0.3, 1);
}

.kp-divider-line.kp-visible {
    width: 100%;
}

/* ── PREFERS-REDUCED-MOTION SAFETY NET ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
    /* Utility classes — snap to final state immediately */
    .fade-in-up,
    .kp-reveal-xl,
    .kp-reveal-left,
    .kp-reveal-right,
    .kp-reveal-scale {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .kp-word {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .kp-accent-heading::after {
        width: 72px !important;
        transition: none !important;
    }

    .kp-card-border::before {
        transform: scaleY(1) !important;
        transition: none !important;
    }

    .kp-divider-line {
        width: 100% !important;
        transition: none !important;
    }

    .stagger-parent > .stagger-item {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
        animation: none !important;
    }

    /* Hero entry animations */
    .hero .cards_box h1,
    .hero .cards_box p,
    .hero .cards_box .button_blue_box,
    .hero .cards {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    /* Form shake */
    .field.has-error input,
    .field.has-error select,
    .field.has-error textarea {
        animation: none !important;
    }

    /* Practice card hover */
    .practice-card:hover,
    .hover-lift:hover,
    .hover-scale:hover,
    .whatsapp-btn:hover,
    .stat-item:hover,
    .apply-btn:hover {
        transform: none !important;
    }

    .whatsapp-btn:hover::before {
        animation: none !important;
    }

    /* Chatbot chips — show immediately, no stagger */
    .chatbot-suggestion-btn {
        opacity: 1 !important;
        transform: none !important;
        transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease !important;
    }

    .chatbot-window.open .chatbot-suggestion-btn {
        transition-delay: 0ms !important;
    }
}

/* ══════════════════════════════════════════════════════════════
   15. GLOBAL ANIMATED BACKGROUND CANVAS
   Fixed layer behind all content. CSS-only, GPU-accelerated.
   Light: soft blobs, orbit rings, dotted grid, circuit lines,
          neural dots, floating orbs.
   Dark:  neon blobs, glowing orbs, animated grid, particles,
          orbit rings with glow, neural dot network, light trails.
   ══════════════════════════════════════════════════════════════ */

/* ─ Blob drift keyframes ──────────────────────────────────────── */
@keyframes kp-bg-drift-a {
    0%   { transform: translate(0,0) scale(1); }
    25%  { transform: translate(-4%,6%) scale(1.04); }
    50%  { transform: translate(6%,3%) scale(0.97); }
    75%  { transform: translate(2%,-5%) scale(1.02); }
    100% { transform: translate(0,0) scale(1); }
}
@keyframes kp-bg-drift-b {
    0%   { transform: translate(0,0) scale(1); }
    33%  { transform: translate(5%,-4%) scale(1.05); }
    66%  { transform: translate(-3%,5%) scale(0.96); }
    100% { transform: translate(0,0) scale(1); }
}
@keyframes kp-bg-drift-c {
    0%   { transform: translate(0,0) scale(1); }
    20%  { transform: translate(-6%,3%) scale(1.08); }
    40%  { transform: translate(4%,6%) scale(0.94); }
    60%  { transform: translate(7%,-2%) scale(1.03); }
    80%  { transform: translate(-2%,-5%) scale(1.06); }
    100% { transform: translate(0,0) scale(1); }
}
@keyframes kp-bg-drift-d {
    0%   { transform: translate(0,0) scale(1); }
    30%  { transform: translate(8%,4%) scale(0.92); }
    60%  { transform: translate(-5%,8%) scale(1.10); }
    100% { transform: translate(0,0) scale(1); }
}

/* ─ Orb pulse ────────────────────────────────────────────────── */
@keyframes kp-bg-orb-pulse {
    0%   { transform: scale(1);    opacity: 1; }
    50%  { transform: scale(1.35); opacity: 0.55; }
    100% { transform: scale(1);    opacity: 1; }
}

/* ─ Particle rise (dark mode) ────────────────────────────────── */
@keyframes kp-bg-particle-rise {
    0%   { transform: translateY(0) translateX(0) scale(1);         opacity: 0; }
    12%  { opacity: 1; }
    88%  { opacity: 0.7; }
    100% { transform: translateY(-75vh) translateX(12px) scale(0.4); opacity: 0; }
}

/* ─ Wave sweep ───────────────────────────────────────────────── */
@keyframes kp-bg-wave-sweep {
    0%   { transform: translateX(-110%) skewX(-18deg); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 0.7; }
    100% { transform: translateX(210%) skewX(-18deg);  opacity: 0; }
}

/* ─ Grid shimmer ──────────────────────────────────────────────── */
@keyframes kp-bg-grid-pulse {
    0%, 100% { opacity: 0.07; }
    50%       { opacity: 0.16; }
}

/* ─ Orbit ring spin ───────────────────────────────────────────── */
@keyframes kp-bg-orbit-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}
@keyframes kp-bg-orbit-spin-rev {
    from { transform: rotate(0deg); }
    to   { transform: rotate(-360deg); }
}

/* ─ Neural dot pulse ──────────────────────────────────────────── */
@keyframes kp-bg-nd-pulse {
    0%, 100% { transform: scale(1);    opacity: 0.4; }
    50%       { transform: scale(1.9); opacity: 1; }
}

/* ─ Circuit trace glow ────────────────────────────────────────── */
@keyframes kp-bg-circuit-glow {
    0%, 100% { opacity: 0.12; }
    50%       { opacity: 0.42; }
}

/* ─ Dot grid breathe ──────────────────────────────────────────── */
@keyframes kp-bg-dotgrid-breathe {
    0%, 100% { opacity: 0.40; }
    50%       { opacity: 0.80; }
}

/* ══════════════════════════════════════════════════════════════
   Canvas container
   ══════════════════════════════════════════════════════════════ */
#kp-bg-canvas {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════
   Blobs
   ══════════════════════════════════════════════════════════════ */
.kp-bg-blob {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}
.kp-bg-blob-a {
    width:  clamp(420px, 56vw, 820px);
    height: clamp(420px, 56vw, 820px);
    top: -12%; right: -8%;
    animation: kp-bg-drift-a 32s ease-in-out infinite;
}
.kp-bg-blob-b {
    width:  clamp(300px, 40vw, 600px);
    height: clamp(300px, 40vw, 600px);
    bottom: 3%; left: -7%;
    animation: kp-bg-drift-b 26s ease-in-out infinite;
}
.kp-bg-blob-c {
    width:  clamp(210px, 28vw, 440px);
    height: clamp(210px, 28vw, 440px);
    top: 42%; left: 38%;
    animation: kp-bg-drift-c 22s ease-in-out infinite;
}
.kp-bg-blob-d {
    width:  clamp(150px, 19vw, 310px);
    height: clamp(150px, 19vw, 310px);
    top: 16%; left: 7%;
    animation: kp-bg-drift-d 38s ease-in-out infinite;
}

/* ══════════════════════════════════════════════════════════════
   Glowing orbs
   ══════════════════════════════════════════════════════════════ */
.kp-bg-orb {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
}
.kp-bg-orb-1 {
    width: 170px; height: 170px;
    top: 30%; right: 20%;
    animation: kp-bg-orb-pulse 9s ease-in-out infinite;
}
.kp-bg-orb-2 {
    width: 110px; height: 110px;
    bottom: 30%; right: 38%;
    animation: kp-bg-orb-pulse 7s ease-in-out infinite 2.5s;
}

/* ══════════════════════════════════════════════════════════════
   Grid overlay (dark) + Dot grid (light)
   ══════════════════════════════════════════════════════════════ */
.kp-bg-grid {
    position: absolute;
    inset: 0;
    opacity: 0;
    background-image:
        linear-gradient(rgba(69,170,242,0.09) 1px, transparent 1px),
        linear-gradient(90deg, rgba(69,170,242,0.09) 1px, transparent 1px);
    background-size: 52px 52px;
}
.kp-bg-dot-grid {
    position: absolute;
    inset: 0;
    opacity: 0;
    background-image: radial-gradient(circle, rgba(99,102,241,0.38) 1px, transparent 1px);
    background-size: 30px 30px;
}

/* ══════════════════════════════════════════════════════════════
   Diagonal light wave
   ══════════════════════════════════════════════════════════════ */
.kp-bg-wave {
    position: absolute;
    inset: 0;
    overflow: hidden;
}
.kp-bg-wave::before {
    content: '';
    position: absolute;
    width: 55%; height: 200%;
    top: -50%; left: 0;
    animation: kp-bg-wave-sweep 18s ease-in-out infinite 3s;
}

/* ══════════════════════════════════════════════════════════════
   Orbit rings — thin rotating circles with a satellite dot
   ══════════════════════════════════════════════════════════════ */
.kp-bg-orbit {
    position: absolute;
    border-radius: 50%;
    will-change: transform;
}
.kp-bg-orbit::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.kp-bg-orbit-1 {
    width:  clamp(260px, 32vw, 500px);
    height: clamp(260px, 32vw, 500px);
    top: 4%; right: 4%;
    animation: kp-bg-orbit-spin 30s linear infinite;
}
.kp-bg-orbit-1::after {
    width: 8px; height: 8px;
    top: 5%; left: 50%;
    transform: translateX(-50%);
}

.kp-bg-orbit-2 {
    width:  clamp(170px, 20vw, 320px);
    height: clamp(170px, 20vw, 320px);
    top: 14%; right: 11%;
    animation: kp-bg-orbit-spin-rev 20s linear infinite;
}
.kp-bg-orbit-2::after {
    width: 6px; height: 6px;
    bottom: 4%; left: 50%;
    transform: translateX(-50%);
}

.kp-bg-orbit-3 {
    width:  clamp(300px, 38vw, 580px);
    height: clamp(300px, 38vw, 580px);
    bottom: -12%; left: -10%;
    animation: kp-bg-orbit-spin 38s linear infinite 5s;
}
.kp-bg-orbit-3::after {
    width: 7px; height: 7px;
    top: 8%; right: 8%;
}

.kp-bg-orbit-4 {
    width:  clamp(110px, 13vw, 200px);
    height: clamp(110px, 13vw, 200px);
    top: 56%; left: 56%;
    animation: kp-bg-orbit-spin-rev 16s linear infinite 2s;
}
.kp-bg-orbit-4::after {
    width: 5px; height: 5px;
    top: 2%; left: 50%;
    transform: translateX(-50%);
}

/* ══════════════════════════════════════════════════════════════
   Circuit lines — CSS L-shaped traces with endpoint nodes
   ══════════════════════════════════════════════════════════════ */
.kp-bg-circuit {
    position: absolute;
    will-change: opacity;
    animation: kp-bg-circuit-glow 6s ease-in-out infinite;
}
.kp-bg-circuit::before,
.kp-bg-circuit::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

.kp-bg-circuit-1 {
    width: 140px; height: 90px;
    top: 20%; left: 8%;
    border-right: 1px solid;
    border-top: 1px solid;
    border-top-right-radius: 3px;
    animation-delay: 0s;
}
.kp-bg-circuit-1::before { width: 7px; height: 7px; top: -3.5px; left: -3.5px; }
.kp-bg-circuit-1::after  { width: 5px; height: 5px; bottom: -2.5px; right: -2.5px; }

.kp-bg-circuit-2 {
    width: 80px; height: 130px;
    top: 52%; right: 9%;
    border-left: 1px solid;
    border-bottom: 1px solid;
    border-bottom-left-radius: 3px;
    animation-delay: 2.2s;
}
.kp-bg-circuit-2::before { width: 6px; height: 6px; top: -3px; left: -3px; }
.kp-bg-circuit-2::after  { width: 6px; height: 6px; bottom: -3px; right: -3px; }

.kp-bg-circuit-3 {
    width: 110px; height: 55px;
    bottom: 18%; left: 33%;
    border-right: 1px solid;
    border-bottom: 1px solid;
    border-bottom-right-radius: 3px;
    animation-delay: 4.1s;
}
.kp-bg-circuit-3::before { width: 5px; height: 5px; top: -2.5px; left: -2.5px; }
.kp-bg-circuit-3::after  { width: 7px; height: 7px; bottom: -3.5px; right: -3.5px; }

.kp-bg-circuit-4 {
    width: 55px; height: 95px;
    top: 36%; left: 20%;
    border-right: 1px solid;
    border-top: 1px solid;
    border-top-right-radius: 3px;
    animation-delay: 1.4s;
}
.kp-bg-circuit-4::before { width: 5px; height: 5px; top: -2.5px; left: -2.5px; }
.kp-bg-circuit-4::after  { width: 5px; height: 5px; bottom: -2.5px; right: -2.5px; }

.kp-bg-circuit-5 {
    width: 155px; height: 48px;
    top: 70%; right: 22%;
    border-left: 1px solid;
    border-top: 1px solid;
    border-top-left-radius: 3px;
    animation-delay: 3s;
}
.kp-bg-circuit-5::before { width: 6px; height: 6px; top: -3px; right: -3px; }
.kp-bg-circuit-5::after  { width: 5px; height: 5px; bottom: -2.5px; left: -2.5px; }

/* ══════════════════════════════════════════════════════════════
   Neural network dots — pulsing nodes with radiating line spokes
   ══════════════════════════════════════════════════════════════ */
.kp-bg-nd {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
    animation: kp-bg-nd-pulse 4s ease-in-out infinite;
}
.kp-bg-nd::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform-origin: left center;
    height: 1px;
    opacity: 0.35;
}

.kp-bg-nd-1 { width: 8px;  height: 8px;  top: 28%; left: 62%; animation-delay: 0s; }
.kp-bg-nd-1::before { width: 58px;  transform: rotate(35deg); }

.kp-bg-nd-2 { width: 6px;  height: 6px;  top: 35%; left: 73%; animation-delay: 0.8s; }
.kp-bg-nd-2::before { width: 46px;  transform: rotate(-55deg); }

.kp-bg-nd-3 { width: 10px; height: 10px; top: 46%; left: 81%; animation-delay: 1.6s; }
.kp-bg-nd-3::before { width: 68px;  transform: rotate(15deg); }

.kp-bg-nd-4 { width: 6px;  height: 6px;  top: 57%; left: 69%; animation-delay: 2.4s; }
.kp-bg-nd-4::before { width: 52px;  transform: rotate(-30deg); }

.kp-bg-nd-5 { width: 8px;  height: 8px;  top: 21%; left: 44%; animation-delay: 1.2s; }
.kp-bg-nd-5::before { width: 44px;  transform: rotate(60deg); }

.kp-bg-nd-6 { width: 5px;  height: 5px;  top: 66%; left: 28%; animation-delay: 3s; }
.kp-bg-nd-6::before { width: 48px;  transform: rotate(-45deg); }

.kp-bg-nd-7 { width: 7px;  height: 7px;  top: 14%; left: 76%; animation-delay: 0.4s; }
.kp-bg-nd-7::before { width: 62px;  transform: rotate(25deg); }

.kp-bg-nd-8 { width: 5px;  height: 5px;  top: 76%; left: 54%; animation-delay: 2s; }
.kp-bg-nd-8::before { width: 38px;  transform: rotate(-70deg); }

/* ══════════════════════════════════════════════════════════════
   Particles (dark mode only)
   ══════════════════════════════════════════════════════════════ */
.kp-bg-p {
    position: absolute;
    border-radius: 50%;
    will-change: transform, opacity;
    opacity: 0;
}
.kp-bg-p-1  { width: 4px; height: 4px; bottom: 10%; left: 12%; animation: kp-bg-particle-rise 12s ease-in infinite 0s;   }
.kp-bg-p-2  { width: 3px; height: 3px; bottom: 15%; left: 28%; animation: kp-bg-particle-rise 15s ease-in infinite 2s;   }
.kp-bg-p-3  { width: 5px; height: 5px; bottom:  5%; left: 44%; animation: kp-bg-particle-rise 11s ease-in infinite 4s;   }
.kp-bg-p-4  { width: 3px; height: 3px; bottom: 20%; left: 60%; animation: kp-bg-particle-rise 14s ease-in infinite 1s;   }
.kp-bg-p-5  { width: 4px; height: 4px; bottom:  8%; left: 72%; animation: kp-bg-particle-rise 13s ease-in infinite 3s;   }
.kp-bg-p-6  { width: 3px; height: 3px; bottom: 12%; left: 85%; animation: kp-bg-particle-rise 16s ease-in infinite 5s;   }
.kp-bg-p-7  { width: 5px; height: 5px; bottom:  3%; left: 22%; animation: kp-bg-particle-rise 10s ease-in infinite 7s;   }
.kp-bg-p-8  { width: 3px; height: 3px; bottom: 18%; left: 52%; animation: kp-bg-particle-rise 17s ease-in infinite 6s;   }
.kp-bg-p-9  { width: 4px; height: 4px; bottom:  6%; left: 38%; animation: kp-bg-particle-rise 13s ease-in infinite 8s;   }
.kp-bg-p-10 { width: 3px; height: 3px; bottom: 22%; left: 66%; animation: kp-bg-particle-rise 11s ease-in infinite 9s;   }
.kp-bg-p-11 { width: 5px; height: 5px; bottom:  9%; left: 79%; animation: kp-bg-particle-rise 14s ease-in infinite 1.5s; }
.kp-bg-p-12 { width: 3px; height: 3px; bottom: 14%; left: 92%; animation: kp-bg-particle-rise 12s ease-in infinite 3.5s; }

/* ══════════════════════════════════════════════════════════════
   LIGHT THEME
   ══════════════════════════════════════════════════════════════ */

/* Blobs */
[data-theme="light"] .kp-bg-blob-a {
    background: radial-gradient(circle at 42% 42%, #3b82f6 0%, #60a5fa 55%, transparent 80%);
    filter: blur(88px); opacity: 0.26;
}
[data-theme="light"] .kp-bg-blob-b {
    background: radial-gradient(circle at 50% 50%, #8b5cf6 0%, #a78bfa 55%, transparent 80%);
    filter: blur(78px); opacity: 0.21;
}
[data-theme="light"] .kp-bg-blob-c {
    background: radial-gradient(circle at 50% 50%, #06b6d4 0%, #22d3ee 55%, transparent 80%);
    filter: blur(90px); opacity: 0.19;
}
[data-theme="light"] .kp-bg-blob-d {
    background: radial-gradient(circle at 50% 50%, #ec4899 0%, #f472b6 55%, transparent 80%);
    filter: blur(68px); opacity: 0.18;
}

/* Orbs */
[data-theme="light"] .kp-bg-orb-1 {
    background: radial-gradient(circle, rgba(59,130,246,0.50) 0%, rgba(96,165,250,0.15) 50%, transparent 70%);
    filter: blur(18px); opacity: 0.7;
}
[data-theme="light"] .kp-bg-orb-2 {
    background: radial-gradient(circle, rgba(139,92,246,0.45) 0%, rgba(167,139,250,0.12) 50%, transparent 70%);
    filter: blur(14px); opacity: 0.6;
}

/* Grid off / dot grid on */
[data-theme="light"] .kp-bg-grid     { opacity: 0 !important; animation: none; }
[data-theme="light"] .kp-bg-dot-grid { animation: kp-bg-dotgrid-breathe 8s ease-in-out infinite; opacity: 0.55; }

/* Wave */
[data-theme="light"] .kp-bg-wave::before {
    background: linear-gradient(108deg, transparent 36%, rgba(59,130,246,0.07) 50%, transparent 64%);
}

/* Orbit rings */
[data-theme="light"] .kp-bg-orbit-1 { border: 1px solid rgba(99,102,241,0.18); }
[data-theme="light"] .kp-bg-orbit-1::after {
    background: rgba(99,102,241,0.60);
    box-shadow: 0 0 8px 3px rgba(99,102,241,0.35);
}
[data-theme="light"] .kp-bg-orbit-2 { border: 1px solid rgba(6,182,212,0.22); }
[data-theme="light"] .kp-bg-orbit-2::after {
    background: rgba(6,182,212,0.70);
    box-shadow: 0 0 6px 2px rgba(6,182,212,0.35);
}
[data-theme="light"] .kp-bg-orbit-3 { border: 1px dashed rgba(139,92,246,0.14); }
[data-theme="light"] .kp-bg-orbit-3::after {
    background: rgba(139,92,246,0.55);
    box-shadow: 0 0 7px 2px rgba(139,92,246,0.30);
}
[data-theme="light"] .kp-bg-orbit-4 { border: 1px solid rgba(59,130,246,0.20); }
[data-theme="light"] .kp-bg-orbit-4::after {
    background: rgba(59,130,246,0.65);
    box-shadow: 0 0 5px 2px rgba(59,130,246,0.30);
}

/* Circuit lines */
[data-theme="light"] .kp-bg-circuit-1,
[data-theme="light"] .kp-bg-circuit-3 { border-color: rgba(99,102,241,0.28); }
[data-theme="light"] .kp-bg-circuit-1::before, [data-theme="light"] .kp-bg-circuit-1::after,
[data-theme="light"] .kp-bg-circuit-3::before, [data-theme="light"] .kp-bg-circuit-3::after {
    background: rgba(99,102,241,0.60);
}
[data-theme="light"] .kp-bg-circuit-2,
[data-theme="light"] .kp-bg-circuit-4 { border-color: rgba(6,182,212,0.26); }
[data-theme="light"] .kp-bg-circuit-2::before, [data-theme="light"] .kp-bg-circuit-2::after,
[data-theme="light"] .kp-bg-circuit-4::before, [data-theme="light"] .kp-bg-circuit-4::after {
    background: rgba(6,182,212,0.60);
}
[data-theme="light"] .kp-bg-circuit-5 { border-color: rgba(139,92,246,0.24); }
[data-theme="light"] .kp-bg-circuit-5::before, [data-theme="light"] .kp-bg-circuit-5::after {
    background: rgba(139,92,246,0.60);
}

/* Neural dots */
[data-theme="light"] .kp-bg-nd-1,
[data-theme="light"] .kp-bg-nd-3,
[data-theme="light"] .kp-bg-nd-6 { background: rgba(99,102,241,0.60); }
[data-theme="light"] .kp-bg-nd-1::before,
[data-theme="light"] .kp-bg-nd-3::before,
[data-theme="light"] .kp-bg-nd-6::before { background: rgba(99,102,241,0.28); }

[data-theme="light"] .kp-bg-nd-2,
[data-theme="light"] .kp-bg-nd-5,
[data-theme="light"] .kp-bg-nd-7 { background: rgba(6,182,212,0.60); }
[data-theme="light"] .kp-bg-nd-2::before,
[data-theme="light"] .kp-bg-nd-5::before,
[data-theme="light"] .kp-bg-nd-7::before { background: rgba(6,182,212,0.28); }

[data-theme="light"] .kp-bg-nd-4,
[data-theme="light"] .kp-bg-nd-8 { background: rgba(139,92,246,0.60); }
[data-theme="light"] .kp-bg-nd-4::before,
[data-theme="light"] .kp-bg-nd-8::before { background: rgba(139,92,246,0.28); }

/* Particles off in light mode */
[data-theme="light"] .kp-bg-p { opacity: 0 !important; animation: none !important; }

/* ══════════════════════════════════════════════════════════════
   DARK THEME
   ══════════════════════════════════════════════════════════════ */

/* Blobs */
[data-theme="dark"] .kp-bg-blob-a {
    background: radial-gradient(circle at 42% 42%, #2563eb 0%, #60a5fa 55%, transparent 80%);
    filter: blur(96px); opacity: 0.34;
}
[data-theme="dark"] .kp-bg-blob-b {
    background: radial-gradient(circle at 50% 50%, #7c3aed 0%, #8b5cf6 55%, transparent 80%);
    filter: blur(88px); opacity: 0.28;
}
[data-theme="dark"] .kp-bg-blob-c {
    background: radial-gradient(circle at 50% 50%, #0891b2 0%, #06b6d4 55%, transparent 80%);
    filter: blur(96px); opacity: 0.26;
}
[data-theme="dark"] .kp-bg-blob-d {
    background: radial-gradient(circle at 50% 50%, #be185d 0%, #ec4899 55%, transparent 80%);
    filter: blur(76px); opacity: 0.22;
}

/* Orbs */
[data-theme="dark"] .kp-bg-orb-1 {
    background: radial-gradient(circle, rgba(96,165,250,0.70) 0%, rgba(59,130,246,0.18) 55%, transparent 70%);
    filter: blur(10px);
    box-shadow: 0 0 48px 16px rgba(59,130,246,0.22);
    opacity: 0.88;
}
[data-theme="dark"] .kp-bg-orb-2 {
    background: radial-gradient(circle, rgba(167,139,250,0.65) 0%, rgba(139,92,246,0.18) 55%, transparent 70%);
    filter: blur(8px);
    box-shadow: 0 0 36px 12px rgba(139,92,246,0.20);
    opacity: 0.80;
}

/* Grid on / dot grid off */
[data-theme="dark"] .kp-bg-grid     { animation: kp-bg-grid-pulse 6s ease-in-out infinite; }
[data-theme="dark"] .kp-bg-dot-grid { opacity: 0 !important; animation: none; }

/* Wave */
[data-theme="dark"] .kp-bg-wave::before {
    background: linear-gradient(108deg, transparent 36%, rgba(69,170,242,0.10) 50%, transparent 64%);
}

/* Orbit rings */
[data-theme="dark"] .kp-bg-orbit-1 {
    border: 1px solid rgba(96,165,250,0.25);
    box-shadow: inset 0 0 22px rgba(96,165,250,0.06);
}
[data-theme="dark"] .kp-bg-orbit-1::after {
    background: #60a5fa;
    box-shadow: 0 0 14px 5px rgba(96,165,250,0.70);
}
[data-theme="dark"] .kp-bg-orbit-2 {
    border: 1px solid rgba(34,211,238,0.28);
}
[data-theme="dark"] .kp-bg-orbit-2::after {
    background: #22d3ee;
    box-shadow: 0 0 12px 4px rgba(34,211,238,0.65);
}
[data-theme="dark"] .kp-bg-orbit-3 {
    border: 1px dashed rgba(167,139,250,0.20);
}
[data-theme="dark"] .kp-bg-orbit-3::after {
    background: #a78bfa;
    box-shadow: 0 0 12px 4px rgba(167,139,250,0.60);
}
[data-theme="dark"] .kp-bg-orbit-4 {
    border: 1px solid rgba(96,165,250,0.30);
}
[data-theme="dark"] .kp-bg-orbit-4::after {
    background: #60a5fa;
    box-shadow: 0 0 9px 3px rgba(96,165,250,0.55);
}

/* Circuit lines */
[data-theme="dark"] .kp-bg-circuit-1,
[data-theme="dark"] .kp-bg-circuit-3 { border-color: rgba(96,165,250,0.32); }
[data-theme="dark"] .kp-bg-circuit-1::before, [data-theme="dark"] .kp-bg-circuit-1::after,
[data-theme="dark"] .kp-bg-circuit-3::before, [data-theme="dark"] .kp-bg-circuit-3::after {
    background: rgba(96,165,250,0.95);
    box-shadow: 0 0 7px 2px rgba(96,165,250,0.55);
}
[data-theme="dark"] .kp-bg-circuit-2,
[data-theme="dark"] .kp-bg-circuit-4 { border-color: rgba(34,211,238,0.30); }
[data-theme="dark"] .kp-bg-circuit-2::before, [data-theme="dark"] .kp-bg-circuit-2::after,
[data-theme="dark"] .kp-bg-circuit-4::before, [data-theme="dark"] .kp-bg-circuit-4::after {
    background: rgba(34,211,238,0.95);
    box-shadow: 0 0 7px 2px rgba(34,211,238,0.55);
}
[data-theme="dark"] .kp-bg-circuit-5 { border-color: rgba(167,139,250,0.28); }
[data-theme="dark"] .kp-bg-circuit-5::before, [data-theme="dark"] .kp-bg-circuit-5::after {
    background: rgba(167,139,250,0.95);
    box-shadow: 0 0 7px 2px rgba(167,139,250,0.55);
}

/* Neural dots */
[data-theme="dark"] .kp-bg-nd-1,
[data-theme="dark"] .kp-bg-nd-3,
[data-theme="dark"] .kp-bg-nd-6 {
    background: rgba(96,165,250,0.95);
    box-shadow: 0 0 10px 3px rgba(96,165,250,0.55);
}
[data-theme="dark"] .kp-bg-nd-1::before,
[data-theme="dark"] .kp-bg-nd-3::before,
[data-theme="dark"] .kp-bg-nd-6::before { background: rgba(96,165,250,0.40); }

[data-theme="dark"] .kp-bg-nd-2,
[data-theme="dark"] .kp-bg-nd-5,
[data-theme="dark"] .kp-bg-nd-7 {
    background: rgba(34,211,238,0.95);
    box-shadow: 0 0 10px 3px rgba(34,211,238,0.55);
}
[data-theme="dark"] .kp-bg-nd-2::before,
[data-theme="dark"] .kp-bg-nd-5::before,
[data-theme="dark"] .kp-bg-nd-7::before { background: rgba(34,211,238,0.40); }

[data-theme="dark"] .kp-bg-nd-4,
[data-theme="dark"] .kp-bg-nd-8 {
    background: rgba(167,139,250,0.95);
    box-shadow: 0 0 10px 3px rgba(167,139,250,0.55);
}
[data-theme="dark"] .kp-bg-nd-4::before,
[data-theme="dark"] .kp-bg-nd-8::before { background: rgba(167,139,250,0.40); }

/* Particles — blue, purple, cyan rotation */
[data-theme="dark"] .kp-bg-p-1,
[data-theme="dark"] .kp-bg-p-4,
[data-theme="dark"] .kp-bg-p-9 {
    background: rgba(96,165,250,0.90);
    box-shadow: 0 0 7px 2px rgba(96,165,250,0.55);
}
[data-theme="dark"] .kp-bg-p-2,
[data-theme="dark"] .kp-bg-p-5,
[data-theme="dark"] .kp-bg-p-8,
[data-theme="dark"] .kp-bg-p-12 {
    background: rgba(167,139,250,0.90);
    box-shadow: 0 0 7px 2px rgba(167,139,250,0.55);
}
[data-theme="dark"] .kp-bg-p-3,
[data-theme="dark"] .kp-bg-p-6,
[data-theme="dark"] .kp-bg-p-7,
[data-theme="dark"] .kp-bg-p-10,
[data-theme="dark"] .kp-bg-p-11 {
    background: rgba(34,211,238,0.90);
    box-shadow: 0 0 7px 2px rgba(34,211,238,0.55);
}

/* ─ Reduce-motion: stop all canvas animations ─────────────────── */
@media (prefers-reduced-motion: reduce) {
    #kp-bg-canvas,
    #kp-bg-canvas * {
        animation: none !important;
    }
}
