@tailwind base;
@tailwind components;
@tailwind utilities;

/* --- BASE TYPOGRAPHY & SETTINGS --- */
body {
    background-color: #ffffff;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
.font-display {
    letter-spacing: -0.025em;
    /* Tight tracking for headers */
}

p,
.font-body {
    letter-spacing: -0.01em;
    /* Subtle tightening for body text */
}

/* --- PREMIUM GLASSMORPHISM SYSTEM (v2) --- */
.glass-nav {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .glass-nav {
    background: rgba(0, 0, 0, 0.6);
    /* Cleaner look in dark mode */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-premium {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.02),
        0 2px 4px -1px rgba(0, 0, 0, 0.02),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    /* Inner glow */
    backdrop-filter: blur(24px) saturate(180%);
    /* Heavier blur */
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.dark .glass-premium {
    background: rgba(15, 15, 15, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        inset 0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* --- HERO IMMERSION --- */
.hero-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, rgba(168, 85, 247, 0.05) 40%, transparent 70%);
    filter: blur(60px);
    z-index: 0;
    animation: pulseGlow 8s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.1) translate(20px, -20px);
        opacity: 0.8;
    }
}

/* --- MICRO-INTERACTIONS & PHYSICS --- */
.btn-juice {
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    /* Physics curve */
    position: relative;
    overflow: hidden;
}

.btn-juice:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 12px 30px -8px rgba(59, 130, 246, 0.5);
    /* Vibrant glow */
    filter: brightness(1.05);
    /* Brightness boost */
}

.btn-juice:active {
    appearance: none;
    -webkit-appearance: none;
    transform: translateY(0) scale(0.96);
    /* Satisfying click press */
    box-shadow: 0 4px 12px -4px rgba(59, 130, 246, 0.3);
}

/* --- SCROLL REVEAL (Staggered Children) --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Staggered text reveal */
.stagger-text span {
    display: inline-block;
    opacity: 0;
    transform: translateY(10px);
    animation: staggerFadeUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.bento-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 28px;
    /* Smooth corners */
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

.dark .bento-card {
    background: rgba(10, 10, 10, 0.8);
    border-color: rgba(255, 255, 255, 0.08);
    /* Fainter border */
    box-shadow: none;
}

.bento-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.08);
}

.dark .bento-card:hover {
    box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.15);
}

/* Hover Glows per Package */
.border-glow-blue:hover {
    border-color: rgba(59, 130, 246, 0.4);
}

.border-glow-orange:hover {
    border-color: rgba(249, 115, 22, 0.4);
}

.border-glow-purple:hover {
    border-color: rgba(168, 85, 247, 0.4);
}

.border-glow-green:hover {
    border-color: rgba(34, 197, 94, 0.4);
}

/* --- UTILITIES --- */
.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

.scrollbar-hide {
    -ms-overflow-style: none;
    /* IE and Edge */
    scrollbar-width: none;
    /* Firefox */
}


/* --- OTHER UTILS --- */
.gradient-text {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(135deg, #1d1d1f 0%, #434344 100%);
}

.dark .gradient-text {
    background-image: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
}

/* Toggle Switch */
.toggle-container {
    background: #f5f5f7;
    border-radius: 999px;
    padding: 4px;
    display: inline-flex;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.dark .toggle-container {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.05);
}

.toggle-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    background: white;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    z-index: 1;
}

.toggle-btn {
    position: relative;
    z-index: 2;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    transition: color 0.3s;
    min-width: 140px;
    text-align: center;
}

.toggle-btn.active {
    color: #1d1d1f;
    font-weight: 600;
}

.dark .toggle-btn.active {
    color: #fff;
}

.matrix-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    align-items: center;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.dark .matrix-row {
    border-color: rgba(255, 255, 255, 0.05);
}

/* Range Slider */
input[type=range] {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    margin-top: -10px;
    transition: transform 0.2s cubic-bezier(0.3, 3, 0.5, 1);
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Animations */
.fade-up {
    animation: fadeUp 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Menu */
#mobile-menu {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#mobile-menu.mobile-menu-open {
    opacity: 1;
    pointer-events: auto;
}

#mobile-menu .mobile-menu-panel {
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}

#mobile-menu.mobile-menu-open .mobile-menu-panel {
    transform: translateX(0);
}

/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #1a1a1a 50%, #2a2a2a 75%);
}

/* Mobile Adjustments for Matrix */
@media (max-width: 768px) {
    .matrix-row {
        grid-template-columns: 1fr;
        gap: 8px;
        text-align: left;
        padding: 16px;
    }

    .matrix-header {
        display: none;
    }
}

