@import 'tailwindcss';

@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@source '../**/*.js';

/*
 * Custom variant for class-based dark mode
 */
@custom-variant dark (&:is(.dark *));

/*
 * Leaflet overrides — Tailwind v4 preflight applies:
 *   img { width: 100%; display: block; }
 *   img, svg, video … { vertical-align: middle; display: block; }
 * These break Leaflet tile grid rendering.  The rules below restore the styles
 * that Leaflet expects for tiles, markers, and controls.
 *
 * IMPORTANT: Do NOT set width/height with !important here — Leaflet sets
 * tile dimensions via inline styles (width:256px; height:256px) and those
 * must NOT be overridden.
 */
.leaflet-container img {
  max-width: none !important;
  max-height: none !important;
  padding: 0;
}
/*
 * Global Reset — wrapped in @layer base so Tailwind utilities can override
 */
@layer base {
  * {
      box-sizing: border-box;
      font-display: swap;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      font-family: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
      font-style: normal;
      position: relative;
      font-synthesis: none;
    }

    ul,
    li,
    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    a {
      line-height: 1.618;
    }

    a {
      text-decoration: none;
      display: inline-block;
    }

    svg {
      display: block;
    }

    img {
      display: block;
      width: 100%;
    }
}

/*
 * Science Gothic — loaded via Google Fonts in app.blade.php
 * Usage: font-science-gothic + font-[100] to font-[900] + tracking-[...]
 */
@utility font-science-gothic {
  font-family: var(--font-science-gothic, 'Science Gothic', 'Arial Black', Impact, sans-serif);
}

/*
 * Tailwind v4 Theme Tokens (mapped from CSS custom properties)
 */
@theme inline {
  --gold: 1.618;
  --radius-sm: calc(var(--radius) - 4px);
  --radius-md: calc(var(--radius) - 2px);
  --radius-lg: var(--radius);
  --radius-xl: calc(var(--radius) + 4px);
  --color-background: var(--background);
  --color-foreground: var(--foreground);
  --color-card: var(--card);
  --color-card-foreground: var(--card-foreground);
  --color-popover: var(--popover);
  --color-popover-foreground: var(--popover-foreground);
  --color-primary: var(--primary);
  --color-primary-foreground: var(--primary-foreground);
  --color-secondary: var(--secondary);
  --color-secondary-foreground: var(--secondary-foreground);
  --color-muted: var(--muted);
  --color-muted-foreground: var(--muted-foreground);
  --color-accent: var(--accent);
  --color-accent-foreground: var(--accent-foreground);
  --color-destructive: var(--destructive);
  --color-border: var(--border);
  --color-input: var(--input);
  --color-ring: var(--ring);
  --color-chart-1: var(--chart-1);
  --color-chart-2: var(--chart-2);
  --color-chart-3: var(--chart-3);
  --color-chart-4: var(--chart-4);
  --color-chart-5: var(--chart-5);
  --color-sidebar: var(--sidebar);
  --color-sidebar-foreground: var(--sidebar-foreground);
  --color-sidebar-primary: var(--sidebar-primary);
  --color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
  --color-sidebar-accent: var(--sidebar-accent);
  --color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
  --color-sidebar-border: var(--sidebar-border);
  --color-sidebar-ring: var(--sidebar-ring);
  --font-sans: 'Poppins', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

  --breakpoint-2xl: 87.5rem;
  /* 1400px — custom container max */
}

/*
 * Light mode defaults (not actively used — dark mode forced via .dark class on <html>)
 */
:root {
  --font-science-gothic: 'Science Gothic', 'Arial Black', Impact, sans-serif;
  --radius: 0.625rem;
  --gold: 1.618;
  --background: rgb(30, 30, 30);
  --foreground: oklch(0 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.145 0 0);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.145 0 0);
  --primary: oklch(61.518% 0.2109 256.116);
  --primary-foreground: oklch(0.985 0 0);
  --secondary: oklch(0.97 0 0);
  --secondary-foreground: oklch(0.205 0 0);
  --muted: oklch(0.97 0 0);
  --muted-foreground: oklch(0.556 0 0);
  --accent: oklch(0.97 0 0);
  --accent-foreground: oklch(0.205 0 0);
  --destructive: oklch(0.577 0.245 27.325);
  --border: oklch(0.922 0 0);
  --input: oklch(0.922 0 0);
  --ring: oklch(0.708 0 0);
  --chart-1: oklch(0.646 0.222 41.116);
  --chart-2: oklch(0.6 0.118 184.704);
  --chart-3: oklch(0.398 0.07 227.392);
  --chart-4: oklch(0.828 0.189 84.429);
  --chart-5: oklch(0.769 0.188 70.08);
  --sidebar: oklch(0.985 0 0);
  --sidebar-foreground: oklch(0.145 0 0);
  --sidebar-primary: oklch(0.205 0 0);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.97 0 0);
  --sidebar-accent-foreground: oklch(0.205 0 0);
  --sidebar-border: oklch(0.922 0 0);
  --sidebar-ring: oklch(0.708 0 0);
}

