/* =============================================================================
 * RIZOMA MAUX · Estructura general (layout, tipografía, fondo aurora)
 * ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--fs-base); -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--texto); background: var(--bg);
  line-height: 1.55; min-height: 100vh; overflow-x: hidden;
}
/* Fondo aurora animado (muy sutil) */
body::before {
  content: ''; position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 35% at 15% 10%, var(--aurora-1), transparent 70%),
    radial-gradient(35% 30% at 85% 15%, var(--aurora-2), transparent 70%),
    radial-gradient(45% 40% at 70% 85%, var(--aurora-3), transparent 70%),
    radial-gradient(35% 35% at 10% 90%, var(--aurora-4), transparent 70%);
  animation: aurora 28s ease-in-out infinite alternate;
}
@keyframes aurora { to { transform: translate3d(2%, -3%, 0) rotate(4deg) scale(1.05); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } * { transition: none !important; animation: none !important; } }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.5rem, 2.6vw, 2.1rem); }
h2 { font-size: 1.35rem; } h3 { font-size: 1.12rem; } h4 { font-size: 1rem; }
p { margin: 0 0 .8em; }
a { color: var(--enlace); }
small { color: var(--texto-2); }
.ico { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex-shrink: 0; }
svg.lucide { width: 1.15em; height: 1.15em; vertical-align: -.2em; flex-shrink: 0; }

/* ---------------- Layout principal ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 18px 14px;
  background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-right: 1px solid var(--borde); display: flex; flex-direction: column; gap: 6px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; text-decoration: none; color: inherit; }
.brand-logo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: conic-gradient(from 200deg, var(--m-ambiental), var(--m-economica), var(--m-politica), var(--m-cultural), var(--m-social), var(--m-ambiental));
  box-shadow: 0 6px 18px rgba(37, 99, 235, .35); }
.brand-logo svg { width: 26px; height: 26px; }
.brand b { display: block; font-family: var(--font-display); font-size: 1.12rem; letter-spacing: .02em; }
.brand small { font-size: .72rem; }
.nav-grupo { font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; color: var(--texto-3); margin: 12px 10px 4px; font-weight: 700; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; text-decoration: none;
  color: var(--texto-2); font-weight: 600; font-size: .92rem; transition: var(--t); border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--texto); }
.nav-item.activo { background: linear-gradient(135deg, rgba(37,99,235,.14), rgba(124,58,237,.10)); color: var(--marca); border-color: rgba(37,99,235,.22); }
.nav-item .ico, .nav-item svg { width: 18px; height: 18px; }
.sidebar-pie { margin-top: auto; padding: 12px 8px 0; font-size: .74rem; color: var(--texto-3); border-top: 1px solid var(--borde); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 12px;
  padding: 0 22px; background: var(--surface); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--borde);
}
.topbar .buscar { flex: 1; max-width: 520px; position: relative; }
.topbar .buscar input { width: 100%; padding-left: 38px; }
.topbar .buscar .ico, .topbar .buscar svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--texto-3); }
.topbar .espacio { flex: 1; }
.btn-menu { display: none; }
#vista { padding: 26px clamp(16px, 3vw, 38px) 60px; max-width: 1480px; width: 100%; margin: 0 auto; }
#vista.entrando { animation: entrar .35s ease both; }
@keyframes entrar { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Resultados de búsqueda global */
.resultados { position: absolute; top: calc(100% + 6px); left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: var(--surface-solid); border: 1px solid var(--borde-2); border-radius: var(--r); box-shadow: var(--sombra-2); padding: 6px; display: none; z-index: 50; }
.resultados.abierto { display: block; }
.resultado { display: block; padding: 8px 10px; border-radius: 9px; cursor: pointer; color: inherit; text-decoration: none; font-size: .88rem; }
.resultado:hover, .resultado.sel { background: var(--surface-2); }
.resultado small { display: block; }

/* ---------------- Responsive ---------------- */
@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(86vw, 300px); transform: translateX(-105%); transition: transform var(--t); box-shadow: var(--sombra-2); background: var(--surface-solid); }
  .sidebar.abierto { transform: none; }
  .btn-menu { display: inline-flex; }
  .topbar { padding: 0 12px; }
  #vista { padding: 18px 16px 60px; }
}
@media print {
  .sidebar, .topbar, .page-actions, .no-print, #ia-panel, #ia-fab, #toasts { display: none !important; }
  .app { display: block; } body::before { display: none; } body { background: #fff; color: #000; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; background: #fff !important; }
}
