/* ========================================================================
   KORU NEXUS — Design System
   La Bóveda Neo-Maximalista · korunexuslabs.com
   ======================================================================== */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Montserrat:wght@700;800;900&family=Outfit:wght@400;500;600&family=Roboto+Mono:wght@300;400;500&display=swap');

/* ========================================================================
   1. CSS TOKENS (Custom Properties)
   ======================================================================== */
:root {
  /* — Colors — */
  --clr-primary: #00D9C0;           /* Transformative Teal / Electric Koru */
  --clr-primary-rgb: 0, 217, 192;
  --clr-bg: #121212;                /* Deep Space / Deep Charcoal */
  --clr-bg-alt: #1a1a1a;            /* Slightly lighter background */
  --clr-bg-card: rgba(255, 255, 255, 0.05);
  --clr-surface: #1e1e1e;
  --clr-blue: #1A53FF;              /* Authority Blue */
  --clr-white: #F8F9FA;             /* Evidence White / Stellar White */
  --clr-white-rgb: 248, 249, 250;
  --clr-purple: #7B2FFF;            /* Analytical Purple */
  --clr-red: #FF3B3B;               /* Stress Red */
  --clr-green: #00C853;             /* Confidence Green */
  --clr-text: #F8F9FA;
  --clr-text-muted: rgba(248, 249, 250, 0.6);
  --clr-text-subtle: rgba(248, 249, 250, 0.4);
  --clr-border: rgba(0, 217, 192, 0.15);
  --clr-border-strong: rgba(0, 217, 192, 0.3);

  /* — Gradients — */
  --gradient-holographic: linear-gradient(135deg, #00D9C0, #7B2FFF);
  --gradient-hero: radial-gradient(ellipse at 50% 0%, rgba(0,217,192,0.08) 0%, transparent 60%);

  /* — Typography — */
  --ff-heading: 'Montserrat', sans-serif;
  --ff-body: 'Inter', sans-serif;
  --ff-mono: 'Roboto Mono', monospace;
  --ff-accent: 'Outfit', sans-serif;

  --fs-hero: clamp(2.8rem, 6vw, 5rem);
  --fs-h1: clamp(2.2rem, 4.5vw, 3.5rem);
  --fs-h2: clamp(1.8rem, 3.5vw, 2.8rem);
  --fs-h3: clamp(1.3rem, 2.5vw, 1.75rem);
  --fs-h4: clamp(1.1rem, 2vw, 1.35rem);
  --fs-body: clamp(0.95rem, 1.2vw, 1.1rem);
  --fs-small: 0.875rem;
  --fs-xs: 0.75rem;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;
  --fw-black: 900;

  --lh-tight: 1.15;
  --lh-heading: 1.25;
  --lh-body: 1.65;

  --ls-heading: -0.02em;
  --ls-body: 0;
  --ls-wide: 0.05em;

  /* — Spacing — */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --space-2xl: 6rem;
  --space-3xl: 8rem;
  --space-section: clamp(5rem, 10vw, 8rem);

  /* — Layout — */
  --container-max: 1200px;
  --container-wide: 1400px;
  --container-narrow: 800px;
  --gutter: clamp(1rem, 3vw, 2rem);

  /* — Border Radius — */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 24px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* — Shadows — */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 217, 192, 0.3);
  --shadow-glow-strong: 0 0 40px rgba(0, 217, 192, 0.4);

  /* — Glassmorphism — */
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: 1px solid rgba(0, 217, 192, 0.15);
  --glass-blur: blur(20px);

  /* — Transitions — */
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --duration-fast: 200ms;
  --duration-normal: 300ms;
  --duration-slow: 600ms;

  /* — Z-index layers — */
  --z-behind: -1;
  --z-base: 1;
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-nav: 500;
  --z-modal: 1000;
  --z-toast: 1100;
  --z-cursor: 9999;
}