/*
 * Dark mode — exact OKLCH tokens from the current React SPA
 */
.dark {
  --background: #191919;
  --foreground: oklch(1 0 0);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.205 0 0);
  --popover-foreground: oklch(0.985 0 0);
  --primary: #1565C0;
  --primary-foreground: oklch(100% 0.00011 271.152);
  --secondary: oklch(0.269 0 0);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --accent: oklch(0.269 0 0);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: oklch(0.704 0.191 22.216);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.556 0 0);
  --chart-1: oklch(0.488 0.243 264.376);
  --chart-2: oklch(0.696 0.17 162.48);
  --chart-3: oklch(0.769 0.188 70.08);
  --chart-4: oklch(0.627 0.265 303.9);
  --chart-5: oklch(0.645 0.246 16.439);
  --sidebar: oklch(0.205 0 0);
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-primary: oklch(0.488 0.243 264.376);
  --sidebar-primary-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.269 0 0);
  --sidebar-accent-foreground: oklch(0.985 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
  --sidebar-ring: oklch(0.556 0 0);
}

/*
 * Base layer
 */
@layer base {
  * {
    @apply border-border outline-ring/50;
  }

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

  /* Scrollbar styling */
  ::-webkit-scrollbar {
    width: 12px;
    height: 12px;
  }

  ::-webkit-scrollbar-track {
    background: var(--background);
  }

  ::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: var(--radius);
    border: 2px solid var(--background);
  }

  ::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
  }

  /* Firefox scrollbar */
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--muted-foreground) var(--background);
  }
}

/*
 * Utility layer
 */
