/* Shared global styles: keep this entire file byte-for-byte after the three
   Tailwind directives and blank line in src/styles/global.css, before global-only rules.
   public/styles/deferred.css is served as-is after first paint (see src/utils/deferred-css.ts),
   so this shared body MUST stay plain CSS with no Tailwind directives. Its `@layer`
   blocks are native cascade layers in the public copy and yield to unlayered rules
   (critical CSS, components). Google Fonts are preloaded in the head. */

/* Shared layout tokens: keep identical in critical-combined.css, critical/combined/critical-services.css,
   critical/combined/critical-smokeshop.css and global.css. Outer section wrappers use
   `width: var(--site-container); margin-inline: auto`. */
:root{--site-gutter:1rem;--site-max:1400px;--site-container:min(100% - 2 * var(--site-gutter), var(--site-max));--header-h:73px}
@media (min-width:641px){:root{--site-gutter:2rem;--header-h:81px}}
@media (min-width:1024px){:root{--header-h:86px}}
@media (min-width:2560px){:root{--site-max:min(1920px, 72vw)}}

/* Design System v2 - Premium Typography & Colors */
@layer base {
  :root {
    /* Enhanced Color Palette */
    --color-text-primary: #333333;     /* Softer than pure black */
    --color-text-secondary: #666666;   /* For secondary text */
    --color-primary: #008080;          /* Teal for CTAs/links */
    --color-primary-dark: #006666;     /* Hover state */
    --color-primary-light: #00808015;  /* Very light teal backgrounds */
    --color-secondary: #D4AF37;        /* Gold accents */
    --color-success: #38A169;          /* For success states */
    --color-trust: #2B6CB0;            /* Trust badges */
    --color-surface: #FFFFFF;          /* Card/component backgrounds */
    --color-error: #EF4444;            /* Error states */
    
    /* Typography - Desktop Only (Mobile uses system) */
    --font-heading: 'Syne', -apple-system, sans-serif;
    --font-body: 'Lato', -apple-system, sans-serif;
    
    /* Font Sizes */
    --text-h1: 3.5rem;     /* 56px */
    --text-h2: 2.5rem;     /* 40px */
    --text-h3: 2rem;       /* 32px */
    --text-body: 1.125rem; /* 18px */
    --text-small: 0.875rem;/* 14px */
    
    /* Component Sizing */
    --btn-height: 3rem;        /* 48px */
    --btn-height-mobile: 3.5rem; /* 56px */
    --input-height: 3rem;      /* 48px */
    --touch-target: 48px;      /* Minimum touch size */
  }
}

/* Disable animations on mobile for better performance */
@media (max-width: 768px) {
  *, *::before, *::after {
    animation-duration: 0.1s !important;
    animation-delay: 0s !important;
    transition-duration: 0.1s !important;
    transition-delay: 0s !important;
  }
}

/* Test class to detect if global CSS is loaded */
.tw-test-loaded {
  display: none !important;
}

/* Skip link styles live in the critical bundles (and global.css for BaseLayout pages). */

/* Enhanced focus indicators - Updated with teal */
@layer base {
  :focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }
  
  /* Dark backgrounds need light focus */
  .dark-focus:focus-visible {
    outline-color: #fff;
  }
  
  /* Custom button focus */
  button:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }
  
  /* Form input focus */
  input:focus-visible,
  textarea:focus-visible,
  select:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 0;
    border-color: var(--color-primary);
  }
  
  /* Link focus */
  a:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 0.25rem;
  }
  
  /* Hide the outline for mouse focus only; keyboard focus keeps :focus-visible */
  *:focus:not(:focus-visible) {
    outline: none;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .aos-animate {
    transition-property: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  button,
  .btn {
    border: 2px solid currentColor !important;
  }
  
  a {
    text-decoration: underline !important;
  }
}

/* Typography utility classes - Desktop only */
@media (min-width: 769px) {
  .font-heading {
    font-family: var(--font-heading) !important;
  }
  
  .font-body {
    font-family: var(--font-body) !important;
  }
  
  /* Apply heading font to all headings by default.
     Colour is inherited so headings follow their section (the site is dark). */
  h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    color: inherit;
  }
  
  /* Apply body font to paragraphs and other text (colour inherits from the section) */
  body, p, li, td, th, label, input, textarea, select {
    font-family: var(--font-body);
  }
}

