@import "tailwindcss";

@font-face {
  font-family: 'Arista Pro Alternate';
  src: url('/fonts/Arista-Pro-Alternate-Regular.woff2') format('woff2'),
       url('/fonts/Arista-Pro-Alternate-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@import "@fontsource-variable/host-grotesk";
@import "@fontsource/quicksand/300.css";
@import "@fontsource/quicksand/400.css";
@import "@fontsource/quicksand/500.css";
@import "@fontsource/quicksand/600.css";
@import "@fontsource/quicksand/700.css";
@import "@fontsource/cormorant-garamond/400.css";
@import "@fontsource/cormorant-garamond/500.css";

@custom-variant dark (&:where(.dark, .dark *));

/* ========================================
   Theme Tokens — Glassmorphism + Organic
   ======================================== */
@theme {
  --color-hds-naranja: #EE7623;
  --color-hds-naranja-hover: #D8651A;
  --color-hds-naranja-glow: rgba(238, 118, 35, 0.25);
  --color-hds-coral: #FA9F5C;
  --color-hds-durazno: #FFCBA1;
  --color-hds-tinta: #1A1612;

  --font-sans: 'Quicksand', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Host Grotesk', 'Quicksand', system-ui, sans-serif;
  --font-brand: 'Arista Pro Alternate', 'Host Grotesk', system-ui, sans-serif;
  --font-editorial: 'Cormorant Garamond', Georgia, serif;

  --tracking-display: -0.02em;
  --tracking-eyebrow: 0.25em;
}

/* ========================================
   Design Tokens (CSS custom properties)
   ======================================== */
@layer base {
  :root {
    color-scheme: light;

    /* Core surface tokens */
    --hds-bg: #FAF6EE;
    --hds-bg-soft: #F5EFE3;
    --hds-bg-section: #FFFFFF;
    --hds-fg: #1A1612;
    --hds-fg-soft: #4A4540;
    --hds-fg-muted: #8A8580;
    --hds-line: #E8E2D5;
    --hds-card: #FFFFFF;
    --hds-card-soft: #FFFFFF;

    /* Glassmorphism system */
    --glass-bg: rgba(255, 255, 255, 0.45);
    --glass-bg-hover: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.25);
    --glass-border-hover: rgba(238, 118, 35, 0.35);
    --glass-shadow: 0 8px 32px rgba(26, 22, 18, 0.06);
    --glass-shadow-hover: 0 16px 48px rgba(238, 118, 35, 0.12);
    --radius-glass: 24px;
    --blur-glass: 20px;

    /* Gradients */
    --hds-gradient-hero: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(238, 118, 35, 0.08) 0%, transparent 70%);
    --hds-gradient-section: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(250, 159, 92, 0.06) 0%, transparent 70%);
    --hds-gradient-card-glow: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(238, 118, 35, 0.08) 0%, transparent 50%);

    /* Motion */
    --ease-spring: cubic-bezier(0.16, 1.2, 0.3, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  }

  :root.dark {
    color-scheme: dark;
    --hds-bg: #1A1612;
    --hds-bg-soft: #221E1A;
    --hds-bg-section: #2A2520;
    --hds-fg: #FAF6EE;
    --hds-fg-soft: #C8C2B8;
    --hds-fg-muted: #8A8580;
    --hds-line: #3A332C;
    --hds-card: #2A2520;
    --hds-card-soft: #221E1A;

    --glass-bg: rgba(42, 37, 32, 0.55);
    --glass-bg-hover: rgba(42, 37, 32, 0.75);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-border-hover: rgba(238, 118, 35, 0.3);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    --glass-shadow-hover: 0 16px 48px rgba(238, 118, 35, 0.15);

    --hds-gradient-hero: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(238, 118, 35, 0.12) 0%, transparent 70%);
    --hds-gradient-section: radial-gradient(ellipse 60% 50% at 50% 50%, rgba(250, 159, 92, 0.08) 0%, transparent 70%);
    --hds-gradient-card-glow: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(238, 118, 35, 0.12) 0%, transparent 50%);
  }

  html {
    -webkit-text-size-adjust: 100%;
  }

  body {
    font-family: var(--font-sans);
    color: var(--hds-fg);
    background-color: var(--hds-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s var(--ease-out-expo), color 0.3s var(--ease-out-expo);
  }

  h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: var(--tracking-display);
  }

  a {
    color: inherit;
    text-decoration: none;
  }
}

/* ========================================
   Noise Texture Overlay (global)
   ======================================== */
@layer base {
  .noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    pointer-events: none;
    opacity: 0.025;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
  }
}

/* ========================================
   Glass Card System
   ======================================== */
