/* ============================================================
   MEDISENSE — Motion & Graphics Layer
   Decorative backgrounds, scroll animations, micro-interactions
   ============================================================ */

/* === DECORATIVE BACKGROUNDS === */

/* Animated gradient orbs (place inside any section) */
.orb {
    position: absolute;
    pointer-events: none;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.5;
    z-index: 0;
}
.orb-green   { background: radial-gradient(circle, #20C997 0%, transparent 70%); }
.orb-emerald { background: radial-gradient(circle, #198754 0%, transparent 70%); }
.orb-lime    { background: radial-gradient(circle, #84CC16 0%, transparent 70%); }
.orb-mint    { background: radial-gradient(circle, #6EE7B7 0%, transparent 70%); }

.orb-1 { width: 400px; height: 400px; top: -100px; right: -100px; animation: orbDrift1 20s ease-in-out infinite; }
.orb-2 { width: 300px; height: 300px; bottom: -50px; left: -80px; animation: orbDrift2 25s ease-in-out infinite; }
.orb-3 { width: 200px; height: 200px; top: 30%; left: 50%; animation: orbDrift3 18s ease-in-out infinite; }

@keyframes orbDrift1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(40px, 60px) scale(1.1); }
    66% { transform: translate(-30px, 40px) scale(0.95); }
}
@keyframes orbDrift2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(60px, -40px) scale(1.15); }
}
@keyframes orbDrift3 {
    0%, 100% { transform: translate(0, 0) scale(1); opacity: 0.4; }
    50% { transform: translate(-50px, 30px) scale(1.2); opacity: 0.6; }
}

/* Blob shapes */
.blob {
    position: absolute;
    pointer-events: none;
    z-index: 0;
    background: linear-gradient(135deg, #0F5132, #20C997);
    opacity: 0.08;
}
.blob-shape-1 {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    animation: blobMorph1 12s ease-in-out infinite;
}
.blob-shape-2 {
    border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    animation: blobMorph2 16s ease-in-out infinite reverse;
}
@keyframes blobMorph1 {
    0%, 100% { border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%; transform: rotate(0deg); }
    33% { border-radius: 70% 30% 50% 50% / 50% 60% 40% 50%; transform: rotate(120deg); }
    66% { border-radius: 50% 50% 70% 30% / 30% 70% 30% 70%; transform: rotate(240deg); }
}
@keyframes blobMorph2 {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; transform: rotate(0deg) scale(1); }
    50% { border-radius: 30% 70% 70% 30% / 50% 60% 40% 50%; transform: rotate(180deg) scale(1.1); }
}

/* Dot pattern background */
.dot-pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(circle, rgba(38,184,112,0.18) 1.5px, transparent 1.5px);
    background-size: 30px 30px;
    mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 70%, transparent 100%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 30%, #000 70%, transparent 100%);
    opacity: 0.6;
}

/* Grid pattern background */
.grid-pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(38,184,112,0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(38,184,112,0.06) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 80%);
}

/* Wave divider (place between sections) */
.wave-divider {
    position: relative;
    width: 100%;
    height: 80px;
    overflow: hidden;
    margin-top: -1px;
    margin-bottom: -1px;
}
.wave-divider svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    fill: var(--bg-soft, #f7faf8);
}
.wave-divider.flip svg { transform: rotate(180deg); }
[data-theme="dark"] .wave-divider svg { fill: rgba(15,31,23,0.4); }

/* === FLOATING PARTICLES === */
.particles-bg {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}
.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(38,184,112,0.4);
    border-radius: 50%;
    animation: floatParticle linear infinite;
}
.particle.lg { width: 14px; height: 14px; opacity: 0.3; }
.particle.sm { width: 4px; height: 4px; opacity: 0.6; }
@keyframes floatParticle {
    0%   { transform: translate(0, 0); opacity: 0; }
    10%  { opacity: 1; }
    90%  { opacity: 1; }
    100% { transform: translate(var(--tx, 100px), var(--ty, -200px)); opacity: 0; }
}

/* === SECTION-LEVEL DECORATIONS === */
.has-deco {
    position: relative;
    overflow: hidden;
}
.has-deco > .container,
.has-deco > .section-head,
.has-deco > div:not(.orb):not(.blob):not(.particles-bg):not(.dot-pattern):not(.grid-pattern) {
    position: relative;
    z-index: 2;
}

/* === ENHANCED SCROLL ANIMATIONS === */
/* Custom AOS-style classes */
[data-motion] {
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
[data-motion].in-view { opacity: 1; transform: none !important; }

[data-motion="slide-up"]    { transform: translateY(50px); }
[data-motion="slide-down"]  { transform: translateY(-50px); }
[data-motion="slide-left"]  { transform: translateX(50px); }
[data-motion="slide-right"] { transform: translateX(-50px); }
[data-motion="zoom-in"]     { transform: scale(0.85); }
[data-motion="zoom-out"]    { transform: scale(1.15); }
[data-motion="rotate-in"]   { transform: rotate(-8deg) scale(0.92); }
[data-motion="flip-up"]     { transform: perspective(800px) rotateX(40deg) translateY(40px); transform-origin: bottom; }
[data-motion="blur-in"]     { filter: blur(12px); }
[data-motion="blur-in"].in-view { filter: blur(0); }

/* Stagger children */
.motion-stagger > * {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}
.motion-stagger.in-view > * { opacity: 1; transform: translateY(0); }
.motion-stagger.in-view > *:nth-child(1) { transition-delay: 0s; }
.motion-stagger.in-view > *:nth-child(2) { transition-delay: 0.08s; }
.motion-stagger.in-view > *:nth-child(3) { transition-delay: 0.16s; }
.motion-stagger.in-view > *:nth-child(4) { transition-delay: 0.24s; }
.motion-stagger.in-view > *:nth-child(5) { transition-delay: 0.32s; }
.motion-stagger.in-view > *:nth-child(6) { transition-delay: 0.40s; }

/* === PARALLAX (scroll speed) === */
.parallax-slow { transition: transform 0.1s linear; }
.parallax-fast { transition: transform 0.1s linear; }

/* === HERO SHINE === */
.shine-text {
    background: linear-gradient(
        90deg,
        var(--text) 0%,
        var(--text) 40%,
        #20C997 50%,
        var(--text) 60%,
        var(--text) 100%
    );
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shineMove 4s ease-in-out infinite;
}
@keyframes shineMove {
    0%, 100% { background-position: 200% 0; }
    50%      { background-position: -200% 0; }
}

/* === MICRO-INTERACTIONS === */
.btn { position: relative; overflow: hidden; }
.btn::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s ease, height 0.5s ease;
    z-index: 0;
    pointer-events: none;
}
.btn:hover::before { width: 400px; height: 400px; }
.btn > * { position: relative; z-index: 1; }

/* Magnetic hover for cards */
.magnetic {
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

/* Tilt 3D on cards */
.tilt-card {
    transform-style: preserve-3d;
    transition: transform 0.3s ease;
}

/* Glow on hover for cards */
.glow-on-hover {
    position: relative;
}
.glow-on-hover::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #20C997, #0F5132, #84CC16);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s ease;
    filter: blur(12px);
}
.glow-on-hover:hover::after { opacity: 0.6; }

/* === ANIMATED BORDERS === */
.animated-border {
    position: relative;
    background: var(--bg-elev);
    border-radius: inherit;
}
.animated-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: inherit;
    background: linear-gradient(135deg, transparent 30%, #20C997 50%, transparent 70%);
    background-size: 300% 100%;
    -webkit-mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    animation: borderShimmer 3s linear infinite;
    pointer-events: none;
}
@keyframes borderShimmer {
    0%   { background-position: 100% 0; }
    100% { background-position: -200% 0; }
}

/* === TEXT EFFECTS === */
.text-gradient {
    background: linear-gradient(135deg, #0F5132 0%, #20C997 50%, #84CC16 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.typewriter {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: 3px solid #20C997;
    animation: typewriterText 3s steps(40, end), blinkCursor 0.75s step-end infinite;
}
@keyframes typewriterText {
    from { width: 0; }
    to   { width: 100%; }
}
@keyframes blinkCursor {
    50% { border-color: transparent; }
}

/* === SHOP BUTTON === */
.btn-shop {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, #84CC16 0%, #20C997 100%);
    color: #0F5132 !important;
    border: 0;
    padding: 10px 20px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 14px;
    text-decoration: none;
    box-shadow: 0 8px 18px -8px rgba(132,204,22,0.6);
    transition: transform 0.25s ease, box-shadow 0.25s ease, filter 0.25s ease;
    position: relative;
    overflow: hidden;
}
.btn-shop:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(132,204,22,0.8);
    filter: brightness(1.05);
}
.btn-shop::after {
    content: '→';
    transition: transform 0.25s ease;
    display: inline-block;
}
[dir="rtl"] .btn-shop::after { content: '←'; }
.btn-shop:hover::after { transform: translateX(4px); }
[dir="rtl"] .btn-shop:hover::after { transform: translateX(-4px); }
.btn-shop-lg {
    padding: 14px 28px;
    font-size: 15px;
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .orb, .blob, .particle { display: none; }
}
