/* ===================================================
   CINEMÁTICA EN MOVIMIENTO — Estilos principales
   =================================================== */

/* ---- Variables globales ---- */
:root {
  --bg:        #080e1d;
  --bg-card:   rgba(255,255,255,0.04);
  --bg-hover:  rgba(255,255,255,0.08);
  --accent:    #3b82f6;
  --accent2:   #06b6d4;
  --green:     #22c55e;
  --violet:    #8b5cf6;
  --orange:    #f59e0b;
  --red:       #ef4444;
  --text:      #e2e8f0;
  --muted:     #94a3b8;
  --border:    rgba(255,255,255,0.08);
  --radius:    14px;
}

/* ---- Reset base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html  { scroll-behavior: smooth; }
body  {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ===================================================
   NAVBAR
   =================================================== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 58px;
  background: rgba(8,14,29,0.92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--accent2);
  letter-spacing: 0.5px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.nav-links a {
  display: block;
  padding: 6px 14px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.88rem;
  transition: background 0.2s, color 0.2s;
}

.nav-links a:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* ===================================================
   HERO
   =================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 1.5rem 4rem;
  overflow: hidden;
}

/* Gradientes de fondo decorativos */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 55% at 50% 35%, rgba(59,130,246,0.13) 0%, transparent 70%),
    radial-gradient(ellipse 55% 40% at 80% 75%, rgba(6,182,212,0.09) 0%, transparent 60%);
  pointer-events: none;
}

/* Patrón de puntos */
.hero-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.055) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.hero-badge {
  display: inline-block;
  margin-bottom: 1.4rem;
  padding: 5px 16px;
  border-radius: 100px;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.28);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent2);
}

.hero h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  font-weight: 800;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 1.2rem;
}

/* Texto con degradado */
.highlight {
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  font-size: 1.05rem;
  color: var(--muted);
  max-width: 480px;
  margin: 0 auto 2.5rem;
}

.btn-hero {
  display: inline-block;
  padding: 13px 34px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  text-decoration: none;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  transition: transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 4px 24px rgba(59,130,246,0.35);
}

.btn-hero:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(59,130,246,0.5);
}

/* ===================================================
   SECCIONES
   =================================================== */
.section {
  padding: 5rem 1.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

/* Sección con fondo alternativo */
.section-alt {
  background: rgba(255,255,255,0.012);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 5rem 1.5rem;
  max-width: 100%;
}

.section-alt > * {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

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

.section-header h2 {
  font-size: clamp(1.7rem, 3.5vw, 2.4rem);
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.5rem;
}

.section-header p { color: var(--muted); font-size: 0.97rem; }

/* ===================================================
   CARDS DE TEMAS
   =================================================== */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.1rem;
}

.topic-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  cursor: default;
  transition: transform 0.25s, background 0.25s, box-shadow 0.25s, border-color 0.25s;
}

.topic-card:hover {
  transform: translateY(-5px);
  background: var(--bg-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
  border-color: rgba(59,130,246,0.3);
}

/* Etiqueta de categoría */
.card-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 100px;
  width: fit-content;
  /* Color se aplica con variables inline desde JS */
  background: var(--tag-bg, rgba(59,130,246,0.15));
  color: var(--tag-color, var(--accent2));
  border: 1px solid var(--tag-border, rgba(59,130,246,0.2));
}

.topic-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.card-desc {
  font-size: 0.86rem;
  color: var(--muted);
  flex: 1;
}

/* Fórmula destacada */
.card-formula {
  background: rgba(59,130,246,0.09);
  border-left: 3px solid var(--accent);
  padding: 6px 10px;
  border-radius: 0 8px 8px 0;
  font-family: 'Courier New', monospace;
  font-size: 0.82rem;
  color: #93c5fd;
}

.card-example {
  font-size: 0.78rem;
  color: #475569;
  font-style: italic;
}

.card-actions { margin-top: 0.3rem; }

.btn-sim {
  width: 100%;
  padding: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  border: none;
  border-radius: 9px;
  font-size: 0.83rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.15s;
}

.btn-sim:hover {
  opacity: 0.88;
  transform: scale(1.02);
}

/* ===================================================
   OVERLAY DEL SIMULADOR
   =================================================== */
.sim-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(5,9,20,0.98);
  display: none;
  overflow-y: auto;
}

