/* ============================================
   REFINEDER AI — Custom Styles
   ============================================ */

/* ---- CSS Variables ---- */
:root {
    --color-bg: #0d0e10;
    --color-surface: #18191d;
    --color-border: #2a2b30;
    --color-text: #ffffff;
    --color-text-muted: #9fa1a8;
    --color-primary: #3b8eff;
    --color-accent: #22c96e;
}

/* ---- Base Resets ---- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection {
    background: rgba(59, 142, 255, 0.3);
    color: #fff;
}

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

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

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

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

/* ============================================
   LIGHT THEME OVERRIDES
   ============================================ */
html:not(.dark) body {
    background: #f8f9fb;
    color: #18191d;
}

html:not(.dark) #navbar {
    border-bottom-color: #e2e3e5;
}

html:not(.dark) .nav-link {
    color: #60636b !important;
}

html:not(.dark) .nav-link:hover {
    color: #18191d !important;
}

html:not(.dark) .logo-img {
    filter: invert(1);
}

html:not(.dark) h1,
html:not(.dark) h2,
html:not(.dark) h3,
html:not(.dark) h4,
html:not(.dark) .text-white {
    color: #18191d !important;
}

html:not(.dark) .text-dark-300,
html:not(.dark) .text-dark-400 {
    color: #60636b !important;
}

html:not(.dark) .text-dark-500 {
    color: #7b7d86 !important;
}

html:not(.dark) .bg-dark-900\/50,
html:not(.dark) .bg-dark-900\/80,
html:not(.dark) .bg-dark-900\/60 {
    background: rgba(255, 255, 255, 0.8) !important;
}

html:not(.dark) .bg-dark-900\/30 {
    background: rgba(255, 255, 255, 0.4) !important;
}

html:not(.dark) .bg-dark-800\/50 {
    background: rgba(226, 227, 229, 0.5) !important;
}

html:not(.dark) .bg-dark-800 {
    background: #e2e3e5 !important;
}

html:not(.dark) .border-dark-700\/50 {
    border-color: rgba(196, 197, 202, 0.5) !important;
}

html:not(.dark) .border-dark-800\/50 {
    border-color: rgba(226, 227, 229, 0.5) !important;
}

html:not(.dark) .border-dark-600 {
    border-color: #c4c5ca !important;
}

html:not(.dark) section {
    color: #18191d;
}

html:not(.dark) .hero-grid {
    opacity: 0.03 !important;
}

html:not(.dark) .hero-orb-1 {
    background: rgba(59, 142, 255, 0.08) !important;
}

html:not(.dark) .hero-orb-2 {
    background: rgba(34, 201, 110, 0.06) !important;
}

html:not(.dark) .hero-orb-3 {
    background: rgba(139, 92, 246, 0.06) !important;
}

html:not(.dark) pre,
html:not(.dark) code {
    background: rgba(0, 0, 0, 0.03);
}

html:not(.dark) .bg-dark-950 {
    background: #f8f9fb !important;
}

html:not(.dark) footer {
    background: #f0f1f3;
}

html:not(.dark) .particle {
    background: rgba(59, 142, 255, 0.15) !important;
}

/* Light theme gradient backgrounds */
html:not(.dark) .bg-gradient-to-b {
    --tw-gradient-from: #f8f9fb !important;
    --tw-gradient-to: #f8f9fb !important;
}

html:not(.dark) ::-webkit-scrollbar-track {
    background: #f8f9fb;
}

html:not(.dark) ::-webkit-scrollbar-thumb {
    background: #c4c5ca;
}

/* ============================================
   NAVBAR
   ============================================ */
#navbar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    background: rgba(13, 14, 16, 0.6);
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

#navbar.scrolled {
    background: rgba(13, 14, 16, 0.9);
    border-bottom-color: rgba(42, 43, 48, 0.5);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

html:not(.dark) #navbar {
    background: rgba(248, 249, 251, 0.7);
}

html:not(.dark) #navbar.scrolled {
    background: rgba(248, 249, 251, 0.92);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.06);
}

/* ============================================
   HERO SECTION
   ============================================ */

/* Gradient Orbs */
.hero-gradient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 8s ease-in-out infinite;
}

.hero-orb-1 {
    width: 500px;
    height: 500px;
    background: rgba(59, 142, 255, 0.12);
    top: -10%;
    right: -5%;
    animation-delay: 0s;
}

.hero-orb-2 {
    width: 400px;
    height: 400px;
    background: rgba(34, 201, 110, 0.08);
    bottom: 10%;
    left: -10%;
    animation-delay: 2s;
}

.hero-orb-3 {
    width: 300px;
    height: 300px;
    background: rgba(139, 92, 246, 0.08);
    top: 30%;
    left: 40%;
    animation-delay: 4s;
}

/* Hero Grid Pattern */
.hero-grid {
    background-image:
        linear-gradient(rgba(59, 142, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(59, 142, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.5;
    mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black, transparent);
}

/* Hero Gradient Text */
.hero-gradient-text {
    background: linear-gradient(135deg, #3b8eff 0%, #22c96e 50%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% 200%;
    animation: gradient-shift 6s ease infinite;
}

.hero-gradient-text-green {
    background: linear-gradient(135deg, #22c96e 0%, #3b8eff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-gradient-text-yellow {
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-gradient-text-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-gradient-text-cyan {
    background: linear-gradient(135deg, #06b6d4 0%, #3b8eff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   ANIMATIONS
   ============================================ */

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-10px) translateX(-10px); }
    75% { transform: translateY(-25px) translateX(5px); }
}

@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-down {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(59, 142, 255, 0.1);
    }
    50% {
        box-shadow: 0 0 40px rgba(59, 142, 255, 0.2);
    }
}

@keyframes score-fill {
    from {
        stroke-dashoffset: 251.2;
    }
    to {
        stroke-dashoffset: 20;
    }
}

/* Animate classes */
.animate-fade-in {
    animation: fade-in 0.8s ease-out forwards;
}

.animate-slide-up {
    animation: slide-up 0.6s ease-out forwards;
}

/* ============================================
   SCROLL REVEAL
   ============================================ */
.scroll-reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: var(--delay, 0s);
}

.scroll-reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   PARTICLES
   ============================================ */
.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: rgba(59, 142, 255, 0.3);
    border-radius: 50%;
    pointer-events: none;
    animation: particle-float linear infinite;
}

@keyframes particle-float {
    0% {
        transform: translateY(100vh) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100px) translateX(50px);
        opacity: 0;
    }
}

