/**
 * Sweatty — Custom CSS
 * css/custom.css
 *
 * Contains design tokens, custom utility classes, animations,
 * and component styles not covered by Tailwind utilities.
 *
 * Structure:
 *  1. CSS Custom Properties (design tokens)
 *  2. Base resets & global styles
 *  3. Glass morphism
 *  4. Text gradient
 *  5. Ambient glow orbs
 *  6. Device 3D mockup
 *  7. Card hover lift
 *  8. Scroll reveal animation
 *  9. Progress bars
 * 10. FAQ accordion
 * 11. Noise overlay
 * 12. Background grid
 * 13. Scrollbar styling
 * 14. Button press micro-interaction
 * 15. Reduced motion overrides
 */

/* ============================================================
   1. CSS CUSTOM PROPERTIES (Design Tokens)
============================================================ */
:root {
    --brand:          #ea580c;            /* brand-600 */
    --brand-glow:     rgba(234,88,12,0.35);
    --ease-out-expo:  cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
    --radius-card:    1rem;              /* 16px */
    --shadow-brand:   0 8px 32px -8px rgba(234,88,12,0.35);
}

/* ============================================================
   2. BASE RESETS & GLOBAL STYLES
============================================================ */

/* Text selection highlight */
::selection {
    background: rgba(234, 88, 12, 0.15);
    color: #7c2d12;
}

/* Focus ring — accessible, on-brand */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 3px;
    border-radius: 8px;
}

/* Improve font rendering with OpenType features */
body {
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   3. GLASS MORPHISM
   Used for navbar on scroll and mobile menu.
============================================================ */
.glass {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.dark .glass {
    background: rgba(2, 6, 23, 0.72);
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* ============================================================
   4. TEXT GRADIENT
   Animated orange gradient used on hero headline.
============================================================ */
.text-gradient {
    background: linear-gradient(
        135deg,
        #ea580c 0%,
        #f97316 40%,
        #fb923c 60%,
        #f97316 80%,
        #ea580c 100%
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientShift 4s ease infinite;
}

/* gradientShift keyframe is defined in the Tailwind config in index.php */

/* ============================================================
   5. AMBIENT GLOW ORBS
   Large blurred circles for decorative background depth.
============================================================ */
.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    pointer-events: none;
    opacity: 0.5;
}

.dark .glow-orb {
    opacity: 0.25;
}

/* ============================================================
   6. DEVICE 3D MOCKUP
   CSS 3D perspective transform for the phone in the hero.
============================================================ */
.device-3d {
    transform: perspective(1200px) rotateY(-12deg) rotateX(4deg) rotateZ(-1deg);
    transition: transform 0.7s var(--ease-out-expo);
    transform-style: preserve-3d;
}

.device-3d:hover {
    transform: perspective(1200px) rotateY(-4deg) rotateX(1deg) rotateZ(0deg);
}

/* ============================================================
   7. CARD HOVER LIFT
   Applied to feature cards and testimonials.
============================================================ */
.card-lift {
    transition:
        transform 0.35s var(--ease-spring),
        box-shadow 0.35s ease;
}

.card-lift:hover {
    transform: translateY(-6px);
    box-shadow:
        0 24px 48px -12px rgba(0, 0, 0, 0.18),
        0 0 0 1px rgba(234, 88, 12, 0.08);
}

/* ============================================================
   8. SCROLL REVEAL ANIMATION
   Elements fade up when they enter the viewport.
   JavaScript adds/removes the .visible class.
============================================================ */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition:
        opacity  0.7s var(--ease-out-expo),
        transform 0.7s var(--ease-out-expo);
}

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

/* Staggered delay helpers */
.reveal.delay-1 { transition-delay: 0.1s; }
.reveal.delay-2 { transition-delay: 0.2s; }
.reveal.delay-3 { transition-delay: 0.3s; }
.reveal.delay-4 { transition-delay: 0.4s; }

/* ============================================================
   9. PROGRESS BARS
   Animated width fill triggered by IntersectionObserver.
============================================================ */
.progress-fill {
    width: 0;
    transition: width 1.4s var(--ease-out-expo);
}

/* ============================================================
   10. FAQ ACCORDION
   Max-height transition for smooth open/close.
============================================================ */
.faq-body {
    max-height: 0;
    overflow: hidden;
    transition:
        max-height 0.4s var(--ease-out-expo),
        padding    0.4s ease;
    padding-top: 0;
    padding-bottom: 0;
}

.faq-body.open {
    padding-top: 0;
    padding-bottom: 1.5rem;
}

/* Rotate chevron icon when FAQ is open */
.faq-toggle[aria-expanded="true"] .faq-chevron {
    transform: rotate(180deg);
}

/* ============================================================
   11. NOISE OVERLAY
   Subtle grain texture for depth on hero backgrounds.
============================================================ */
.noise::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.025;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.dark .noise::before {
    opacity: 0.04;
}

/* ============================================================
   12. BACKGROUND GRID
   Subtle dot/line grid for hero section depth.
============================================================ */
.bg-grid {
    background-image:
        linear-gradient(to right,  rgba(234, 88, 12, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(234, 88, 12, 0.04) 1px, transparent 1px);
    background-size: 64px 64px;
}

.dark .bg-grid {
    background-image:
        linear-gradient(to right,  rgba(234, 88, 12, 0.06) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(234, 88, 12, 0.06) 1px, transparent 1px);
}

/* ============================================================
   13. SCROLLBAR STYLING
============================================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.4);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(71, 85, 105, 0.6);
}

/* Hide scrollbar for overflow-x carousels */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* ============================================================
   14. BUTTON PRESS MICRO-INTERACTION
============================================================ */
.btn-press:active {
    transform: scale(0.96);
}

/* ============================================================
   15. REDUCED MOTION OVERRIDES
   Respect user OS preference for reduced motion.
============================================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration:        0.01ms !important;
        animation-iteration-count: 1      !important;
        transition-duration:       0.01ms !important;
        scroll-behavior:           auto   !important;
    }

    /* Keep reveal elements visible if motion is reduced */
    .reveal {
        opacity: 1;
        transform: none;
    }
}

/* ============================================================
   16. WAITLIST MODAL ANIMATION
============================================================ */
#waitlist-modal {
    animation: fadeIn 0.2s ease;
}

#waitlist-modal > div {
    animation: slideUp 0.3s var(--ease-spring);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

/* ============================================================
   17. NAVBAR SCROLLED STATE
   Added by JS when user scrolls past hero.
============================================================ */
#navbar.scrolled {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.dark #navbar.scrolled {
    background: rgba(2, 6, 23, 0.92);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}