@layer utilities {
  .bg-glassmorphism {
    background: rgba(30, 30, 30, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}
/*
 * SectionHero entry animation
 * By default the hero shows its FINAL state (70vh, rounded, padded). * The animation is opt-in via the .hero-animate class,
 * added by JS only when scrollY <=50 (i.e. user is at the top of the page). * This prevents the animation from playing on back/forward navigation * when the browser restores a scrolled position.
 */
.animated-hero-loader {
  padding: 16px;
  height: 70vh;
    min-height: 500px;
    border-radius: 16px;
    contain: layout style;
  }
    
.animated-hero-loader.home-hero {
  padding: 16px 16px 0 16px;
  height: 90vh;
  border-radius: 16px 16px 0 0;
}
  .animated-hero-loader-img {
    border-radius: 16px;
  }
  
  /* Opt-in animation: starts from 100vh fullscreen, animates to 70vh rounded */
  .animated-hero-loader.hero-animate {
  padding: 0 0 0 0;
  height: 100vh;
  border-radius: 0;
  will-change: height, padding, border-radius;
  animation: animated-hero-loader 500ms ease-in-out 500ms forwards;
}

.animated-hero-loader.hero-animate.home-hero {
  will-change: height, padding, border-radius;
  animation: animated-home-hero-loader 500ms ease-in-out 500ms forwards;
}
.animated-hero-loader.hero-animate .animated-hero-loader-img {
  border-radius: 0;
  will-change: border-radius;
  animation: animated-hero-loader-img 500ms ease-in-out 500ms forwards;
}
.animated-hero-loader.hero-animate.home-hero .animated-hero-loader-img {
  animation: animated-hero-loader-img 500ms ease-in-out 500ms forwards;
}
/* Circle SVG – infinite CSS rotation (triggered via .circle-rotating class) */
@keyframes circle-rotate {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.circle-rotating {
  animation: circle-rotate 25s linear infinite;
  transform-origin: center center;
}
@keyframes animated-hero-loader {
  from {
    height: 100vh;
    border-radius: 0;
    padding: 0;
  }

  to {
    padding: 16px;
    height: 70vh;
    border-radius: 16px;
  }
}

@keyframes animated-hero-loader-img {
  from {
    border-radius: 0;
  }

  to {
    border-radius: 16px;
  }
}

@keyframes animated-home-hero-loader {
  from {
    height: 100vh;
    border-radius: 0;
    padding: 0;
  }

  to {
    padding: 16px;
    height: 90vh;
    border-radius: 16px;
  }
}

@keyframes animated-hero-loader-img {
  from {
    border-radius: 0;
  }

  to {
    border-radius: 16px;
  }
}
/* Mobile variant: accounts for navbar padding-top */
@media (max-width: 64rem) {
  .animated-hero-loader {
    padding-top: 101px;
    }
    
    .animated-hero-loader.hero-animate {
    padding-top: 84px;
    animation: animated-hero-loader-mobile 500ms ease-in-out 500ms forwards;
  }

  @keyframes animated-hero-loader-mobile {
    from {
      padding-top: 84px;
      height: 100vh;
      border-radius: 0;
    }

    to {
      padding: 16px;
      padding-top: 101px;
      height: 70vh;
      border-radius: 16px;
    }
  }
}
/*
 * GSAP Animation — Initial hidden state for scroll-reveal elements
 * Elements are visible by default (safe fallback).
 * Only hidden when JS has confirmed GSAP is ready (.gsap-ready on <html>).
 * This prevents invisible content if JS fails, loads slowly, or Vite HMR is active.
 *
 * For data-display-wrapped: hide the CHILDREN of the grid container,
 * not the container itself (which would collapse the layout).
 */
.gsap-ready [data-animate="appear"],
.gsap-ready [data-appear-from-bottom],
.gsap-ready [data-timeline-box],
.gsap-ready [data-kpi-stagger] {
  opacity: 0;
}

/*
 * Canvas Container — 3D Scene fallback / loaded states
 */
.canvas-container canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Fallback image visible by default, transitions on load */
.canvas-fallback-img {
  display: block;
  opacity: 1;
  transition: opacity 0.5s ease-out;
}

/* Loading spinner — visible by default, transitions on load */
.scene-spinner {
  opacity: 1;
  transition: opacity 0.3s ease-out;
}

/* Hide spinner and fade out fallback when scene loads successfully */
[data-scene].scene-loaded .scene-spinner {
  opacity: 0;
  pointer-events: none;
}

[data-scene].scene-loaded .canvas-fallback-img {
  opacity: 0;
  pointer-events: none;
}

/* Show fallback prominently when scene fails; hide spinner */
[data-scene].scene-fallback .canvas-fallback-img {
  display: block;
  opacity: 1;
}

[data-scene].scene-fallback .scene-spinner {
  opacity: 0;
  pointer-events: none;
}

/*
 * Home Product Section — Scroll animation only on narrow viewports
 * Aspect ratio < 1.45 (matching React SPA's isAnimationActive check)
 */
@media (max-aspect-ratio: 145/100) {
  [data-product-scroll-section] {
    min-height: 1200px;
    height: 200vh;
    padding-bottom: 10rem;
    /* pb-40 */
  }

  [data-product-scroll-trigger] {
    min-height: 1200px;
    height: 200vh;
  }
}

/*
 * CSS2D product labels (rendered by CSS2DRenderer in home-product scene)
 */
.product-label {
  color: var(--foreground, hsl(0 0% 98%));
  font-size: 1.125rem;
  line-height: 1.75rem;
  width: 240px;
  text-align: center;
  pointer-events: none;
  user-select: none;
  white-space: normal;
  padding: 4px 8px;
    border-radius: 8px;
}

/* Detection material-type badges (PEPP, KRAFT, PETC) */
.detection-badge {
  color: white;
  font-size: 12px;
  font-weight: bold;
  padding: 2px 4px;
  border-radius: 4px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
  transform: translate(50%, -50%);
}

/* CSS2DRenderer overlay — pointer-events passthrough */
.css2d-renderer {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: hidden;
}

/* prefers-reduced-motion: skip 3D entirely, show fallback */
@media (prefers-reduced-motion: reduce) {
  [data-scene].scene-reduced-motion .scene-spinner {
    opacity: 0;
    pointer-events: none;
  }

  [data-scene].scene-reduced-motion .canvas-fallback-img {
    display: block;
    opacity: 1;
  }

  [data-scene].scene-reduced-motion canvas {
    display: none;
  }
}
/* ============================================================
 * Form success confirmation — CSS fallback animation
 * Used when GSAP is not available (Epic 4 not yet loaded).
 * ============================================================ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in-up {
  animation: fadeInUp 0.5s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .animate-fade-in-up {
    animation: none;
  }
}