/* ═══════════════════════════════════════════════════
   NEURONA — Design System 2030
   Inspirado en Apple, construido para el futuro
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200..700&family=Instrument+Serif:opsz@14..32&display=swap');

/* ── Tokens ── */
:root {
  --bg: #000000;
  --bg-elevated: #0a0a0a;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-glass: rgba(255,255,255,0.03);
  --bg-glass-border: rgba(255,255,255,0.08);

  --text-primary: #ffffff;
  --text-secondary: rgba(255,255,255,0.65);
  --text-tertiary: rgba(255,255,255,0.35);
  --text-quaternary: rgba(255,255,255,0.18);

  --accent: #00ff9d;
  --accent-dim: rgba(0,255,157,0.12);
  --accent-glow: rgba(0,255,157,0.25);
  --accent-purple: #7c3aed;
  --accent-purple-dim: rgba(124,58,237,0.12);
  --accent-orange: #ff6b35;
  --accent-orange-dim: rgba(255,107,53,0.12);
  --accent-cyan: #22d3ee;
  --accent-red: #ff0040;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font-sans: 'Inter', -apple-system, system-ui, sans-serif;
  --font-serif: 'Instrument Serif', 'Georgia', serif;

  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --duration-fast: 0.2s;
  --duration-base: 0.4s;
  --duration-slow: 0.8s;
}

/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.5;
  overflow-x: hidden;
  cursor: default;
}

::selection { background: var(--accent-dim); color: var(--accent); }

::-webkit-scrollbar { width: 0; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { background: none; border: none; cursor: pointer; font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; background: none; border: none; outline: none; }

/* ── Typography ── */
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.02em; }

.eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 1rem;
}

.gradient-text {
  background: linear-gradient(135deg, #fff 0%, var(--accent) 50%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Glass Container ── */
.glass {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border: 1px solid var(--bg-glass-border);
  border-radius: var(--radius-lg);
  transition: background var(--duration-fast) var(--ease),
              border-color var(--duration-fast) var(--ease);
  overflow: hidden;
}

.glass::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
  pointer-events: none;
}

.glass::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 0%, rgba(255,255,255,0.02), transparent 50%);
  pointer-events: none;
}

.glass:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255,255,255,0.12);
}

.glass-deep {
  position: relative;
  background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.01) 100%);
  backdrop-filter: blur(60px) saturate(1.8);
  -webkit-backdrop-filter: blur(60px) saturate(1.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.glass-deep::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  pointer-events: none;
}

.glass-deep::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 0%, rgba(255,255,255,0.03) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease);
}

.btn:active { transform: scale(0.96); }

.btn-primary {
  background: var(--accent);
  color: #000;
}

.btn-primary:hover { box-shadow: 0 0 40px var(--accent-glow); }

.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--bg-glass-border);
  color: var(--text-primary);
}

.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-ghost {
  color: var(--text-secondary);
}

.btn-ghost:hover { color: var(--text-primary); }

/* ── Input ── */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.input-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.02em;
}

.input-field {
  padding: 0.875rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-md);
  font-size: 0.9375rem;
  color: var(--text-primary);
  transition: border-color var(--duration-fast) var(--ease),
              box-shadow var(--duration-fast) var(--ease);
}

.input-field:focus {
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 0 4px rgba(255,255,255,0.04);
}

.input-field::placeholder { color: var(--text-quaternary); }

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='rgba(255,255,255,0.35)' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

/* ── Section ── */
.section-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8rem 2rem;
}

.section-header {
  text-align: center;
  margin-bottom: 5rem;
}

.section-header h2 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 1.25rem;
}

.section-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ── Reveal Animations ── */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s var(--ease-out),
              transform 0.8s var(--ease-out);
}

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

.reveal-scale {
  opacity: 0;
  transform: scale(0.95);
  transition: opacity 0.8s var(--ease-out),
              transform 0.8s var(--ease-out);
}

.reveal-scale.visible { opacity: 1; transform: scale(1); }

/* ── Organic Mesh ── */
#neuron-mesh {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

/* ── Noise Overlay ── */
.noise-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 100;
  opacity: 0.015;
  contain: paint;
  will-change: opacity;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Grid Background ── */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
  background-size: 48px 48px;
}

/* ── Ambient Orbs ── */
.orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(120px);
}

.orb-1 {
  width: 500px;
  height: 500px;
  background: rgba(0, 255, 157, 0.06);
  top: -200px;
  left: -200px;
  will-change: transform, filter;
  transform: translateZ(0);
  animation: orb-drift 30s ease-in-out infinite;
}

.orb-2 {
  width: 400px;
  height: 400px;
  background: rgba(124, 58, 237, 0.05);
  bottom: -150px;
  right: -150px;
  will-change: transform, filter;
  transform: translateZ(0);
  animation: orb-drift 25s ease-in-out infinite reverse;
}

.orb-3 {
  width: 300px;
  height: 300px;
  background: rgba(34, 211, 238, 0.04);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  will-change: transform, filter;
  animation: orb-pulse 8s ease-in-out infinite;
}

@keyframes orb-drift {
  0%, 100% { transform: translate(0, 0); }
  33% { transform: translate(80px, -60px); }
  66% { transform: translate(-40px, 80px); }
}

@keyframes orb-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.5rem 0.5rem 1.5rem;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(40px) saturate(1.5);
  -webkit-backdrop-filter: blur(40px) saturate(1.5);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 100px;
  width: 90%;
  max-width: 1100px;
  z-index: 100;
}

.navbar::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  pointer-events: none;
  z-index: 1;
}

.navbar.scrolled {
  background: rgba(0,0,0,0.85);
  border-color: rgba(255,255,255,0.1);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent-glow);
  animation: dot-pulse 3s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 10px var(--accent-glow); }
  50% { box-shadow: 0 0 30px var(--accent-glow); }
}

