@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Poppins:wght@600;700;800&display=swap');

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

/* Bay Area Affiliates Design System - Black and Blue */

@layer base {
  :root {
    /* Base black system */
    --background: 0 0% 3%;           /* #080808 */
    --background-deep: 0 0% 1%;      /* #030303 */
    --foreground: 0 0% 98%;          /* Near white */
    --foreground-muted: 0 0% 80%;    /* Muted white */

    /* Cards and surfaces */
    --card: 0 0% 8%;
    --card-foreground: 0 0% 95%;
    --card-border: 220 20% 15%;

    /* Electric blue accent system */
    --neon: 220 100% 60%;            /* #3366ff */
    --neon-glow: 220 100% 70%;
    --neon-muted: 220 60% 45%;
    --neon-foreground: 0 0% 3%;      /* Dark text on blue */

    /* Interactive states */
    --primary: 220 100% 60%;         /* Electric blue */
    --primary-foreground: 0 0% 98%;
    --primary-hover: 220 100% 70%;

    --secondary: 220 20% 15%;
    --secondary-foreground: 0 0% 95%;
    --secondary-hover: 220 20% 20%;

    /* Muted and accent variants */
    --muted: 220 15% 12%;
    --muted-foreground: 0 0% 65%;

    --accent: 220 20% 15%;
    --accent-foreground: 0 0% 95%;

    /* Status colors */
    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 98%;

    --success: 142 76% 36%;
    --success-foreground: 0 0% 98%;

    /* Borders and inputs */
    --border: 220 15% 18%;
    --input: 220 15% 15%;
    --input-border: 220 20% 25%;
    --ring: 220 100% 60%;

    /* Radius system */
    --radius: 1.5rem;
    --radius-sm: 0.75rem;
    --radius-lg: 2rem;

    /* Grid and overlay */
    --grid-color: 220 15% 12%;
    --overlay: 0 0% 3% / 0.8;

    /* Animations and effects */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    
    /* Shadows and glows */
    --shadow-neon: 0 0 20px hsl(var(--neon) / 0.3);
    --shadow-neon-strong: 0 0 40px hsl(var(--neon) / 0.6);
    --shadow-card: 0 8px 32px hsl(180 75% 7% / 0.4);
  }
}

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

  body {
    @apply bg-background text-foreground font-body antialiased;
    font-feature-settings: "rlig" 1, "calt" 1;
  }

  html {
    scroll-behavior: smooth;
  }

  /* Accessibility: Focus visible styles */
  *:focus-visible {
    outline: 2px solid hsl(var(--neon));
    outline-offset: 3px;
    border-radius: 4px;
  }

  /* Skip link for keyboard navigation */
  .skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: hsl(var(--neon));
    color: hsl(var(--background));
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    font-weight: 600;
    border-radius: 0 0 8px 0;
  }

  .skip-link:focus {
    top: 0;
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }

  /* Screen reader only class */
  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
  }

  .sr-only:focus,
  .sr-only:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }
}

@layer components {
  /* Grid overlay */
  .grid-overlay {
    background-image: 
      linear-gradient(hsl(var(--grid-color)) 1px, transparent 1px),
      linear-gradient(90deg, hsl(var(--grid-color)) 1px, transparent 1px);
    background-size: 60px 60px;
    opacity: 0.4;
  }

  /* Neon glow effects */
  .neon-glow {
    box-shadow: var(--shadow-neon);
    transition: var(--transition-smooth);
  }

  .neon-glow:hover {
    box-shadow: var(--shadow-neon-strong);
  }

  /* Text glow */
  .text-glow {
    text-shadow: 0 0 10px hsl(var(--neon) / 0.5);
  }

  /* Parallax container */
  .parallax {
    transform: translateZ(0);
    will-change: transform;
  }

  /* Section pinning */
  .section-pin {
    position: sticky;
    top: 0;
    height: 100vh;
    overflow: hidden;
  }

  /* Button variants */
  .btn-neon {
    @apply bg-primary text-primary-foreground hover:bg-primary-hover;
    @apply rounded-[var(--radius)] px-8 py-4 font-semibold;
    @apply transition-all duration-300 ease-out;
    @apply shadow-[0_0_0_1px_hsl(var(--neon))] hover:shadow-[0_0_20px_hsl(var(--neon)/0.5)];
    position: relative;
    overflow: hidden;
  }

  .btn-neon::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
  }

  .btn-neon:hover::before {
    width: 300px;
    height: 300px;
  }

  .btn-ghost {
    @apply border border-border hover:border-neon text-foreground hover:text-neon;
    @apply rounded-[var(--radius)] px-8 py-4 font-semibold;
    @apply transition-all duration-300 ease-out;
    @apply hover:shadow-[0_0_15px_hsl(var(--neon)/0.3)];
    position: relative;
    overflow: hidden;
  }

  .btn-ghost::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(to right, transparent, hsl(var(--neon)), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease-out;
  }

  .btn-ghost:hover::after {
    transform: translateX(100%);
  }

  /* Card styles */
  .card-dark {
    @apply bg-card border border-card-border rounded-[var(--radius-lg)];
    @apply backdrop-blur-sm shadow-[var(--shadow-card)];
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .card-dark::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg,
      transparent 30%,
      hsl(var(--neon) / 0.1) 50%,
      transparent 70%);
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: -1;
  }

  .card-dark:hover::before {
    opacity: 1;
  }

  .card-dark:hover {
    transform: translateY(-4px);
    border-color: hsl(var(--neon) / 0.3);
  }

  /* Typography helpers */
  .text-balance {
    text-wrap: balance;
  }

  /* Smooth focus ring for better UX */
  .focus-ring {
    @apply focus:outline-none focus:ring-2 focus:ring-neon focus:ring-offset-2 focus:ring-offset-background;
    transition: all 0.2s ease;
  }

  /* Magnetic hover effect for interactive elements */
  .magnetic-hover {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .magnetic-hover:hover {
    transform: translateY(-2px);
  }

  /* Glassmorphism effect */
  .glass {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Shimmer effect for loading states */
  @keyframes shimmer {
    0% {
      transform: translateX(-100%);
    }
    100% {
      transform: translateX(100%);
    }
  }

  .shimmer {
    position: relative;
    overflow: hidden;
  }

  .shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
      90deg,
      transparent,
      rgba(51, 102, 255, 0.1),
      transparent
    );
    animation: shimmer 2s infinite;
  }
}