/* ==========================================================================
   Portafolio Hoyos — sistema visual compartido
   Paleta validada (dataviz skill) — ver assets/js/i18n.js para el toggle ES/EN
   ========================================================================== */

:root {
  --page-plane:     #f9f9f7;
  --surface-1:      #fcfcfb;
  --surface-2:      #ffffff;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --text-muted:     #898781;
  --gridline:       #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);

  --brand:          #2a78d6; /* series-1 / blue */
  --brand-ink:      #ffffff;

  /* paleta categórica (orden fijo, no ciclar) */
  --series-1: #2a78d6; /* blue */
  --series-2: #1baf7a; /* aqua */
  --series-3: #eda100; /* yellow */
  --series-4: #008300; /* green */
  --series-5: #4a3aa7; /* violet */
  --series-6: #e34948; /* red */
  --series-7: #e87ba4; /* magenta */
  --series-8: #eb6834; /* orange */

  --status-good:     #0ca30c;
  --status-warning:  #fab219;
  --status-serious:  #ec835a;
  --status-critical: #d03b3b;
  --warning-ink:     #8a5a00;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 2px rgba(11,11,11,0.06), 0 4px 16px rgba(11,11,11,0.06);
  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page-plane:     #0d0d0d;
    --surface-1:      #1a1a19;
    --surface-2:      #212120;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted:     #898781;
    --gridline:       #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255,255,255,0.10);

    --brand:     #3987e5;

    --series-1: #3987e5;
    --series-2: #199e70;
    --series-3: #c98500;
    --series-4: #008300;
    --series-5: #9085e9;
    --series-6: #e66767;
    --series-7: #d55181;
    --series-8: #d95926;
    --warning-ink: #ffcf7a;

    --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.35);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  max-width: 1120px;
  margin: 0 auto;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-primary);
}
.nav-brand:hover { text-decoration: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.95rem;
}
.nav-links a:hover, .nav-links a.active {
  color: var(--text-primary);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lang-toggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
}
.lang-toggle:hover { border-color: var(--baseline); color: var(--text-primary); }

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: transparent;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text-primary);
}

@media (max-width: 720px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: flex-start;
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    padding: 16px 24px;
    gap: 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
}

/* ---------- Hero ---------- */

.hero {
  padding: 96px 0 64px;
  text-align: left;
}

.hero-eyebrow {
  color: var(--brand);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  margin: 0 0 16px;
  max-width: 20ch;
}

.hero p.lede {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 0 32px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  font-family: var(--font-sans);
}
.btn:hover { text-decoration: none; }

.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
}
.btn-primary:hover { opacity: 0.92; }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { border-color: var(--baseline); }

/* ---------- Sections ---------- */

section { padding: 64px 0; }

.section-title {
  font-size: 1.8rem;
  margin: 0 0 8px;
}

.section-lede {
  color: var(--text-secondary);
  max-width: 60ch;
  margin: 0 0 40px;
}

/* ---------- Cards ---------- */

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-card);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.card p {
  color: var(--text-secondary);
  margin: 0;
  font-size: 0.95rem;
}

.card .card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--brand) 14%, transparent);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.2rem;
}

.demo-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.demo-card .tag {
  display: inline-flex;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--gridline);
  border-radius: 999px;
  padding: 4px 10px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

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

/* ---------- Utilities shared by demos ---------- */

.d-none-js { display: none; }

.panel-title {
  font-size: 1.3rem;
  margin: 0 0 4px;
}

.panel-sub {
  color: var(--text-secondary);
  margin: 0 0 16px;
  font-size: 0.92rem;
}

.demo-shell {
  padding: 40px 0 80px;
}

.demo-header {
  margin-bottom: 32px;
}

.demo-header .tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.demo-header h1 {
  margin: 0 0 8px;
  font-size: 2rem;
}

.demo-header p {
  color: var(--text-secondary);
  max-width: 70ch;
  margin: 0;
}

.panel {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-card);
}

.panel + .panel { margin-top: 24px; }

.filters-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.field input, .field select {
  font-family: var(--font-sans);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: 0.95rem;
  min-width: 180px;
}

.field input:focus, .field select:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th, .data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--gridline);
  font-variant-numeric: tabular-nums;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--brand) 6%, transparent);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.kpi-tile .kpi-label {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.kpi-tile .kpi-value {
  font-size: 1.8rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kpi-tile .kpi-delta {
  font-size: 0.85rem;
  margin-top: 6px;
}

.kpi-delta.good { color: var(--status-good); }
.kpi-delta.critical { color: var(--status-critical); }
.kpi-delta.warning { color: var(--warning-ink); }

.chart-wrap {
  position: relative;
  width: 100%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.chart-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-legend .legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  display: inline-block;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}

.badge.good { color: var(--status-good); background: color-mix(in srgb, var(--status-good) 14%, transparent); }
.badge.warning { color: var(--warning-ink); background: color-mix(in srgb, var(--status-warning) 25%, transparent); }
.badge.critical { color: var(--status-critical); background: color-mix(in srgb, var(--status-critical) 14%, transparent); }
