/* Sitewide motion/ambience layer - loaded after survey.css/theme-dct.css/dashboard.css so its
   rules win on the shared classes it enhances (buttons, panels, inputs) without duplicating
   their layout/color rules. Every decorative (non-essential) animation is gated behind
   prefers-reduced-motion: no-preference - functional transitions (panel swap, focus states)
   stay instant instead of removed entirely for reduced-motion users, never skipped. */

/* ---- Ambient background: slow-drifting glow blobs behind all content, very low opacity so it
   reads as depth/atmosphere rather than a distraction. Fixed + pointer-events:none so it never
   affects layout or interaction. ---- */
.vs-ambient-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 20%, rgba(var(--vs-primary-rgb), 0.14), transparent 45%),
        radial-gradient(circle at 80% 30%, rgba(var(--vs-primary-light-rgb), 0.12), transparent 40%),
        radial-gradient(circle at 60% 90%, rgba(var(--vs-glow-2-rgb), 0.1), transparent 50%),
        radial-gradient(circle at 10% 80%, rgba(var(--vs-primary-rgb), 0.08), transparent 45%);
    background-size: 140% 140%;
}

@media (prefers-reduced-motion: no-preference) {
    .vs-ambient-bg {
        animation: vs-ambient-drift 26s ease-in-out infinite alternate;
    }
}

@keyframes vs-ambient-drift {
    0% { background-position: 0% 0%, 100% 0%, 50% 100%, 0% 100%; }
    100% { background-position: 10% 15%, 85% 20%, 55% 85%, 15% 90%; }
}

/* ---- Entrance animation: applied via motion.js's reveal() to cards/rows/panels as they
   appear, staggered by --vs-reveal-delay. Starts pre-animated (opacity:1) so content is never
   invisible if JS fails to run - motion.js only ever ADDS the animating class, never hides
   content first. ---- */
@keyframes vs-fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: no-preference) {
    .vs-reveal {
        animation: vs-fade-up 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
        animation-delay: var(--vs-reveal-delay, 0s);
    }
}

/* ---- Panel swap: cross-fade instead of an instant d-none toggle. motion.js adds
   .vs-panel-out to the panel being hidden, waits one frame, swaps d-none, then adds
   .vs-panel-in to the panel being shown. Functional (not purely decorative) - kept even under
   reduced-motion, just shortened, so state changes are never silently instant AND unannounced. ---- */
.vs-panel-in { animation: vs-fade-up 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }

@media (prefers-reduced-motion: reduce) {
    .vs-panel-in { animation-duration: 0.01s; }
}

/* ---- Glow pulse: a soft breathing ring, used on the live status dot and the avatar/self-view
   stage border while a call is active - signals "live" without being a hard blink. ---- */
@keyframes vs-glow-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--vs-primary-rgb), 0.35); }
    50% { box-shadow: 0 0 0 8px rgba(var(--vs-primary-rgb), 0); }
}

@media (prefers-reduced-motion: no-preference) {
    .vs-glow-live,
    .vs-avatar-stage:not(.d-none),
    .vs-self-view-stage:not(.d-none) {
        animation: vs-glow-pulse 2.6s ease-out infinite;
    }
}

/* ---- Shine sweep on primary buttons: a light diagonal highlight that sweeps across on hover -
   cheap, purely CSS, no JS. ---- */
.vs-btn-primary,
.db-btn-primary,
.db-cta,
.app-nav-cta {
    position: relative;
    overflow: hidden;
}

.vs-btn-primary::after,
.db-btn-primary::after,
.db-cta::after,
.app-nav-cta::after {
    content: "";
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    transform: skewX(-20deg);
    transition: left 0.55s ease;
    pointer-events: none;
}

.vs-btn-primary:hover::after,
.db-btn-primary:hover::after,
.db-cta:hover::after,
.app-nav-cta:hover::after {
    left: 130%;
}

/* ---- Custom radio/checkbox: replaces the default OS control with a themed one. Keeps the real
   <input> for accessibility/keyboard/form semantics - only its visual box is hidden.
   .vs-radio (language/avatar/analysis-speed pickers) is a tab/pill group - selection is shown
   purely by the pill's own border/background highlight (see survey.css's
   .vs-radio:has(input:checked)), no separate radio-dot indicator drawn on top of it.
   .vs-checkbox (the single greeting-consent toggle) keeps its own checkbox-shaped ::before/::after
   below, since there's no equivalent "tab" surface to highlight instead. ---- */
.vs-radio input[type="radio"],
.vs-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.vs-radio:has(input:focus-visible) { outline: 2px solid var(--vs-primary); outline-offset: 2px; }

.vs-checkbox {
    position: relative;
    padding-left: 30px !important;
}

.vs-checkbox::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 2px solid var(--vs-border-strong, rgba(0, 0, 0, 0.25));
    transition: border-color 0.15s ease, background 0.15s ease;
    box-sizing: border-box;
}

.vs-checkbox::after {
    content: "";
    position: absolute;
    left: 6px;
    top: 45%;
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateY(-60%) rotate(45deg) scale(0);
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.vs-checkbox:has(input:checked)::before { border-color: var(--vs-primary); background: var(--vs-primary); }
.vs-checkbox:has(input:checked)::after { transform: translateY(-60%) rotate(45deg) scale(1); }
.vs-checkbox:has(input:focus-visible)::before { outline: 2px solid var(--vs-primary); outline-offset: 2px; }

/* ---- Card/panel hover lift consistency - slightly stronger than the base .db-card hover so
   the whole app feels like one system, not just the dashboard. ---- */
.vs-panel {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
