/* NOTE — the `x*` utilities and `--x-*` tokens in this file are duplicated in
 * `nuxt-x-affiliate` (`app/assets/css/main.css`), which was ported from here.
 * 32 class names overlap with identical values. A site extending BOTH layers
 * loads both stylesheets and gets whichever is injected last — harmless while
 * they match, a silent divergence if either is edited alone. Keep them in sync.
 *
 * Only `.xGlow-divider` / `.xGlow-divider-subtle` are unique to this file;
 * the affiliate layer draws that rule with `<XAFDividerGlow>` instead.
 */

@import "tailwindcss";
@import "@nuxt/ui";
@plugin "@tailwindcss/typography";

@layer utilities {
  .pt-24 {
    padding-top: 6rem;
  }

  /* ============================================
   * X MARKETING TYPOGRAPHY UTILITIES
   * From spec-prompt.md specification
   * ============================================ */

  /* Display - for heroes, major headings */
  .xText-display {
    font-size: clamp(3rem, 8vw, 6rem);
    line-height: 1.0;
    letter-spacing: -0.03em;
    font-weight: 700;
  }

  /* Headline - section titles */
  .xText-headline {
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.02em;
    font-weight: 600;
  }

  /* Title - card titles, smaller headings */
  .xText-title {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    line-height: 1.2;
    letter-spacing: -0.01em;
    font-weight: 600;
  }

  /* Body - paragraph text */
  .xText-body {
    font-size: 1.125rem;
    line-height: 1.7;
  }

  /* Small - captions, labels */
  .xText-small {
    font-size: 0.875rem;
    line-height: 1.5;
  }

  /* Eyebrow - section labels */
  .xText-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 500;
  }

  /* Balance long headlines */
  .xText-balance {
    text-wrap: balance;
  }

  /* Gradient text */
  .xText-gradient {
    background: linear-gradient(135deg, var(--color-primary-400), var(--color-primary-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* Legacy typography (kept for compatibility) */
  .text-hero {
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 0.9;
    letter-spacing: -0.02em;
  }

  .text-section-heading {
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
  }

  .text-eyebrow {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    font-weight: 600;
  }

  /* ============================================
   * X MARKETING SCROLL ANIMATIONS
   * ============================================ */

  /* xFadeUp - Global fade up on scroll */
  .xFadeUp {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .xFadeUp.is-visible {
    opacity: 1;
    transform: translateY(0);
    transition:
      opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 700ms cubic-bezier(0.16, 1, 0.3, 1),
      box-shadow 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Stagger children */
  .xFadeUp-stagger > * {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  .xFadeUp-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; opacity: 1; transform: translateY(0); }
  .xFadeUp-stagger.is-visible > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: translateY(0); }
  .xFadeUp-stagger.is-visible > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: translateY(0); }
  .xFadeUp-stagger.is-visible > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: translateY(0); }
  .xFadeUp-stagger.is-visible > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: translateY(0); }
  .xFadeUp-stagger.is-visible > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: translateY(0); }

  /* xFadeIn - Simple fade */
  .xFadeIn {
    opacity: 0;
    transition: opacity 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xFadeIn.is-visible { opacity: 1; }

  /* xFadeLeft - Fade from left */
  .xFadeLeft {
    opacity: 0;
    transform: translateX(-24px);
    transition:
      opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xFadeLeft.is-visible { opacity: 1; transform: translateX(0); }

  /* xFadeRight - Fade from right */
  .xFadeRight {
    opacity: 0;
    transform: translateX(24px);
    transition:
      opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xFadeRight.is-visible { opacity: 1; transform: translateX(0); }

  /* xScale - Scale in */
  .xScale {
    opacity: 0;
    transform: scale(0.95);
    transition:
      opacity 700ms cubic-bezier(0.16, 1, 0.3, 1),
      transform 700ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xScale.is-visible { opacity: 1; transform: scale(1); }

  /* Legacy reveal (kept for compatibility) */
  [data-reveal] {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1),
                transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  }

  [data-reveal].is-visible {
    opacity: 1;
    transform: translateY(0);
  }

  /* ============================================
   * X MARKETING PARALLAX
   * ============================================ */

  .xParallax {
    will-change: transform;
    transition: transform 0.1s linear;
  }

  /* Static parallax backgrounds (CSS only) */
  .xParallax-bg {
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
  }

  @media (prefers-reduced-motion: reduce) {
    .xParallax,
    .xParallax-bg {
      transform: none !important;
      background-attachment: scroll;
    }

    .xFadeUp,
    .xFadeIn,
    .xFadeLeft,
    .xFadeRight,
    .xScale,
    .xFadeUp-stagger > * {
      opacity: 1 !important;
      transform: none !important;
    }
  }

  /* ============================================
   * X MARKETING GLASS EFFECTS
   * ============================================ */

  .xGlass {
    background: var(--x-glass-bg, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--x-glass-border, rgba(255, 255, 255, 0.2));
    box-shadow: var(--x-glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.08));
  }

  .xGlass-subtle {
    background: var(--x-glass-bg, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }

  .xGlass-heavy {
    background: var(--x-glass-bg, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--x-glass-border, rgba(255, 255, 255, 0.2));
    box-shadow: var(--x-glass-shadow, 0 8px 32px rgba(0, 0, 0, 0.08));
  }

  /* ============================================
   * X MARKETING GLOW EFFECTS
   * ============================================ */

  .xGlow-divider {
    position: relative;
    border: none;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      var(--x-glow-primary, rgba(var(--color-primary-400), 0.5)) 50%,
      transparent 100%
    );
  }

  .xGlow-divider::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 40px;
    background: radial-gradient(
      ellipse at center,
      var(--x-glow-primary, rgba(var(--color-primary-400), 0.6)) 0%,
      var(--x-glow-primary, rgba(var(--color-primary-400), 0.3)) 30%,
      transparent 70%
    );
    pointer-events: none;
  }

  .xGlow-divider-subtle {
    position: relative;
    border: none;
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      var(--x-glow-subtle, rgba(255, 255, 255, 0.1)) 50%,
      transparent 100%
    );
  }

  .xGlow-divider-subtle::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 50%;
    height: 24px;
    background: radial-gradient(
      ellipse at center,
      var(--x-glow-subtle, rgba(255, 255, 255, 0.15)) 0%,
      transparent 70%
    );
    pointer-events: none;
  }

  .xGlow-border {
    position: relative;
  }

  .xGlow-border::before {
    content: '';
    position: absolute;
    inset: -1px;
    background: linear-gradient(
      135deg,
      var(--x-glow-primary, rgba(var(--color-primary-400), 0.5)) 0%,
      transparent 50%,
      var(--x-glow-primary, rgba(var(--color-primary-400), 0.5)) 100%
    );
    border-radius: inherit;
    z-index: -1;
    opacity: 0.5;
  }

  .xGlow-text {
    text-shadow: 0 0 40px var(--x-glow-primary, rgba(var(--color-primary-400), 0.5));
  }

  /* ============================================
   * X MARKETING IMAGE OVERLAYS
   * ============================================ */

  .xOverlay {
    position: relative;
  }

  .xOverlay::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
  }

  .xOverlay-light::after {
    background: rgba(0, 0, 0, 0.3);
  }

  .xOverlay-heavy::after {
    background: rgba(0, 0, 0, 0.6);
  }

  .xOverlay-gradient::after {
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);
  }

  .xOverlay-vignette::after {
    background: radial-gradient(
      ellipse at center,
      transparent 0%,
      rgba(0, 0, 0, 0.4) 100%
    );
  }

  /* ============================================
   * X MARKETING HOVER EFFECTS
   * ============================================ */

  .xHover-lift {
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1),
                background 300ms cubic-bezier(0.16, 1, 0.3, 1),
                border-color 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xHover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--x-shadow-lg, 0 12px 32px rgba(0, 0, 0, 0.12));
  }

  .xHover-grow {
    transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xHover-grow:hover {
    transform: scale(1.02);
  }

  .xHover-glow {
    transition: box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xHover-glow:hover {
    box-shadow: var(--x-shadow-glow-md, 0 0 40px rgba(var(--color-primary-500), 0.3));
  }

  .xHover-glow-neutral {
    transition: box-shadow 300ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xHover-glow-neutral:hover {
    box-shadow: 0 0 40px rgba(128, 128, 128, 0.25);
  }
  .dark .xHover-glow-neutral:hover {
    box-shadow: 0 0 40px rgba(255, 255, 255, 0.12);
  }

  .xHover-glow-subtle {
    transition: box-shadow 500ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xHover-glow-subtle:hover {
    box-shadow: 0 0 30px rgba(128, 128, 128, 0.15);
  }
  .dark .xHover-glow-subtle:hover {
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.08);
  }

  /* For images inside containers */
  .xHover-zoom {
    overflow: hidden;
  }
  .xHover-zoom img {
    transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1);
  }
  .xHover-zoom:hover img {
    transform: scale(1.08);
  }

  /* Legacy hover-lift (kept for compatibility) */
  .hover-lift {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.15);
  }
}