/* ========================================================================
   2. CSS RESET (Modern)
   ======================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-size: 16px;
}

body {
  font-family: var(--ff-body);
  font-weight: var(--fw-regular);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--clr-text);
  background-color: var(--clr-bg);
  overflow-x: hidden;
  min-height: 100vh;
}

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--ff-heading);
  font-weight: var(--fw-black);
  line-height: var(--lh-heading);
  letter-spacing: var(--ls-heading);
  color: var(--clr-white);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p {
  color: var(--clr-text-muted);
  max-width: 65ch;
}

::selection {
  background: rgba(0, 217, 192, 0.3);
  color: var(--clr-white);
}

/* ========================================================================
   3. LAYOUT UTILITIES
   ======================================================================== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--wide {
  max-width: var(--container-wide);
}

.container--narrow {
  max-width: var(--container-narrow);
}

.section {
  padding-block: var(--space-section);
  position: relative;
}

.section--alt {
  background-color: var(--clr-bg-alt);
}

/* Grain overlay */
.section::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.03;
  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.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
  z-index: 0;
}

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

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.mx-auto { margin-inline: auto; }

/* ========================================================================
   4. TEXT UTILITIES
   ======================================================================== */
.text-primary { color: var(--clr-primary); }
.text-muted { color: var(--clr-text-muted); }
.text-subtle { color: var(--clr-text-subtle); }
.text-mono { font-family: var(--ff-mono); }
.text-accent { font-family: var(--ff-accent); }

.label {
  font-family: var(--ff-mono);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  text-transform: uppercase;
  letter-spacing: var(--ls-wide);
  color: var(--clr-primary);
}

.section-title {
  font-size: var(--fs-h2);
  margin-bottom: var(--space-lg);
}

.section-subtitle {
  font-family: var(--ff-accent);
  font-size: var(--fs-body);
  color: var(--clr-text-muted);
  max-width: 50ch;
  margin-bottom: var(--space-xl);
}

/* ========================================================================
   5. SCROLL ANIMATION BASE
   ======================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--duration-slow) var(--ease-smooth),
              transform var(--duration-slow) var(--ease-smooth);
}

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

/* Staggered children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--duration-normal) var(--ease-smooth),
              transform var(--duration-normal) var(--ease-smooth);
}

.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 400ms; }

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================================================
   6. RESPONSIVE VISIBILITY
   ======================================================================== */
@media (max-width: 768px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 769px) {
  .hide-desktop { display: none !important; }
}

/* ========================================================================
   7. LIGHT MODE THEME OVERRIDES
   ======================================================================== */
[data-theme="light"] {
  --clr-bg:              #F2F2F6;
  --clr-bg-alt:          #E8E8EE;
  --clr-bg-card:         rgba(0,0,0,0.04);
  --clr-surface:         #FFFFFF;
  --clr-text:            #0D0D1A;
  --clr-text-muted:      rgba(13,13,26,0.68);   /* ↑ de 0.62 — mejor legibilidad */
  --clr-text-subtle:     rgba(13,13,26,0.54);   /* ↑ de 0.42 — era casi invisible */
  --clr-white:           #0D0D1A;
  --clr-white-rgb:       13, 13, 26;
  --clr-border:          rgba(0,217,192,0.22);
  --clr-border-strong:   rgba(0,217,192,0.38);
  --glass-bg:            rgba(255,255,255,0.65);
  --glass-border:        1px solid rgba(0,0,0,0.08);
  --shadow-sm:           0 2px 8px rgba(0,0,0,0.07);
  --shadow-md:           0 4px 16px rgba(0,0,0,0.09);
  --shadow-lg:           0 8px 32px rgba(0,0,0,0.13);
  --shadow-glow:         0 0 20px rgba(0,217,192,0.25);
  --gradient-hero:       radial-gradient(ellipse at 50% 0%, rgba(0,217,192,0.06) 0%, transparent 60%);
  /* Holographic gradient oscurecido para que sea legible sobre fondo claro */
  --gradient-holographic: linear-gradient(135deg, #007a6a, #5a1fc0);
}