/* ============================================
   FEATURE CARDS
   ============================================ */
.feature-card > div {
    position: relative;
    overflow: hidden;
}

.feature-card > div::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 142, 255, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.feature-card:hover > div::before {
    opacity: 1;
}

.feature-card > div::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(59, 142, 255, 0.04), transparent 40%);
    pointer-events: none;
}

/* ============================================
   SEO SCORE CIRCLE
   ============================================ */
.score-circle {
    stroke-dashoffset: 251.2;
    transition: stroke-dashoffset 2s ease-out;
}

.score-circle.animate {
    stroke-dashoffset: 20;
}

/* ============================================
   SDK TABS
   ============================================ */
.sdk-tab {
    color: #7b7d86;
    border-bottom: 2px solid transparent;
    cursor: pointer;
}

.sdk-tab:hover {
    color: #c4c5ca;
}

.sdk-tab.active {
    color: #3b8eff;
    border-bottom-color: #3b8eff;
}

html:not(.dark) .sdk-tab {
    color: #7b7d86;
}

html:not(.dark) .sdk-tab.active {
    color: #1455e1;
    border-bottom-color: #1455e1;
}

/* ============================================
   THEME TOGGLE ICONS
   ============================================ */
.dark .theme-icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.dark .theme-icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

html:not(.dark) .theme-icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

html:not(.dark) .theme-icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

html:not(.dark) #theme-toggle {
    background: rgba(226, 227, 229, 0.5);
    border-color: rgba(196, 197, 202, 0.5);
}

html:not(.dark) #mobile-menu-btn {
    background: rgba(226, 227, 229, 0.5);
    border-color: rgba(196, 197, 202, 0.5);
    color: #18191d;
}

html:not(.dark) #mobile-menu {
    background: rgba(248, 249, 251, 0.95) !important;
}

html:not(.dark) #mobile-menu a {
    color: #60636b;
}

html:not(.dark) #mobile-menu a:hover {
    color: #18191d;
}

/* ============================================
   MOBILE MENU ANIMATION
   ============================================ */
.mobile-menu-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s ease;
    opacity: 0;
}

.mobile-menu-container.open {
    max-height: 500px;
    opacity: 1;
}

/* ============================================
   CODE SCROLL (mobile-friendly scrollbar)
   ============================================ */
.code-scroll {
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(59, 142, 255, 0.2) transparent;
}

.code-scroll::-webkit-scrollbar {
    height: 4px;
}

.code-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.code-scroll::-webkit-scrollbar-thumb {
    background: rgba(59, 142, 255, 0.2);
    border-radius: 4px;
}

/* ============================================
   RESPONSIVE FINE-TUNING
   ============================================ */

/* Extra small screens (< 380px) */
@media (max-width: 380px) {
    pre, code {
        font-size: 0.625rem !important;
    }

    h1 {
        font-size: 1.6rem !important;
    }

    .hero-gradient-orb {
        opacity: 0.2;
    }
}

/* Small screens (< 640px) */
@media (max-width: 640px) {
    pre {
        font-size: 0.6875rem;
    }

    .hero-gradient-orb {
        opacity: 0.3;
    }

    .hero-orb-1 {
        width: 250px;
        height: 250px;
    }

    .hero-orb-2 {
        width: 200px;
        height: 200px;
    }

    .hero-orb-3 {
        width: 150px;
        height: 150px;
    }

    /* Reduce section gaps on mobile */
    section {
        scroll-margin-top: 56px;
    }

    /* Tighter scroll reveal for mobile */
    .scroll-reveal {
        transform: translateY(20px);
    }

    /* Feature cards - no hover lift on touch */
    .feature-card:hover > div {
        transform: none;
    }

    /* Better touch targets */
    a, button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Footer links - proper touch targets */
    footer ul li a {
        min-height: 36px;
    }
}

/* Tablet (641-1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    section {
        scroll-margin-top: 64px;
    }
}

/* ============================================
   COUNTER ANIMATION
   ============================================ */
.counter {
    display: inline-block;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   MOUSE FOLLOW GLOW ON FEATURES
   ============================================ */
.feature-card {
    perspective: 1000px;
}

.feature-card:hover > div {
    transform: translateY(-4px);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   ADDITIONAL LIGHT THEME TEXT ADJUSTMENTS
   ============================================ */
html:not(.dark) .hero-gradient-text,
html:not(.dark) .hero-gradient-text-green,
html:not(.dark) .hero-gradient-text-yellow,
html:not(.dark) .hero-gradient-text-purple,
html:not(.dark) .hero-gradient-text-cyan {
    filter: saturate(1.2) brightness(0.85);
}

html:not(.dark) .bg-primary-600\/10 {
    background: rgba(59, 142, 255, 0.08) !important;
}

html:not(.dark) .bg-accent-600\/10 {
    background: rgba(34, 201, 110, 0.08) !important;
}

/* Smooth transitions for theme switch */
body,
#navbar,
.feature-card > div,
.logo-img,
section,
footer,
a {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, filter 0.4s ease;
}
