/* ==========================================================================
   SIPmind Landing — Custom Styles
   ========================================================================== */

/* ---------- Grain overlay ---------- */
.grain {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ---------- Nav blur ---------- */
.nav-blur {
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    background: rgba(15, 17, 23, 0.7);
}

/* ---------- Scroll reveal ---------- */
.reveal {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Stagger children with --delay custom property */
.reveal[style*="--delay"] {
    transition-delay: var(--delay, 0s);
}

/* ---------- Wave visualizer ---------- */
.wave-container {
    background: linear-gradient(
        135deg,
        rgba(26, 29, 39, 0.5) 0%,
        rgba(15, 17, 23, 0.8) 100%
    );
}

.wave-bars {
    gap: 3px;
}

.wave-bar {
    width: 3px;
    border-radius: 9999px;
    background: linear-gradient(to top, #0ea5e9, #38bdf8);
    opacity: 0.6;
    animation: wave-pulse var(--duration, 1s) ease-in-out var(--delay, 0s) infinite alternate;
    will-change: transform;
}

@keyframes wave-pulse {
    0% {
        transform: scaleY(var(--min-scale, 0.15));
    }
    100% {
        transform: scaleY(var(--max-scale, 1));
    }
}

/* ---------- Step cards ---------- */
.step-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0) 0%, rgba(14, 165, 233, 0.1) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.step-card:hover::before {
    opacity: 1;
}

/* ---------- Feature cards hover glow ---------- */
.feature-card {
    position: relative;
    overflow: hidden;
}

.feature-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 1rem;
    opacity: 0;
    background: radial-gradient(
        600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        rgba(14, 165, 233, 0.04),
        transparent 40%
    );
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.feature-card:hover::after {
    opacity: 1;
}

/* ---------- Comparison table ---------- */
table {
    border-collapse: separate;
    border-spacing: 0;
}

table th {
    font-weight: 500;
}

/* ---------- Form focus states ---------- */
input:focus,
textarea:focus {
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.1);
}

/* ---------- Smooth scroll offset for fixed nav ---------- */
:target {
    scroll-margin-top: 80px;
}

/* ---------- Selection color ---------- */
::selection {
    background: rgba(14, 165, 233, 0.3);
    color: white;
}

/* ---------- Scrollbar (Webkit) ---------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0f1117;
}

::-webkit-scrollbar-thumb {
    background: #2d3140;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d4150;
}

/* ---------- Responsive tweaks ---------- */
@media (max-width: 640px) {
    .reveal {
        transform: translateY(16px);
    }

    .wave-bar {
        width: 2px;
    }

    .wave-bars {
        gap: 2px;
    }
}

/* ---------- Demo widget ---------- */
#demo-bubble {
    animation: demo-bounce 2s ease-in-out 5s 3;
}

@keyframes demo-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@media (max-width: 640px) {
    #demo-panel {
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        bottom: 80px !important;
        max-height: 70vh !important;
    }
}

#demo-mic-btn.recording {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    animation: demo-pulse 1.5s ease-in-out infinite;
}

@keyframes demo-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(239, 68, 68, 0); }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .reveal {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .wave-bar {
        animation: none;
        transform: scaleY(0.5);
    }

    #demo-bubble {
        animation: none;
    }

    #demo-mic-btn.recording {
        animation: none;
    }
}