/* Text color utilities */
.text-primary {
  color: var(--color-text-primary) !important;
}

.text-secondary {
  color: var(--color-text-secondary) !important;
}

.text-teal {
  color: var(--color-primary) !important;
}

.text-gold {
  color: var(--color-secondary) !important;
}

/* Mobile Navigation Padding & Overflow Protection.
   `clip` (not `hidden`) keeps body from becoming a scroll container, so the
   sticky header keeps working; 100% (not 100vw) avoids scrollbar-width overflow. */
@media (max-width: 768px) {
  body {
    padding-bottom: calc(4rem + env(safe-area-inset-bottom));
    overflow-x: clip !important;
    max-width: 100% !important;
    position: relative;
  }
  
  /* Ensure main content doesn't overflow */
  main {
    overflow-x: clip;
    max-width: 100%;
  }
}

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

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 222.2 47.4% 11.2%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 222.2 84% 4.9%;
    --radius: 0.5rem;
    --chart-1: 12 76% 61%;
    --chart-2: 173 58% 39%;
    --chart-3: 197 37% 24%;
    --chart-4: 43 74% 66%;
    --chart-5: 27 87% 67%;
  }

  .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%;
    --chart-1: 220 70% 50%;
    --chart-2: 160 60% 45%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
  }
}

@layer base {
  /* Page background and default border colours come from the layouts and
     critical CSS; the design-system tokens above are only consumed via hsl(var(--…)). */
  body {
    color: var(--color-text-primary);
    /* Updated font stack with Lato */
    font-family: var(--font-body);
    font-display: swap;
    
    /* Mobile-first font optimization */
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    font-variant-ligatures: common-ligatures;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    /* Mobile text size adjustment */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    
    /* Prevent horizontal overscroll without blocking native vertical scrolling */
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
  }

  html {
    overflow-x: clip;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  #root {
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
  }

  h1, h2, h3, h4, h5, h6 {
    /* Premium heading font */
    font-family: var(--font-heading);
    line-height: 1.2;
    font-weight: 700;
    color: inherit;
  }
  
  @media (max-width: 768px) {
    /* Use system fonts on mobile for performance */
    h1, h2, h3, h4, h5, h6 {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    }
  }

  p, li, span {
    /* Optimal line height for reading on mobile */
    line-height: 1.6;
    /* Better word spacing for mobile */
    word-spacing: 0.05em;
  }

  /* Mobile-specific line heights */
  @media (max-width: 768px) {
    h1 {
      line-height: 1.1;
    }
    
    h2 {
      line-height: 1.2;
    }
    
    h3 {
      line-height: 1.3;
    }
    
    p, li, span {
      line-height: 1.6;
    }
  }
}

