/* ============================================
   Second Chance Advocate — Premium Stylesheet
   v2.0 — Enhanced Effects & Animations
   ============================================ */

/* --- Scroll Progress Bar --- */
#scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    background: linear-gradient(90deg, #2563eb, #7c3aed, #3b82f6);
    width: 0%;
    z-index: 9999;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px rgba(37, 99, 235, 0.5);
}

/* --- Cursor Glow --- */
#cursor-glow {
    position: fixed;
    width: 350px;
    height: 350px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s ease;
    will-change: left, top;
}

/* --- Mesh Backgrounds --- */
.mesh-light {
    background-color: #ffffff;
    background-image: 
        radial-gradient(at 0% 0%, hsla(210,100%,98%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(230,100%,97%,1) 0, transparent 50%), 
        radial-gradient(at 100% 100%, hsla(190,100%,98%,1) 0, transparent 50%), 
        radial-gradient(at 0% 100%, hsla(210,100%,96%,1) 0, transparent 50%);
}

.mesh-hero {
    background-color: #ffffff;
    background-image:
        radial-gradient(at 20% 20%, hsla(215,100%,96%,0.8) 0, transparent 60%),
        radial-gradient(at 80% 10%, hsla(235,100%,96%,0.6) 0, transparent 50%),
        radial-gradient(at 50% 80%, hsla(200,100%,97%,0.7) 0, transparent 60%);
    position: relative;
}

/* --- Noise Texture Overlay --- */
.mesh-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.015;
    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.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* --- Glass Effects --- */
.glass-pill {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.04),
        inset 0 1px 0 rgba(255,255,255,0.5);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow: 
        0 20px 50px -12px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255,255,255,0.6);
}

/* --- Scroll Reveal Animations --- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal.active {
    opacity: 1;
    transform: translateY(0) rotate(0) scale(1);
}

/* Reveal Variants */
.reveal-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal-left.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal-right.active {
    opacity: 1;
    transform: translateX(0);
}

.reveal-scale {
    opacity: 0;
    transform: scale(0.92);
    transition: all 1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal-scale.active {
    opacity: 1;
    transform: scale(1);
}

.reveal-rotate {
    opacity: 0;
    transform: translateY(30px) rotate(2deg);
    transition: all 1.1s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}
.reveal-rotate.active {
    opacity: 1;
    transform: translateY(0) rotate(0);
}

.stagger-1 { transition-delay: 120ms; }
.stagger-2 { transition-delay: 240ms; }
.stagger-3 { transition-delay: 360ms; }
.stagger-4 { transition-delay: 480ms; }
.stagger-5 { transition-delay: 600ms; }
.stagger-6 { transition-delay: 720ms; }

/* --- Text Gradient (Animated) --- */
.text-gradient-brand {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 30%, #7c3aed 60%, #2563eb 80%, #3b82f6 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 6s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    padding: 14px 32px;
    border-radius: 14px;
    font-weight: 900;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px -4px rgba(37, 99, 235, 0.3);
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.6s ease;
}
.btn-primary:hover::before {
    left: 100%;
}
.btn-primary:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-3px);
    box-shadow: 
        0 16px 40px -8px rgba(37, 99, 235, 0.4),
        0 0 20px rgba(37, 99, 235, 0.15);
}
.btn-primary:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -4px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #ffffff;
    color: #0f172a;
    padding: 14px 32px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
}
.btn-secondary:hover {
    background: #f8fafc;
    transform: translateY(-3px);
    box-shadow: 0 12px 28px -8px rgba(0,0,0,0.12);
    border-color: #cbd5e1;
}

.btn-white {
    background: #ffffff;
    color: #2563eb;
    padding: 18px 40px;
    border-radius: 16px;
    font-weight: 900;
    font-size: 13px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}
.btn-white::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(37,99,235,0.06), transparent);
    transition: left 0.6s ease;
}
.btn-white:hover::before {
    left: 100%;
}
.btn-white:hover {
    background: #f8fafc;
    transform: translateY(-3px);
    box-shadow: 0 18px 40px rgba(0,0,0,0.14);
}

/* --- Hover Lift / Tilt Cards --- */
.hover-lift {
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}
.hover-lift:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 32px 60px -20px rgba(0, 0, 0, 0.1),
        0 0 0 1px rgba(37, 99, 235, 0.04);
}

/* Tilt card 3D effect — applied via JS */
.tilt-card {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.15s ease-out;
}
.tilt-card-inner {
    transform: translateZ(20px);
}

/* --- Shimmer / Shine Effect --- */
.shimmer {
    position: relative;
    overflow: hidden;
}
.shimmer::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        to bottom right,
        transparent 40%,
        rgba(255,255,255,0.08) 45%,
        rgba(255,255,255,0.15) 50%,
        rgba(255,255,255,0.08) 55%,
        transparent 60%
    );
    transform: rotate(30deg);
    animation: shimmerSlide 8s ease-in-out infinite;
    pointer-events: none;
}
@keyframes shimmerSlide {
    0%, 100% { transform: rotate(30deg) translateY(0); }
    50% { transform: rotate(30deg) translateY(100%); }
}

