/* Quicksand font is preloaded in index.html - no @import needed */

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

/* Definition of the design system. All colors, gradients, fonts, etc should be defined here. 
All colors MUST be HSL.
*/

@layer base {
  :root {
    /* Base Foundation Colors - Light Canvas */
    --background: 210 20% 98%; /* #F8F9FA */
    --foreground: 210 29% 24%; /* #2D3748 - Primary Ink */

    --card: 210 20% 98%;
    --card-foreground: 210 29% 24%;

    --popover: 210 20% 98%;
    --popover-foreground: 210 29% 24%;

    /* Brand Primary - Creator Red */
    --primary: 0 84% 60%; /* #EF4444 - Vibrant Creator Red */
    --primary-foreground: 210 20% 98%;

    --secondary: 214 15% 91%;
    --secondary-foreground: 210 29% 24%;

    --muted: 214 15% 91%;
    --muted-foreground: 214 15% 69%; /* #A0AEC0 - Subtle Grey */

    --accent: 214 15% 91%;
    --accent-foreground: 210 29% 24%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 210 20% 98%;

    --border: 214 15% 85%;
    --input: 214 15% 85%;
    --ring: 235 77% 59%;

    --radius: 0.5rem;

    /* Tenant-Specific Accent Colors */
    --creator-primary: 0 84% 60%; /* #EF4444 - Vibrant Coral */
    --creator-primary-foreground: 210 20% 98%;
    
    --business-primary: 160 84% 39%; /* #10B981 - Growth Green */
    --business-primary-foreground: 210 20% 98%;
    
    --social-ai-primary: 258 90% 66%; /* #8B5CF6 - Cosmic Violet */
    --social-ai-primary-foreground: 210 20% 98%;

    /* Sidebar with Primary Brand Color */
    --sidebar-background: 210 20% 98%;
    --sidebar-foreground: 210 29% 24%;
    --sidebar-primary: 235 77% 59%;
    --sidebar-primary-foreground: 210 20% 98%;
    --sidebar-accent: 214 15% 91%;
    --sidebar-accent-foreground: 210 29% 24%;
    --sidebar-border: 214 15% 85%;
    --sidebar-ring: 235 77% 59%;
  }

  .dark {
    /* Base Foundation Colors - Deep Space */
    --background: 220 35% 13%; /* #121826 */
    --foreground: 210 20% 98%;

    --card: 220 35% 13%;
    --card-foreground: 210 20% 98%;

    --popover: 220 35% 13%;
    --popover-foreground: 210 20% 98%;

    /* Brand Primary - Creator Red (same in dark) */
    --primary: 0 84% 60%; /* #EF4444 - Vibrant Creator Red */
    --primary-foreground: 220 35% 13%;

    --secondary: 220 25% 20%;
    --secondary-foreground: 210 20% 98%;

    --muted: 220 25% 20%;
    --muted-foreground: 214 15% 69%; /* Subtle Grey - same in dark */

    --accent: 220 25% 20%;
    --accent-foreground: 210 20% 98%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 210 20% 98%;

    --border: 220 25% 25%;
    --input: 220 25% 25%;
    --ring: 235 77% 59%;

    /* Tenant Colors - same in dark mode */
    --creator-primary: 0 84% 60%; /* #EF4444 */
    --creator-primary-foreground: 220 35% 13%;
    
    --business-primary: 160 84% 39%; /* #10B981 */
    --business-primary-foreground: 220 35% 13%;
    
    --social-ai-primary: 258 90% 66%; /* #8B5CF6 */
    --social-ai-primary-foreground: 220 35% 13%;

    /* Dark Sidebar */
    --sidebar-background: 220 35% 13%;
    --sidebar-foreground: 210 20% 98%;
    --sidebar-primary: 235 77% 59%;
    --sidebar-primary-foreground: 220 35% 13%;
    --sidebar-accent: 220 25% 20%;
    --sidebar-accent-foreground: 210 20% 98%;
    --sidebar-border: 220 25% 25%;
    --sidebar-ring: 235 77% 59%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
  }

  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }
}

/* Animation Utilities */
.animate-fade-in {
  animation: fade-in 0.6s ease-out;
}

.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.delay-300 { animation-delay: 0.3s; }
.delay-500 { animation-delay: 0.5s; }
.delay-1000 { animation-delay: 1s; }

/* Glass morphism utilities */
.backdrop-blur-xl {
  backdrop-filter: blur(24px);
}

/* Hover scale animation */
.hover-scale {
  transition: transform 0.2s ease-out;
}

.hover-scale:hover {
  transform: scale(1.05);
}

/* Book Cover 3D Styles (moved from component for better performance) */
.book-cover-wrapper {
  --book-height: 240px;
}

@media (min-width: 768px) {
  .book-cover-wrapper {
    --book-height: 280px;
  }
}

@media (min-width: 1024px) {
  .book-cover-wrapper {
    --book-height: 320px;
  }
}

.book-cover-3d {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: scale(1);
  transition: transform 0.2s ease-out, box-shadow 0.2s ease-out;
  border-radius: 4px;
}

.book-cover-3d:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

@media (max-width: 768px) {
  .book-cover-3d:hover {
    transform: translateY(-2px) scale(1.01);
  }
}

/* Content visibility for offscreen optimization */
.content-visibility-auto {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}

/* Defer rendering of below-the-fold sections for better LCP */
main > section:not(:first-of-type),
.below-fold-section {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}

/* CSS Containment to prevent CLS cascade between sections */
main > section {
  contain: layout style;
}

/* Prevent forced reflow in carousels */
[data-embla-container] {
  contain: layout style;
  will-change: transform;
}

/* Infinite Book Carousel Styles (moved from component for better performance) */
.carousel-track-container {
  overflow: hidden;
  position: relative;
  width: 100%;
}

.carousel-track {
  display: flex;
  gap: 2rem;
  min-width: max-content;
  padding: 0 50vw;
  contain: layout style paint;
  will-change: transform;
  animation-play-state: paused;
}

.carousel-track.animate {
  animation: scroll 20s linear infinite;
  animation-play-state: running;
}

.carousel-track:hover {
  animation-play-state: paused;
}

@media (max-width: 768px) {
  .carousel-track.animate {
    animation: scroll 25s linear infinite;
  }
  
  .carousel-track {
    gap: 1.5rem;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .carousel-track.animate {
    animation: scroll 22s linear infinite;
  }
}

@keyframes scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-33.33%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .carousel-track {
    animation: none;
  }
}

/* ===== CUSTOM SLIDER STYLES ===== */
.slider-thumb {
  background: linear-gradient(to right, hsl(var(--primary)), hsl(var(--accent)));
}

.slider-thumb::-webkit-slider-thumb {
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--accent)));
  cursor: pointer;
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.3);
  transition: all 0.2s ease;
}

.slider-thumb::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px hsl(var(--primary) / 0.4);
}

.slider-thumb::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--accent)));
  cursor: pointer;
  box-shadow: 0 4px 12px hsl(var(--primary) / 0.3);
  border: none;
  transition: all 0.2s ease;
}

.slider-thumb::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px hsl(var(--primary) / 0.4);
}

/* ===== EMBLA CAROUSEL OPTIMIZATION ===== */
.embla__container {
  will-change: transform;
}

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