@theme static {
  /* Premium Automotive Color Palette */
  /* Electric Blue Accent (Replace with your brand color) */
  --color-brand-50: #e6f0ff;
  --color-brand-100: #cce0ff;
  --color-brand-200: #99c2ff;
  --color-brand-300: #66a3ff;
  --color-brand-400: #3385ff;
  --color-brand-500: #0066ff;
  --color-brand-600: #0052cc;
  --color-brand-700: #003d99;
  --color-brand-800: #002966;
  --color-brand-900: #001433;
  --color-brand-950: #000a1a;

  /* Deep blacks with warm undertone */
  --color-deep-50: #f5f5f4;
  --color-deep-100: #e8e8e3;
  --color-deep-200: #c5c5bd;
  --color-deep-300: #9d9d94;
  --color-deep-400: #78786f;
  --color-deep-500: #52524e;
  --color-deep-600: #3d3c39;
  --color-deep-700: #2d2c2a;
  --color-deep-800: #1f1e1c;
  --color-deep-900: #151412;
  --color-deep-950: #0a0908;

  /* Typography - Premium Font Stack */
  --font-display: "Outfit", system-ui, -apple-system, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-sans: var(--font-body);
}

:root {
  --ui-radius: 0.375rem;
  --ui-container: 1440px;
  --ui-header-height: 4.5rem;

  /* Easing curves for premium animations */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ============================================
   * X MARKETING DESIGN SYSTEM VARIABLES
   * From spec-prompt.md specification
   * ============================================ */

  /* Surface colors for sections */
  --x-surface-elevated: color-mix(in srgb, var(--color-primary-500) 3%, white);
  --x-surface-subtle: color-mix(in srgb, var(--color-neutral-500) 3%, white);
  --x-surface-bold: var(--color-primary-950);

  /* Glass effect */
  --x-glass-bg: rgba(255, 255, 255, 0.7);
  --x-glass-border: rgba(255, 255, 255, 0.2);
  --x-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);

  /* Glow colors */
  --x-glow-primary: color-mix(in srgb, var(--color-primary-400) 50%, transparent);
  --x-glow-subtle: rgba(255, 255, 255, 0.1);

  /* Overlay for images */
  --x-overlay-light: rgba(0, 0, 0, 0.3);
  --x-overlay-heavy: rgba(0, 0, 0, 0.6);
  --x-overlay-gradient: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 50%);

  /* Typography scale */
  --x-text-display: clamp(3rem, 8vw, 6rem);
  --x-text-display-leading: 1.0;
  --x-text-display-tracking: -0.03em;

  --x-text-headline: clamp(2rem, 5vw, 3.5rem);
  --x-text-headline-leading: 1.1;
  --x-text-headline-tracking: -0.02em;

  --x-text-title: clamp(1.25rem, 3vw, 1.75rem);
  --x-text-title-leading: 1.2;
  --x-text-title-tracking: -0.01em;

  --x-text-body: 1.125rem;
  --x-text-body-leading: 1.7;

  --x-text-small: 0.875rem;
  --x-text-small-leading: 1.5;

  --x-text-eyebrow: 0.75rem;
  --x-text-eyebrow-tracking: 0.1em;

  /* Spacing scale */
  --x-section-py: clamp(4rem, 10vw, 8rem);
  --x-section-py-lg: clamp(6rem, 15vw, 12rem);

  --x-content-sm: 42rem;
  --x-content-md: 64rem;
  --x-content-lg: 80rem;
  --x-content-xl: 96rem;

  /* Motion durations */
  --x-duration-instant: 100ms;
  --x-duration-fast: 200ms;
  --x-duration-normal: 300ms;
  --x-duration-slow: 500ms;
  --x-duration-slower: 700ms;

  /* Easings */
  --x-ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --x-ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --x-ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* Standard transitions */
  --x-transition-colors: color var(--x-duration-fast) var(--x-ease-out),
                         background-color var(--x-duration-fast) var(--x-ease-out),
                         border-color var(--x-duration-fast) var(--x-ease-out);
  --x-transition-transform: transform var(--x-duration-normal) var(--x-ease-out);
  --x-transition-opacity: opacity var(--x-duration-normal) var(--x-ease-out);
  --x-transition-all: all var(--x-duration-normal) var(--x-ease-out);

  /* Elevation shadows */
  --x-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --x-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --x-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
  --x-shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.16);

  /* Glow shadows */
  --x-shadow-glow-sm: 0 0 20px var(--x-glow-primary);
  --x-shadow-glow-md: 0 0 40px var(--x-glow-primary);
  --x-shadow-glow-lg: 0 0 60px var(--x-glow-primary);
}

.dark {
  --ui-bg: var(--color-deep-950);
  --ui-primary: white;

  /* Dark mode overrides for X Marketing */
  --x-surface-elevated: color-mix(in srgb, var(--color-primary-500) 5%, var(--color-neutral-950));
  --x-surface-subtle: var(--color-neutral-900);
  --x-surface-bold: var(--color-primary-500);

  --x-glass-bg: rgba(0, 0, 0, 0.6);
  --x-glass-border: rgba(255, 255, 255, 0.1);
  --x-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

  --x-glow-primary: color-mix(in srgb, var(--color-primary-500) 30%, transparent);
  --x-glow-subtle: rgba(255, 255, 255, 0.05);

  --x-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --x-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --x-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4);
  --x-shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.5);
}

/* Premium Animation Keyframes */
@keyframes slide-up-fade {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scale-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes shimmer {
  0% {
    background-position: -200% center;
  }
  100% {
    background-position: 200% center;
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow-pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

@keyframes scroll-indicator {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.3;
    transform: translateY(12px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Font Feature Settings for Premium Typography */
.font-display {
  font-family: var(--font-display);
  font-feature-settings: 'ss01' on, 'cv01' on;
}

.font-body {
  font-family: var(--font-body);
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Improved text rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
