/* Self-hosted font subsets via fontsource (only required weights) */
/* Limit font subsets to latin only to reduce font payload */
@import "@fontsource/inter/latin-400.css";
@import "@fontsource/inter/latin-500.css";
@import "@fontsource/poppins/latin-600.css";
@import "@fontsource/poppins/latin-700.css";

@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 {
    /* Brand Colors */
  --brand-primary: 39 93% 52%; /* Darkened a bit for contrast */
  --brand-primary-foreground: 0 0% 11%; /* Dark text for accessibility */
    
    /* Neutral Palette */
    --background: 0 0% 100%; /* White */
    --surface: 240 9% 97%; /* #F7F7F9 - Light gray */
    --foreground: 0 0% 11%; /* #1C1C1C - Text black */
    --muted-foreground: 220 9% 40%; /* #636974 - Higher contrast gray */

    /* Semantic Colors */
    --card: 0 0% 100%;
    --card-foreground: 0 0% 11%;

    --popover: 0 0% 100%;
    --popover-foreground: 0 0% 11%;

    --primary: 39 93% 56%; /* Brand primary */
    --primary-foreground: 0 0% 100%;

    --secondary: 240 9% 97%; /* Light surface */
    --secondary-foreground: 0 0% 11%;

    --muted: 240 9% 97%;
    --muted-foreground: 220 9% 40%;

    --accent: 39 93% 56%;
    --accent-foreground: 0 0% 100%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 100%;

    --border: 220 13% 91%;
    --input: 220 13% 91%;
    --ring: 39 93% 56%;

    --radius: 0.75rem;

    --sidebar-background: 0 0% 98%;

    --sidebar-foreground: 240 5.3% 26.1%;

    --sidebar-primary: 240 5.9% 10%;

    --sidebar-primary-foreground: 0 0% 98%;

    --sidebar-accent: 240 4.8% 95.9%;

    --sidebar-accent-foreground: 240 5.9% 10%;

    --sidebar-border: 220 13% 91%;

    --sidebar-ring: 217.2 91.2% 59.8%;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;

    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;

    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;

    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;

    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;

    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;

    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 224.3 76.3% 48%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }
}

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

  html {
    /* Evita que el header sticky tape el tope real */
    scroll-padding-top: 64px; /* h-16 del Navbar */
    scroll-behavior: smooth;  /* navegación más fluida */
  }

  body {
    @apply bg-background text-foreground font-inter;
  }
  
  h1, h2, h3, h4, h5, h6 {
    @apply font-poppins;
  }

  /* Anclas internas no quedan ocultas por header sticky */
  [id] { 
    scroll-margin-top: 64px; 
  }
}

@layer components {
  /* Hero Text Styles */
  .hero-title {
    @apply text-4xl md:text-5xl lg:text-6xl font-bold font-poppins text-foreground leading-tight;
  }
  
  .hero-subtitle {
    @apply text-lg md:text-xl text-muted-foreground font-inter max-w-2xl mx-auto;
  }
  
  /* Section Styles */
  .section-padding {
    @apply py-16 md:py-24;
  }
  
  .container-padding {
    @apply px-4 md:px-6 lg:px-8;
  }
  
  /* Gradient Overlays */
  .gradient-overlay {
    @apply absolute inset-0 bg-gradient-to-r from-black/60 to-black/40;
  }
  
  /* Section rhythm for service pages */
  .section-hero { padding: 48px 0 16px; }
  .section-body { padding: 24px 0; }
  .card-aside { @apply rounded-xl border border-border bg-card shadow-sm; }
  
  /* Hero media with reserved size to prevent CLS */
  .hero-media { min-height: 360px; }
  .hero-media img, .hero-media picture { 
    border-radius: 16px; 
    box-shadow: 0 10px 30px rgba(0,0,0,.08);
  }
  
  /* Kicker text styling */
  .kicker {
    font-size: .85rem;
    color: #7a7a7a;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  
  /* Header styles */
  .h1 {
    @apply text-4xl md:text-5xl font-bold font-poppins text-foreground leading-tight;
  }
  
  /* Animations */
  .fade-up {
    animation: fadeUp 0.6s ease-out forwards;
  }

  /* Defer rendering cost of below-the-fold (or non-critical immediate) sections */
  .deferred-section {
    content-visibility: auto;
    contain-intrinsic-size: 800px 1000px; /* Reserve space to prevent layout shifts */
  }
  
  @keyframes fadeUp {
    from {
      opacity: 0;
      transform: translateY(30px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }
}