/* --- BASE TYPOGRAPHY & SETTINGS --- */
body {
    background-color: #ffffff;
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

h1,
h2,
h3,
h4,
.font-display {
    letter-spacing: -0.025em;
    /* Apple-style tight tracking */
}

/* --- PREMIUM GLASSMORPHISM SYSTEM --- */
.glass-nav {
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.dark .glass-nav {
    background: rgba(20, 20, 23, 0.72);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-premium {
    background: rgba(255, 255, 255, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.02),
        0 2px 4px -1px rgba(0, 0, 0, 0.02),
        0 0 0 1px rgba(255, 255, 255, 0.5) inset;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.dark .glass-premium {
    background: rgba(8, 8, 8, 0.85);
    /* Deep OLED Black */
    border: 1px solid rgba(255, 255, 255, 0.12);
    /* Sharper border */
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

/* --- MICRO-INTERACTIONS & JUICE --- */
.btn-juice {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-juice:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4);
}

.btn-juice:active {
    transform: translateY(0) scale(0.98);
}

.btn-juice::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
}

.btn-juice:hover::after {
    left: 100%;
    transition: 0.7s;
}

/* --- SCROLL REVEAL --- */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

/* --- STAGGERED ENTRANCE --- */
.stagger-enter>* {
    opacity: 0;
    transform: translateY(20px);
    animation: staggerFadeUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.stagger-enter>*:nth-child(1) {
    animation-delay: 0.1s;
}

.stagger-enter>*:nth-child(2) {
    animation-delay: 0.2s;
}

.stagger-enter>*:nth-child(3) {
    animation-delay: 0.3s;
}

.stagger-enter>*:nth-child(4) {
    animation-delay: 0.4s;
}

.stagger-enter>*:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes staggerFadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- BENTO CARDS & GLOWS --- */
.bento-card {
    background: #fbfbfd;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 24px;
    transition: all 0.4s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    overflow: hidden;
}

.dark .bento-card {
    background: rgba(10, 10, 10, 0.8);
    border-color: rgba(255, 255, 255, 0.12);
}

.bento-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.08);
}

/* Hover Glows per Package */
.border-glow-blue:hover {
    border-color: rgba(59, 130, 246, 0.5);
    box-shadow: 0 10px 40px -10px rgba(59, 130, 246, 0.3);
}

.border-glow-orange:hover {
    border-color: rgba(249, 115, 22, 0.5);
    box-shadow: 0 10px 40px -10px rgba(249, 115, 22, 0.3);
}

.border-glow-purple:hover {
    border-color: rgba(168, 85, 247, 0.5);
    box-shadow: 0 10px 40px -10px rgba(168, 85, 247, 0.3);
}

.border-glow-green:hover {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 10px 40px -10px rgba(34, 197, 94, 0.3);
}

/* --- OTHER UTILS --- */
.gradient-text {
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    background-image: linear-gradient(135deg, #1d1d1f 0%, #434344 100%);
}

.dark .gradient-text {
    background-image: linear-gradient(135deg, #ffffff 0%, #a1a1aa 100%);
}

/* Original styles retained/merged below */
.toggle-container {
    background: #f5f5f7;
    border-radius: 999px;
    padding: 4px;
    display: inline-flex;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.04);
}

.dark .toggle-container {
    background: rgba(255, 255, 255, 0.1);
}

.toggle-bg {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    width: calc(50% - 4px);
    background: white;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    /* Apple softer shadow */
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

.toggle-btn {
    position: relative;
    z-index: 2;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    transition: color 0.3s;
    min-width: 140px;
    text-align: center;
}

.toggle-btn.active {
    color: #1d1d1f;
    font-weight: 600;
}

.dark .toggle-btn.active {
    color: #fff;
}

/* Matrix Table */
.matrix-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.dark .matrix-row {
    border-color: rgba(255, 255, 255, 0.05);
}

/* Range Slider */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: #ffffff;
    border: 0.5px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15), 0 0 0 1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    margin-top: -10px;
    transition: transform 0.2s cubic-bezier(0.3, 3, 0.5, 1);
    /* Bouncy */
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

/* Animation Utils */
.fade-up {
    animation: fadeUp 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Menu */
#mobile-menu {
    transition: opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}

#mobile-menu.mobile-menu-open {
    opacity: 1;
    pointer-events: auto;
}

#mobile-menu .mobile-menu-panel {
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu.mobile-menu-open .mobile-menu-panel {
    transform: translateX(0);
}

/* --- MOBILE MENU BUTTON --- */
.mobile-menu-btn {
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 60;
}

.mobile-menu-btn span {
    width: 24px;
    height: 2px;
    background-color: #1d1d1f;
    border-radius: 10px;
    transition: all 0.3s linear;
    position: relative;
    transform-origin: 1px;
}

.dark .mobile-menu-btn span {
    background-color: #ffffff;
}


/* Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

.dark .skeleton {
    background: linear-gradient(90deg, #2a2a2a 25%, #1a1a1a 50%, #2a2a2a 75%);
}

/* --- FINAL POLISH ANIMATIONS --- */
@keyframes shine {
    100% {
        transform: translateX(100%) skewX(-20deg);
    }
}

.animate-shine {
    animation: shine 3s infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) translateX(0);
        opacity: 0.3;
    }

    50% {
        transform: translateY(-20px) translateX(10px);
        opacity: 0.6;
    }
}

.animate-float {
    animation: float 6s ease-in-out infinite;
}

.animation-delay-1000 {
    animation-delay: 1s;
}

.animation-delay-2000 {
    animation-delay: 2s;
}

.animation-delay-3000 {
    animation-delay: 3s;
}

/* Custom bento hover for dark mode consistency */
.dark .bento-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}