@layer components {
  .font-display { font-family: var(--font-display); }
  .font-editorial { font-family: var(--font-editorial); }
  .font-brand { font-family: var(--font-brand); letter-spacing: 0.01em; }

  /* Glass Card */
  .glass-card {
    position: relative;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-glass);
    backdrop-filter: blur(var(--blur-glass));
    -webkit-backdrop-filter: blur(var(--blur-glass));
    box-shadow: var(--glass-shadow);
    transition:
      background 0.3s var(--ease-out-expo),
      border-color 0.3s var(--ease-out-expo),
      box-shadow 0.3s var(--ease-out-expo),
      transform 0.4s var(--ease-spring);
    overflow: hidden;
  }

  .glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    transition: opacity 0.4s var(--ease-out-expo);
    background: var(--hds-gradient-card-glow);
    pointer-events: none;
    z-index: 0;
  }

  .glass-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
    transform: translateY(-4px);
  }

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

  .glass-card > * {
    position: relative;
    z-index: 1;
  }

  /* Glass Card — hero variant (spans more, stronger glow) */
  .glass-card-hero {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    box-shadow: var(--glass-shadow-hover);
  }

  /* Section eyebrow (unchanged, keep original) */
  .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: var(--tracking-eyebrow);
    text-transform: uppercase;
    color: var(--color-hds-naranja);
  }

  .eyebrow::after {
    content: '';
    display: inline-block;
    width: 3rem;
    height: 1px;
    background: var(--color-hds-naranja);
  }

  /* Buttons with spring easing */
  .btn-primary {
    background: var(--color-hds-naranja);
    color: #FFFFFF;
    padding: 0.875rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    transition:
      background 0.2s ease,
      transform 0.3s var(--ease-spring),
      box-shadow 0.3s var(--ease-spring);
    border: 2px solid var(--color-hds-naranja);
    cursor: pointer;
  }
  .btn-primary:hover {
    background: var(--color-hds-naranja-hover);
    border-color: var(--color-hds-naranja-hover);
    transform: scale(1.03);
    box-shadow: 0 8px 28px rgba(238, 118, 35, 0.3);
  }

  .btn-secondary {
    border: 2px solid var(--hds-fg);
    color: var(--hds-fg);
    padding: 0.78rem 1.4rem;
    border-radius: 6px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    transition:
      all 0.2s ease,
      transform 0.3s var(--ease-spring);
    background: transparent;
    cursor: pointer;
  }
  .btn-secondary:hover {
    background: var(--hds-fg);
    color: var(--hds-bg);
    transform: scale(1.03);
  }

  .btn-ghost {
    color: var(--color-hds-naranja);
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: gap 0.3s var(--ease-out-expo);
    background: transparent;
    border: none;
    cursor: pointer;
  }
  .btn-ghost:hover {
    gap: 0.7rem;
  }

  .icon-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1.5px solid var(--color-hds-naranja);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-hds-naranja);
    flex-shrink: 0;
  }

  /* Legacy service-card (keep reference, deprecate toward glass-card) */
  .service-card {
    background: var(--hds-card);
    border: 1px solid var(--hds-line);
    border-radius: 12px;
    padding: 2rem;
    transition: all 0.25s ease;
  }
  .service-card:hover {
    border-color: var(--color-hds-naranja);
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(238,118,35,0.08);
  }

  /* Particle grid background */
  .particle-grid {
    background-image:
      linear-gradient(to right, rgba(238,118,35,0.10) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(238,118,35,0.10) 1px, transparent 1px);
    background-size: 56px 56px;
  }

  :root.dark .particle-grid {
    background-image:
      linear-gradient(to right, rgba(238,118,35,0.18) 1px, transparent 1px),
      linear-gradient(to bottom, rgba(238,118,35,0.18) 1px, transparent 1px);
  }

  .skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 9999;
    padding: 0.75rem 1rem;
    background: var(--color-hds-naranja);
    color: white;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: top 0.2s ease;
  }
  .skip-link:focus { top: 1rem; }
}

/* ========================================
   Focus & A11y
   ======================================== */
@layer base {
  :focus-visible {
    outline: 2px solid var(--color-hds-naranja);
    outline-offset: 3px;
    border-radius: 2px;
  }
}

/* ========================================
   Reduced Motion
   ======================================== */
@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;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
  .noise-overlay { display: none; }
  .glass-card:hover { transform: none; box-shadow: var(--glass-shadow); }
  .btn-primary:hover, .btn-secondary:hover { transform: none; }
}

/* ========================================
   Scroll Reveal Animations
   ======================================== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

/* Stagger children */
.stagger > * {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.stagger.is-visible > *:nth-child(1) { opacity: 1; transform: translateY(0); transition-delay: 0s; }
.stagger.is-visible > *:nth-child(2) { opacity: 1; transform: translateY(0); transition-delay: 0.08s; }
.stagger.is-visible > *:nth-child(3) { opacity: 1; transform: translateY(0); transition-delay: 0.16s; }
.stagger.is-visible > *:nth-child(4) { opacity: 1; transform: translateY(0); transition-delay: 0.24s; }
.stagger.is-visible > *:nth-child(5) { opacity: 1; transform: translateY(0); transition-delay: 0.32s; }
.stagger.is-visible > *:nth-child(6) { opacity: 1; transform: translateY(0); transition-delay: 0.40s; }
.stagger.is-visible > *:nth-child(7) { opacity: 1; transform: translateY(0); transition-delay: 0.48s; }
.stagger.is-visible > *:nth-child(8) { opacity: 1; transform: translateY(0); transition-delay: 0.56s; }
.stagger.is-visible > *:nth-child(9) { opacity: 1; transform: translateY(0); transition-delay: 0.64s; }

/* ========================================
   Keyframes
   ======================================== */
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.floaty {
  animation: floaty 4s ease-in-out infinite;
}
.floaty-delay {
  animation: floaty 4s ease-in-out infinite;
  animation-delay: 1s;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(238,118,35,0.4); }
  50% { box-shadow: 0 0 0 12px rgba(238,118,35,0); }
}
.pulse-glow {
  animation: pulse-glow 2.5s ease-in-out infinite;
}

@keyframes countUp {
  from { opacity: 0.3; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