.brand-text {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: 50px;
  outline: none;
  text-decoration: none;
  white-space: nowrap;
}

.nav-links a:visited { color: var(--text-secondary); }

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-cta {
  padding: 0.5rem 1.25rem;
  background: var(--accent);
  color: #000 !important;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: 50px;
}

.nav-cta:visited { color: #000 !important; }

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.5rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--bg-glass-border);
  height: 28px;
}

.nav-auth-name {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-weight: 500;
}

.nav-auth-exit {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
  padding: 0.25rem 0.5rem;
  border-radius: 50px;
  outline: none;
}

.nav-auth-exit:visited { color: var(--accent); }

/* ── Footer ── */
.footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  color: var(--text-tertiary);
  font-size: 0.8125rem;
}

.footer a { color: var(--text-secondary); transition: color var(--duration-fast) var(--ease); }
.footer a:hover { color: var(--text-primary); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .navbar { top: 8px; padding: 0.4rem 0.8rem; }
  .nav-links { display: none; }
  .section-container { padding: 5rem 1.5rem; }
  .section-header { margin-bottom: 3rem; }
  .section-header h2 { font-size: 1.75rem; }
}

@media (max-width: 480px) {
  .section-container { padding: 4rem 1.25rem; }
}

/* ── Auth Modal ── */
.auth-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.4s ease;
}
.auth-overlay.visible { opacity: 1; pointer-events: all; }
.auth-modal {
  width: 100%; max-width: 400px;
  padding: 2.5rem 2rem;
  position: relative;
  overflow: hidden;
}
.auth-modal::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.auth-header { text-align: center; margin-bottom: 1.75rem; }
.auth-header .auth-brand { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 1.125rem; font-weight: 600; letter-spacing: 0.05em; margin-bottom: 0.5rem; }
.auth-header .auth-subtitle { font-size: 0.8125rem; color: var(--text-tertiary); }
.auth-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-radius: 10px; overflow: hidden; border: 1px solid var(--bg-glass-border); }
.auth-tab { flex: 1; padding: 0.6rem 1rem; text-align: center; font-size: 0.8125rem; font-weight: 500; cursor: pointer; transition: all 0.2s; background: transparent; color: var(--text-tertiary); border: none; }
.auth-tab.active { background: var(--accent-dim); color: var(--accent); }
.auth-forms .auth-form { display: none; }
.auth-forms .auth-form.active { display: block; }
.auth-form .input-group { margin-bottom: 1rem; }
.auth-form .auth-submit { width: 100%; justify-content: center; margin-top: 0.5rem; }
.auth-error { font-size: 0.75rem; color: var(--accent-red); min-height: 1.25rem; display: none; margin-bottom: 0.5rem; }
.auth-error.show { display: block; }
.auth-skip { display: block; margin: 1.25rem auto 0; background: none; border: none; color: var(--text-tertiary); font-size: 0.75rem; cursor: pointer; transition: color 0.2s; padding: 0.25rem 0.5rem; }
.auth-skip:hover { color: var(--text-secondary); }

/* ── Toast Notifications ── */
#neurona-toasts {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}

.nt {
  padding: 14px 22px;
  border-radius: 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #fff;
  background: rgba(0,0,0,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--accent-cyan);
  max-width: 400px;
  pointer-events: all;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
}

.nt-in { transform: translateY(0); opacity: 1; }
.nt-out { transform: translateY(-8px); opacity: 0; }

.nt-success { border-color: var(--accent); }
.nt-warning { border-color: var(--accent-orange); }
.nt-error { border-color: var(--accent-red); }

/* ── Connection Badge ── */
#neurona-conn {
  position: fixed; top: 76px; left: 50%; transform: translateX(-50%);
  z-index: 99;
  font-size: 0.6875rem;
  font-weight: 500;
  padding: 4px 14px;
  border-radius: 50px;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--bg-glass-border);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.nc-online { color: var(--accent); }
.nc-offline { color: var(--accent-red); border-color: var(--accent-red); }
.nc-hide { opacity: 0; transform: translateX(-50%) translateY(-12px); pointer-events: none; }

/* ── Mobile Menu ── */
.nav-mobile-btn {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  background: none;
  border: none;
  cursor: pointer;
  z-index: 101;
}

.nav-mobile-btn span {
  display: block;
  width: 20px;
  height: 1.5px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: transform 0.3s var(--ease-out), opacity 0.3s var(--ease-out);
}

.nav-mobile-open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
.nav-mobile-open span:nth-child(2) { opacity: 0; }
.nav-mobile-open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }

@media (max-width: 768px) {
  .navbar { padding: 0.5rem 0.8rem; }
  .nav-mobile-btn { display: flex; }
  .nav-links {
    position: fixed; top: 0; right: -100%;
    width: 280px; height: 100vh;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    padding: 6rem 2rem 2rem;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(40px) saturate(1.5);
    -webkit-backdrop-filter: blur(40px) saturate(1.5);
    border-left: 1px solid var(--bg-glass-border);
    transition: right 0.35s var(--ease-out);
    z-index: 100;
    display: flex;
  }
  .nav-links a {
    width: 100%;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.9375rem;
  }
  .nav-links .nav-cta {
    width: 100%;
    text-align: center;
    margin-top: 1rem;
    padding: 0.875rem;
    color: #000 !important;
  }
  .nav-links.nav-open { right: 0; }
  .nav-auth {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    width: 100%;
    margin-top: 1rem;
  }
}

/* ── Page Enter Animation ──
   Content stays visible even when requestAnimationFrame is throttled or JS fails. */
.pe-init main,
.pe-enter main { opacity: 1; transform: none; }

@keyframes page-enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-required { display: none; }
