:root {
  --bg-main: #0c0e12;
  --bg-surface: #14171f;
  --bg-surface-elevated: #1b202c;
  --bg-code: #08090c;
  
  --border-subtle: #242938;
  --border-accent: #3a4560;
  --border-focus: #4e6bb4;
  
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --text-accent: #60a5fa;
  --text-metric: #38bdf8;
  --text-warning: #f59e0b;
  --text-success: #34d399;
  
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  
  --max-width: 920px;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-md);
}

/* Encabezados */
.site-header {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.site-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #fff;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.site-title img {
  vertical-align: middle;
}

.site-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 680px;
}

.site-nav {
  margin-top: var(--space-md);
}

.site-nav a {
  color: var(--text-accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.site-nav a:hover {
  text-decoration: underline;
}

/* Headings */
h1, h2, h3, h4 {
  color: #f8fafc;
  font-weight: 600;
  line-height: 1.3;
}

h1 { font-size: 1.85rem; margin-bottom: var(--space-md); }
h2 { font-size: 1.35rem; margin: var(--space-xl) 0 var(--space-md); }
h3 { font-size: 1.1rem; margin: var(--space-lg) 0 var(--space-sm); }

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-lg);
}

/* Enlaces */
a {
  color: var(--text-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

/* Tarjetas y Grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.tech-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s ease;
}

.tech-card:hover {
  border-color: var(--border-accent);
}

.tech-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-bottom: 1px solid var(--border-subtle);
  display: block;
}

.tech-card-body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.tech-card-body h3 {
  font-size: 1rem;
  margin: 0 0 var(--space-sm) 0;
  line-height: 1.4;
}

.tech-card-body h3 a {
  color: #fff;
}

.tech-card-body p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.5;
  margin-bottom: var(--space-md);
  flex-grow: 1;
}

.tech-card-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-sm);
}

/* Tablas de Datos Responsivas (Core Layout) */
.table-responsive,
.tabla-parametros,
.data-matrix-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: var(--space-lg) 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  text-align: left;
  min-width: 540px;
}

th, td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: var(--bg-surface-elevated);
  color: #f1f5f9;
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 2;
}

td {
  color: var(--text-main);
}

td.num, td.metric {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-metric);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Callouts y Cajas Técnicas */
.data-callout {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-left: 3px solid var(--text-accent);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
}

.data-callout-title {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-accent);
  margin-bottom: var(--space-xs);
}

.data-callout p {
  font-size: 0.9rem;
  color: var(--text-main);
  margin: 0;
}

/* Motor de Diagramas SVG */
.chart-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  margin: var(--space-lg) 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.chart-container svg {
  max-width: 100%;
  height: auto;
  display: block;
}

.chart-caption {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: var(--space-sm);
  text-align: center;
}

/* Bloques de Código y Parámetros */
pre, code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

code {
  background: var(--bg-code);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  color: var(--text-metric);
}

pre code {
  display: block;
  padding: var(--space-md);
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  background: var(--bg-code);
  border-radius: var(--radius-md);
}

/* Formulario de Captación */
.newsletter-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin: var(--space-2xl) 0;
}

.newsletter-section h3 {
  font-size: 1.25rem;
  margin-top: 0;
  margin-bottom: var(--space-xs);
}

.newsletter-section p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}

.newsletter-form .form-row {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.form-input {
  flex-grow: 1;
  background: var(--bg-code);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.btn-primary {
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: #1d4ed8;
}

.consentimiento {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.consentimiento a {
  color: var(--text-muted);
}

/* Pie de página obligatorio */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: var(--space-xl);
  margin-top: var(--space-2xl);
  font-size: 0.82rem;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  line-height: 1.5;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text-accent);
}

/* Responsive */
@media (max-width: 640px) {
  .newsletter-form .form-row {
    flex-direction: column;
  }
  .btn-primary {
    width: 100%;
  }
  .site-title {
    font-size: 1.4rem;
  }
}