.sim-overlay.active { display: block; }

.sim-modal {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Encabezado pegajoso del simulador */
.sim-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.5rem;
  background: rgba(8,14,29,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.sim-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent2);
}

.sim-header-btns {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

/* Botones de control del simulador */
.sim-btn {
  padding: 7px 15px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
  background: rgba(59,130,246,0.18);
  color: var(--text);
  border: 1px solid rgba(59,130,246,0.28);
}

.sim-btn:hover:not(:disabled) { background: rgba(59,130,246,0.32); }
.sim-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-volver {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.3);
  color: #fca5a5;
}
.btn-volver:hover { background: rgba(239,68,68,0.3) !important; }

/* ===================================================
   CUERPO DEL SIMULADOR
   =================================================== */
.sim-body {
  flex: 1;
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
}

.sim-layout {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
}

/* Contenedor del canvas con scroll horizontal en móvil */
.sim-canvas-wrap { overflow-x: auto; max-width: 100%; }

.sim-canvas-wrap canvas {
  display: block;
  border-radius: 12px;
  background: #0d1525;
  box-shadow: 0 8px 32px rgba(0,0,0,0.55);
  max-width: 100%;
}

/* Panel de datos */
.sim-panel {
  min-width: 195px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  flex-shrink: 0;
}

.panel-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--accent2);
  margin-bottom: 0.85rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.panel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255,255,255,0.035);
  gap: 0.5rem;
}

.panel-row:last-child { border-bottom: none; }

.panel-label {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.panel-value {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  color: #fff;
  text-align: right;
}

/* ===================================================
   CONTROLES DEL SIMULADOR
   =================================================== */
.sim-controls { width: 100%; max-width: 700px; }

.ctrl-group {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
}

.ctrl-group label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--muted);
  min-width: 145px;
}

.ctrl-group input[type="number"],
.ctrl-group select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.07);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s, background 0.2s;
  width: 130px;
}

.ctrl-group input:focus,
.ctrl-group select:focus {
  border-color: var(--accent);
  background: rgba(59,130,246,0.08);
}

.ctrl-group select option { background: #1e293b; }

/* Caja de información de la simulación */
.sim-info {
  max-width: 700px;
  background: rgba(6,182,212,0.055);
  border: 1px solid rgba(6,182,212,0.14);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem;
  font-size: 0.86rem;
  color: var(--muted);
  line-height: 1.75;
}

.sim-info strong { color: var(--accent2); }
.sim-info em {
  color: #93c5fd;
  font-style: normal;
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
}

/* ===================================================
   CONCLUSIÓN
   =================================================== */
.conclusion-box {
  max-width: 680px;
  margin: 0 auto;
  background: rgba(59,130,246,0.06);
  border: 1px solid rgba(59,130,246,0.16);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  font-size: 1.03rem;
  color: var(--muted);
  line-height: 1.85;
}

/* ===================================================
   INGENIERÍA INDUSTRIAL
   =================================================== */
.industrial-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

.industrial-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  text-align: center;
  transition: transform 0.22s, background 0.22s;
}

.industrial-card:hover {
  transform: translateY(-4px);
  background: var(--bg-hover);
}

.ind-icon { font-size: 2rem; margin-bottom: 0.55rem; }

.industrial-card h4 {
  color: var(--accent2);
  font-size: 0.92rem;
  margin-bottom: 0.45rem;
}

.industrial-card p {
  font-size: 0.81rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ===================================================
   FOOTER
   =================================================== */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  color: #334155;
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ===================================================
   RESPONSIVE — Móvil
   =================================================== */
@media (max-width: 768px) {
  .nav-toggle { display: block; }

  .nav-links {
    display: none;
    position: absolute;
    top: 58px; left: 0; right: 0;
    flex-direction: column;
    background: rgba(8,14,29,0.98);
    padding: 0.75rem 1rem;
    gap: 0.2rem;
    border-bottom: 1px solid var(--border);
  }

  .nav-links.open { display: flex; }

  .sim-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .sim-layout {
    flex-direction: column;
    align-items: center;
  }

  .ctrl-group {
    flex-direction: column;
  }

  .ctrl-group input[type="number"],
  .ctrl-group select {
    width: 100%;
  }

  .sim-panel { width: 100%; max-width: 400px; }
}