/* --- Animated Border Gradient --- */
.gradient-border {
    position: relative;
    border-radius: 2rem;
    overflow: hidden;
}
.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 2px;
    border-radius: inherit;
    background: linear-gradient(135deg, #3b82f6, #7c3aed, #06b6d4, #3b82f6);
    background-size: 300% 300%;
    -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;
    animation: borderRotate 4s linear infinite;
    pointer-events: none;
}
@keyframes borderRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Form Inputs --- */
.form-input {
    width: 100%;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 15px 20px;
    font-size: 14px;
    outline: none;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    color: #0f172a;
}
.form-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.08), 0 4px 16px -4px rgba(59,130,246,0.15);
    background: #fff;
    transform: translateY(-1px);
}
.form-input:hover:not(:focus) {
    border-color: #cbd5e1;
    background: #fff;
}
.form-input::placeholder {
    color: #94a3b8;
    transition: color 0.3s ease;
}
.form-input:focus::placeholder {
    color: #c7d2fe;
}

/* --- FAQ Accordion --- */
details summary {
    list-style: none;
}
details summary::-webkit-details-marker {
    display: none;
}
details {
    transition: all 0.3s ease;
}
details[open] {
    background: #fff !important;
    box-shadow: 0 8px 32px -12px rgba(0,0,0,0.08);
}
details[open] summary .faq-icon {
    transform: rotate(45deg);
    color: #ef4444;
}
details summary .faq-icon {
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
details:hover {
    border-color: #cbd5e1;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* --- Selection --- */
::selection {
    background: #2563eb;
    color: #fff;
}

/* --- Float Animation --- */
@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    33% { transform: translateY(-10px) rotate(0.5deg); }
    66% { transform: translateY(-16px) rotate(-0.5deg); }
}
.animate-float {
    animation: float 7s ease-in-out infinite;
}

/* --- Pulse Slow --- */
@keyframes pulse-slow {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(1.03); }
}
.animate-pulse-slow {
    animation: pulse-slow 8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* --- Blob Animation --- */
@keyframes blobMorph {
    0%, 100% { border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%; }
    25% { border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%; }
    50% { border-radius: 50% 60% 30% 60% / 30% 60% 70% 40%; }
    75% { border-radius: 60% 40% 60% 30% / 40% 50% 60% 50%; }
}
.blob-animate {
    animation: blobMorph 12s ease-in-out infinite;
}

/* --- Spin Slow --- */
@keyframes spinSlow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.animate-spin-slow {
    animation: spinSlow 20s linear infinite;
}

/* --- Navbar Shrink --- */
.navbar-scrolled .glass-pill {
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.06),
        0 1px 3px rgba(0,0,0,0.04);
    background: rgba(255, 255, 255, 0.85);
}

/* --- Page Transition --- */
.page-enter {
    animation: pageEnter 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes pageEnter {
    from { opacity: 0; transform: translateY(20px); filter: blur(4px); }
    to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

/* --- Step Number Watermark --- */
.step-watermark {
    font-size: clamp(8rem, 16vw, 14rem);
    font-weight: 900;
    line-height: 1;
    position: absolute;
    top: -2rem;
    user-select: none;
    pointer-events: none;
    opacity: 1;
}

/* --- Testimonial Card --- */
.testimonial-card {
    position: relative;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.testimonial-card::before {
    content: '\201C';
    position: absolute;
    top: -8px;
    left: 24px;
    font-size: 5rem;
    font-family: 'Georgia', serif;
    color: #eff6ff;
    line-height: 1;
    pointer-events: none;
    transition: color 0.4s ease;
}
.testimonial-card:hover::before {
    color: #dbeafe;
}
.testimonial-card:hover {
    border-color: #bfdbfe;
}

/* --- Parallax Layer --- */
.parallax-layer {
    transition: transform 0.1s linear;
    will-change: transform;
}

/* --- Focus Visible --- */
:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

/* --- Smooth Image Loading --- */
img {
    transition: opacity 0.5s ease;
}
img[loading="lazy"] {
    opacity: 0;
}
img.loaded, img:not([loading="lazy"]) {
    opacity: 1;
}

/* --- Number Counter --- */
.counter-value {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* --- Magnetic Button --- */
.magnetic-btn {
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* --- Smooth Underline Link --- */
.link-underline {
    position: relative;
    display: inline-block;
}
.link-underline::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #2563eb;
    transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: 1px;
}
.link-underline:hover::after {
    width: 100%;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .reveal, .reveal-left, .reveal-right, .reveal-scale, .reveal-rotate {
        opacity: 1 !important;
        transform: none !important;
    }
    #cursor-glow { display: none; }
}