@layer components {
  .hover-scale {
    transition-property: transform;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 300ms;
  }

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

  .text-shadow {
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
  }



  .page-title {
    font-size: 1.875rem;
    font-weight: 300;
    line-height: 1.25;
    -webkit-font-smoothing: antialiased;
  }

  /* `.section-title` and `.artist-name` are also used by components that set their
     own type scale, so only rendering hints are global here (`.button-text` has none). */
  .section-title {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1;
    line-height: 1.2;
    letter-spacing: -0.01em;
  }

  .artist-name {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  .body-large {
    font-size: 1rem;
    line-height: 1.6;
  }

  .body-medium {
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.6;
  }

  .body-regular {
    font-size: 0.875rem;
    line-height: 1.6;
  }

  .cta-button-text {
    font-size: 1rem;
    line-height: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }

  /* Mobile-optimized utility classes */
  .caption-text {
    font-size: 0.75rem;
    line-height: 1rem;
    color: #4b5563;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  .small-text {
    font-size: 0.75rem;
    line-height: 1rem;
    color: #6b7280;
    font-family: 'Inter', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  .quote-text {
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    font-style: italic;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.6;
  }

  .number-large {
    font-size: 1.875rem;
    line-height: 2.25rem;
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "kern" 1;
  }

  /* Mobile Touch Target Sizes */
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }

  .mobile-button {
    min-height: 48px;
    min-width: 48px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  /* Mobile-Optimized Spacing */
  .section-padding {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }

  .container-padding {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  /* Responsive steps for the classes above (sm 640 / md 768 / lg 1024) */
  @media (min-width: 640px) {
    .caption-text {
      font-size: 0.875rem;
      line-height: 1.25rem;
    }

    .quote-text {
      font-size: 1.125rem;
      line-height: 1.75rem;
    }

    .number-large {
      font-size: 2.25rem;
      line-height: 2.5rem;
    }

    .section-padding {
      padding-top: 4rem;
      padding-bottom: 4rem;
    }

    .container-padding {
      padding-left: 1.5rem;
      padding-right: 1.5rem;
    }
  }

  @media (min-width: 768px) {
    .page-title {
      font-size: 3rem;
      line-height: 1;
    }

    .body-large,
    .body-medium,
    .cta-button-text {
      font-size: 1.125rem;
      line-height: 1.75rem;
    }

    .body-regular {
      font-size: 1rem;
      line-height: 1.5rem;
    }

    .quote-text {
      font-size: 1.25rem;
      line-height: 1.75rem;
    }

    .number-large {
      font-size: 3rem;
      line-height: 1;
    }

    .section-padding {
      padding-top: 5rem;
      padding-bottom: 5rem;
    }
  }

  @media (min-width: 1024px) {
    .quote-text {
      font-size: 1.5rem;
      line-height: 2rem;
    }

    .number-large {
      font-size: 3.75rem;
      line-height: 1;
    }

    .section-padding {
      padding-top: 6rem;
      padding-bottom: 6rem;
    }

    .container-padding {
      padding-left: 2rem;
      padding-right: 2rem;
    }
  }

  /* Typography controls for better text flow */
  .no-widows {
    orphans: 4;
    widows: 4;
    word-wrap: break-word;
    hyphens: none;
    text-wrap: pretty;
    hanging-punctuation: none;
    line-break: auto;
  }

  /* More aggressive widow prevention */
  .no-widows-strict {
    orphans: 5;
    widows: 5;
    word-wrap: break-word;
    hyphens: none;
    text-wrap: balance;
    text-rendering: optimizeLegibility;
    font-kerning: auto;
    text-size-adjust: 100%;
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
  }

  /* Floating Widget Specific Overrides */
  .floating-widgets-container svg {
    width: inherit !important;
    height: inherit !important;
    color: inherit !important;
    fill: currentColor !important;
  }

  /* Ensure lucide icons are properly styled */
  .lucide {
    width: inherit !important;
    height: inherit !important;
    color: currentColor !important;
    fill: currentColor !important;
    stroke: currentColor !important;
    stroke-width: 2 !important;
  }

  /* WhatsApp main button specific overrides */
  .whatsapp-main-icon {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px !important;
    min-height: 40px !important;
    max-width: 40px !important;
    max-height: 40px !important;
    color: white !important;
    fill: white !important;
  }

  @media (min-width: 640px) {
    .whatsapp-main-icon {
      width: 48px !important;
      height: 48px !important;
      min-width: 48px !important;
      min-height: 48px !important;
      max-width: 48px !important;
      max-height: 48px !important;
    }
  }

  /* Scroll to top arrow specific overrides */
  .scroll-arrow-icon {
    color: white !important;
    stroke: white !important;
    fill: none !important;
    stroke-width: 2.5 !important;
  }

  /* Ensure button contains the icons properly */
  button[aria-label*="WhatsApp"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  button[aria-label*="Back to top"],
  button[aria-label*="Volver al inicio"] {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* 3D Flip Card Utilities */
  .perspective-1000 {
    perspective: 1000px;
  }

  .preserve-3d {
    transform-style: preserve-3d;
  }

  .backface-hidden {
    backface-visibility: hidden;
  }

  .rotate-y-180 {
    transform: rotateY(180deg);
  }

  /* Artist Card Flip Animation - Improved */
  .artist-card-flip {
    transition: transform 1s ease-in-out;
    transform-style: preserve-3d;
    backface-visibility: hidden;
  }

  .artist-card-flip:hover {
    transform: rotateY(180deg);
  }

  .artist-card-flip.flipped {
    transform: rotateY(180deg);
  }

  /* Line clamp utility for text truncation */
  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  /* Hide scrollbars for horizontal scrolling galleries */
  .hide-scrollbar {
    -ms-overflow-style: none;  /* Internet Explorer 10+ */
    scrollbar-width: none;  /* Firefox */
  }
  .hide-scrollbar::-webkit-scrollbar { 
    display: none;  /* Safari and Chrome */
  }

  /* Mobile-specific hover behavior */
  @media (max-width: 768px) {
    /* Disable hover effects on mobile */
    .hover-scale:hover {
      transform: none;
    }
    
    .parallax-disabled {
      transform: none !important;
    }
  }

  /* Elfsight Google Reviews Widget Styles */
  .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 0 auto !important;
  }

  .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb iframe {
    width: 100% !important;
    height: auto !important;
  }

  @media (max-width: 768px) {
    .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb {
      padding: 0 16px !important;
    }
    
    .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb iframe {
      height: 400px !important;
    }
    
    .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb .eapps-google-reviews-review {
      font-size: 14px !important;
      line-height: 1.4 !important;
    }
  }

  @media (max-width: 480px) {
    .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb {
      padding: 0 12px !important;
    }
    
    .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb iframe {
      height: 350px !important;
    }
    
    .elfsight-app-dce00912-3469-43e5-a1b5-49ca2a4b38fb .eapps-google-reviews-review-text {
      font-size: 13px !important;
      line-height: 1.3 !important;
    }
  }


}

@layer utilities {
  /* Prevent horizontal overscroll without blocking native vertical scrolling */
  .prevent-overscroll {
    overscroll-behavior-x: none;
    overscroll-behavior-y: auto;
  }

  /* Text shadow utilities for better readability on images */
  .text-shadow-sm {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  }

  .text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  }

  .text-shadow-lg {
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  }

  /* Essential mobile utilities only */
  .mobile-padding {
    padding: 1rem;
  }

  @media (min-width: 768px) {
    .mobile-padding {
      padding: 1.5rem;
    }
  }

  /* Safe area utilities for mobile notches */
  .safe-top {
    padding-top: env(safe-area-inset-top);
  }

  .safe-bottom {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* Legacy decorative elements - consolidated above */

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

.animate-fade-in {
  animation: fadeIn 0.6s ease-out;
}

.animate-slide-in {
  animation: slideIn 0.6s ease-out;
}

.animate-bounce-custom {
  animation: bounce 2s infinite;
}

/* Touch-friendly hover states */
@media (hover: none) and (pointer: coarse) {
  /* Override hover states for touch devices */
  .hover-override:hover {
    transform: none;
  }
}

/* Fix image orientation issues - Respect EXIF data */
img {
  image-orientation: from-image;
}

/* Manual rotation utility classes for specific images if needed */
.rotate-fix-90 {
  transform: rotate(90deg);
}

.rotate-fix-180 {
  transform: rotate(180deg);
}

.rotate-fix-270 {
  transform: rotate(270deg);
}

.rotate-fix-neg-90 {
  transform: rotate(-90deg);
}

/* Performance: Hint browser to composite AOS animations */
[data-aos] {
  will-change: transform, opacity;
}
