/* =========================================
   KAGEBOT — RESPONSIVE SAAS DESIGN SYSTEM
   Apple-inspired minimalism + Full Mobile Support
   ========================================= */

:root {
    --bg-primary: #000000;
    --bg-surface: #0a0a0a;
    --bg-card: #111111;
    --border-subtle: #222222;
    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --accent-blue: #0071e3;
    --accent-blue-hover: #0077ed;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.5;
    min-width: 320px;
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: rgba(0, 113, 227, 0.3);
    color: var(--text-primary);
}

::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* =========================================
   RESPONSIVE TYPOGRAPHY
   ========================================= */
.font-display {
    font-family: 'Space Grotesk', -apple-system, sans-serif;
    letter-spacing: -0.02em;
}

/* =========================================
   HERO BOT ANIMATIONS
   ========================================= */
#hero-bot {
    filter: saturate(1.1);
    max-width: 100%;
    height: auto;
}

#ring-outer {
    animation: slow-rotate 20s linear infinite;
    transform-origin: center;
}

#ring-mid {
    animation: slow-rotate 15s linear infinite reverse;
    transform-origin: center;
}

#ring-inner {
    animation: slow-rotate 10s linear infinite;
    transform-origin: center;
}

#eye-l, #eye-r {
    animation: blink 4s ease-in-out infinite;
    transform-origin: center;
}

@keyframes slow-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes blink {
    0%, 96%, 100% { opacity: 0.9; transform: scaleY(1); }
    98% { opacity: 0.3; transform: scaleY(0.1); }
}

/* =========================================
   TERMINAL DEMO TYPING
   ========================================= */
.typing-text {
    border-right: 2px solid var(--accent-blue);
    animation: cursor-blink 1s step-end infinite;
    white-space: nowrap;
    overflow: hidden;
}

@keyframes cursor-blink {
    0%, 100% { border-color: var(--accent-blue); }
    50% { border-color: transparent; }
}

/* =========================================
   SCROLL REVEAL ANIMATIONS
   ========================================= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* =========================================
   CARD HOVER EFFECTS
   ========================================= */
.group:hover .group-hover\:translate-x-1 {
    transform: translateX(4px);
}

/* =========================================
   MOBILE-FIRST RESPONSIVE BREAKPOINTS
   ========================================= */

/* Small phones (320px - 480px) */
@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    .font-display {
        letter-spacing: -0.01em;
    }

    /* Letting clamp do the work, but ensuring bounds */
    h1.font-display {
        line-height: 1.05 !important;
    }

    /* Reduce padding on mobile */
    section {
        padding-top: 3.5rem !important;
        padding-bottom: 3.5rem !important;
    }

    /* Hero visual scaling - simpler on small screens */
    #hero-bot {
        transform: scale(0.85);
    }

    /* Floating stats bar - mobile optimized */
    .absolute.-bottom-6 {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        transform: none !important;
        margin-top: 2.5rem;
        padding: 1.25rem;
        gap: 0.5rem;
        width: 100% !important;
        background: var(--bg-card);
        border-radius: 1.5rem;
    }

    .absolute.-bottom-6 .text-xl,
    .absolute.-bottom-6 .text-2xl {
        font-size: 1.25rem !important;
    }

    /* Grid adjustments */
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* CTA section padding */
    .rounded-\[2\.5rem\], .rounded-\[2rem\] {
        padding: 2.5rem 1.5rem !important;
    }
}

/* Medium phones / Large phones (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    html {
        font-size: 15px;
    }

    h1.font-display {
        font-size: 3rem !important;
    }

    h2.font-display {
        font-size: 2rem !important;
    }

    section {
        padding-top: 5rem !important;
        padding-bottom: 5rem !important;
    }

    #hero-bot {
        transform: scale(0.8);
    }

    .absolute.-bottom-6 {
        padding: 1rem 1.5rem;
    }

    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    nav .hidden.md\:flex {
        display: none !important;
    }
}

/* Tablets (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    html {
        font-size: 15px;
    }

    h1.font-display {
        font-size: 4rem !important;
    }

    section {
        padding-top: 6rem !important;
        padding-bottom: 6rem !important;
    }

    .lg\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    .lg\:col-span-2 {
        grid-column: span 1 !important;
    }

    .order-2.lg\:order-1,
    .order-1.lg\:order-2 {
        order: 0 !important;
    }

    #hero-bot {
        transform: scale(0.9);
    }
}

/* Small laptops (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .max-w-\[1200px\] {
        max-width: 960px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .group:hover .group-hover\:translate-x-1 {
        transform: none;
    }

    button:hover {
        transform: none;
        box-shadow: none;
    }

    * {
        -webkit-tap-highlight-color: rgba(0, 113, 227, 0.1);
    }
}

/* Landscape mode on mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .min-h-screen {
        min-height: auto;
        padding-top: 6rem;
        padding-bottom: 3rem;
    }

    #hero-bot {
        transform: scale(0.6);
    }

    .absolute.-bottom-6 {
        position: relative;
        bottom: auto;
        margin-top: 1rem;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #ring-outer,
    #ring-mid,
    #ring-inner,
    #eye-l,
    #eye-r {
        animation: none;
    }

    .typing-text {
        border-right: none;
        animation: none;
    }
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }

    nav, footer, .fixed {
        display: none !important;
    }

    section {
        page-break-inside: avoid;
    }
}


/* =========================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================= */
@media (hover: none) and (pointer: coarse) {
    .group:hover .group-hover\:translate-x-1 {
        transform: none;
    }

    button:hover {
        transform: none;
        box-shadow: none;
    }

    * {
        -webkit-tap-highlight-color: rgba(0, 113, 227, 0.1);
    }

    /* Larger touch targets */
    a, button {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover backgrounds on touch */
    .group:hover .absolute.inset-0 {
        opacity: 0 !important;
    }
}